Vikshay

Admin System - By zDivine

May 15th, 2014
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 51.42 KB | None | 0 0
  1. /*
  2. Script Title: zAdmin
  3. Scripter: zDivine aka Mercenary
  4. */
  5.  
  6. #define FILTERSCRIPT
  7.  
  8. // ----- [INCLUDES] -----
  9. #include <a_samp>
  10. #include <zcmd>
  11. #include <sscanf2>
  12. #include <YSI\y_ini>
  13. #include <YSI\y_timers>
  14. #include <foreach>
  15. // ----------------------
  16.  
  17. #if defined FILTERSCRIPT
  18.  
  19. // ----- [COL DEFINES] -----
  20. #define COL_NICEGREEN      "{6EF83C}"
  21. #define COL_NICERED        "{FF0606}"
  22. #define COL_GREY           "{AFAFAF}"
  23. #define COL_ORANGE         "{FFAF00}"
  24. #define COL_EASY           "{FFF1AF}"
  25. #define COL_WHITE          "{FFFFFF}"
  26. #define COL_BLACK          "{0E0101}"
  27. #define COL_RED            "{A80000}"
  28. #define COL_YELLOW         "{F3FF02}"
  29. #define COL_YELLOW2        "{DAE368}"
  30. #define COL_BYELLOW        "{FFFF80}"
  31. #define COL_LIME           "{B7FF00}"
  32. #define COL_CYAN           "{00FFEE}"
  33. #define COL_LIGHTBLUE      "{00C0FF}"
  34. #define COL_BLUE           "{0049FF}"
  35. #define COL_MAGENTA        "{F300FF}"
  36. #define COL_VIOLET         "{B700FF}"
  37. #define COL_PINK           "{FF00EA}"
  38. #define COL_MARONE         "{A90202}"
  39. #define COL_CMD            "{B8FF02}"
  40. #define COL_PARAM          "{3FCD02}"
  41. #define COL_SERVER         "{AFE7FF}"
  42. #define COL_VALUE          "{A3E4FF}"
  43. #define COL_RULE           "{F9E8B7}"
  44. #define COL_RULE2          "{FBDF89}"
  45. #define COL_RWHITE         "{FFFFFF}"
  46. #define COL_LGREEN         "{C9FFAB}"
  47. #define COL_LRED           "{FFA1A1}"
  48. #define COL_LRED2          "{C77D87}"
  49. #define COL_GREEN          "{00BC2E}"
  50. #define COL_LBLUE          "{00A5FF}"
  51. #define COL_GRAD2          "{BFC0C2}"
  52. #define COL_REALRED        "{FF0606}"
  53. // -------------------------
  54.  
  55. // ----- [COLORS] -----
  56. #define COLOR_NICEGREEN      0x6EF83CFF
  57. #define COLOR_NICERED        0xFF0606FF
  58. #define COLOR_GREY           0xAFAFAFFF
  59. #define COLOR_ORANGE         0xFFAF00FF
  60. #define COLOR_EASY           0xFFF1AFFF
  61. #define COLOR_WHITE          0xFFFFFFFF
  62. #define COLOR_BLACK          0x0E0101FF
  63. #define COLOR_RED            0xA80000FF
  64. #define COLOR_YELLOW         0xF3FF02FF
  65. #define COLOR_YELLOW2        0xDAE368FF
  66. #define COLOR_BYELLOW        0xFFFF80FF
  67. #define COLOR_LIME           0xB7FF00FF
  68. #define COLOR_CYAN           0x00FFEEFF
  69. #define COLOR_LIGHTBLUE      0x00C0FFFF
  70. #define COLOR_BLUE           0x0049FFFF
  71. #define COLOR_MAGENTA        0xF300FFFF
  72. #define COLOR_VIOLET         0xB700FFFF
  73. #define COLOR_PINK           0xFF00EAFF
  74. #define COLOR_MARONE         0xA90202FF
  75. #define COLOR_CMD            0xB8FF02FF
  76. #define COLOR_PARAM          0x3FCD02FF
  77. #define COLOR_SERVER         0xAFE7FFFF
  78. #define COLOR_VALUE          0xA3E4FFFF
  79. #define COLOR_RULE           0xF9E8B7FF
  80. #define COLOR_RULE2          0xFBDF89FF
  81. #define COLOR_RWHITE         0xFFFFFFFF
  82. #define COLOR_LGREEN         0xC9FFABFF
  83. #define COLOR_LRED           0xFFA1A1FF
  84. #define COLOR_LRED2          0xC77D87FF
  85. #define COLOR_GREEN          0x00BC2EFF
  86. #define COLOR_LBLUE          0x00A5FFFF
  87. #define COLOR_GRAD2          0xBFC0C2FF
  88. #define COLOR_REALRED        0xFF0606FF
  89. #define COLOR_FADE1          0xE6E6E6E6
  90. #define COLOR_FADE2          0xC8C8C8C8
  91. #define COLOR_FADE3          0xAAAAAAAA
  92. #define COLOR_FADE4          0x8C8C8C8C
  93. #define COLOR_FADE5          0x6E6E6E6E
  94. #define COLOR_PURPLE         0xC2A2DAAA
  95.  
  96. forward fcreate(filename[]);
  97. public fcreate(filename[])
  98. {
  99.     if (fexist(filename)){return false;}
  100.     new File:fhandle = fopen(filename,io_write);
  101.     fclose(fhandle);
  102.     return true;
  103. }
  104.  
  105. public OnFilterScriptInit()
  106. {
  107.     // ----- [LOADING SERVER SETTINGS] -----
  108.     LoadCommands();
  109.     // -------------------------------------
  110.    
  111.     // ----- [FILE CHECKS] -----
  112.     if(!fexist("zAdmin/commands.cfg"))
  113.     {
  114.         print("WARNING: The commands.cfg file was missing, so it was automatically created.");
  115.         fcreate("zAdmin/commands.cfg");
  116.         SetCommandDefaults();
  117.     }
  118.     if(!fexist("zAdmin/bans.cfg"))
  119.     {
  120.         print("WARNING: The bans.cfg file was missing, so it was automatically created.");
  121.         fcreate("zAdmin/bans.cfg");
  122.     }
  123.     // -------------------------
  124.     print("\n--------------------------------------");
  125.     print(" zDivine's Admin System Loaded.");
  126.     print("--------------------------------------\n");
  127.    
  128.     foreach(Player, i)
  129.     {
  130.         if(IsPlayerConnected(i))
  131.         {
  132.             INI_ParseFile(UserPath(i), "LoadUser_%s", .bExtra = true, .extra = i);
  133.             SetTimerEx("UnsetLogin", 500, 0, "i", i);
  134.         }
  135.     }
  136.     return 1;
  137. }
  138.  
  139. public OnFilterScriptExit()
  140. {
  141.     // ----- [SAVING SERVER SETTINGS] -----
  142.     SaveCommands();
  143.     // ------------------------------------
  144.     return 1;
  145. }
  146.  
  147. #endif
  148.  
  149. // ----- [SERVER SETTINGS] -----
  150.  
  151. #define USER_ACCOUNTS "zAdmin/Users/%s.ini"
  152. #define PRESSED(%0) \
  153.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  154. // -----------------------------
  155.  
  156. // ----- [DIALOGS] -----
  157. #define     DIALOG_LOGIN        1
  158. #define     DIALOG_REGISTER     2
  159. #define     DIALOG_CMD_MAIN     3
  160. #define     DIALOG_CMD_EDIT     4
  161. // ---------------------
  162.  
  163. // ----- [VARIABLES] -----
  164. new bool: pLogged[MAX_PLAYERS] = false;
  165. new bool: pFrozen[MAX_PLAYERS] = false;
  166.  
  167. // INFP: 1 = TRUE / 0 = FALSE
  168. new bool: USE_ZADMIN_POSITION = true;
  169. new bool: USE_ZADMIN_SKIN     = true;
  170. new bool: USE_ZADMIN_MONEY    = true;
  171. // -----------------------
  172.  
  173. // ----- [ENUMS] -----
  174. enum p_Info
  175. {
  176.     p_Pass[64],
  177.     p_Admin,
  178.     p_IP[16],
  179.     p_Level,
  180.     p_Cash,
  181.     p_Skin,
  182.     Float: p_PosX,
  183.     Float: p_PosY,
  184.     Float: p_PosZ,
  185.     Float: p_PosA,
  186.     p_Banned,
  187.     p_Isolated,
  188.     p_IsolationTime,
  189.     p_Muted,
  190.     Float: p_Health,
  191.     Float: p_Armour
  192. }
  193. new PI[MAX_PLAYERS][p_Info];
  194.  
  195. enum cmd_Info
  196. {
  197.     cmd_SetAdmin,
  198.     cmd_Kick,
  199.     cmd_Ban,
  200.     cmd_Unban,
  201.     cmd_Freeze,
  202.     cmd_Unfreeze,
  203.     cmd_Slap,
  204.     cmd_Isolate,
  205.     cmd_Unisolate,
  206.     cmd_SetHealth,
  207.     cmd_SetArmour,
  208.     cmd_GiveGun,
  209.     cmd_GiveCar,
  210.     cmd_TakeGuns,
  211.     cmd_Goto,
  212.     cmd_GetHere,
  213.     cmd_Explode,
  214.     cmd_BanIP,
  215.     cmd_UnbanIP,
  216.     cmd_SetSkin
  217. };
  218. new CI[cmd_Info];
  219. // -------------------
  220.  
  221. // ----- [TIMERS/TASKS] -----
  222. task MinuteCount[60000]()
  223. {
  224.     foreach(Player, i)
  225.     {
  226.         if(PI[i][p_Isolated] == 1)
  227.         {
  228.             if(PI[i][p_IsolationTime] > 0)
  229.             {
  230.                 PI[i][p_IsolationTime]--;
  231.             }
  232.             else
  233.             {
  234.                 new Float: x, Float: y, Float: z;
  235.                 GetPlayerPos(i, x, y, z);
  236.                 SetPlayerPos(i, x, y, z-2000);
  237.                 TogglePlayerControllable(i, 1);
  238.                 PI[i][p_Isolated] = 0;
  239.                 GameTextForPlayer(i, "~g~UN-ISOLATED!", 3000, 5);
  240.             }
  241.         }
  242.     }
  243. }
  244. forward UnsetLogin(playerid);
  245. public UnsetLogin(playerid)
  246. {
  247.     new string[256];
  248.     format(string, sizeof(string), ""COL_WHITE"Welcome, "COL_LIGHTBLUE"%s\n\n"COL_WHITE"Account status: "COL_NICEGREEN"Registered\n\n"COL_WHITE"Please enter your password below to login.", GetName(playerid));
  249.     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "zAdmin - Login", string, "Login", "Quit");
  250.     return 1;
  251. }
  252. // --------------------------
  253.  
  254. // ----- [STOCKS] -----
  255. stock udb_hash(buf[])
  256. {
  257.     new length=strlen(buf);
  258.     new s1 = 1;
  259.     new s2 = 0;
  260.     new n;
  261.     for (n=0; n<length; n++)
  262.     {
  263.        s1 = (s1 + buf[n]) % 65521;
  264.        s2 = (s2 + s1)     % 65521;
  265.     }
  266.     return (s2 << 16) + s1;
  267. }
  268. stock GetAdminName(playerid)
  269. {
  270.     new aname[24];
  271.     switch(PI[playerid][p_Admin])
  272.     {
  273.         case 1: aname = "Moderator";
  274.         case 2: aname = "Administator";
  275.         case 3: aname = "Head Administrator";
  276.         case 4: aname = "Executive Administrator";
  277.         default: aname = "Player";
  278.     }
  279.     return aname;
  280. }
  281. stock GetName(playerid)
  282. {
  283.     new pname[MAX_PLAYER_NAME], i_pos;
  284.     GetPlayerName(playerid, pname, sizeof(pname));
  285.     while((i_pos = strfind(pname, "_", false, i_pos)) != -1) pname[i_pos] = ' ';
  286.     return pname;
  287. }
  288. stock UserPath(playerid)
  289. {
  290.     new pname[MAX_PLAYER_NAME], string[64];
  291.     GetPlayerName(playerid, pname, sizeof(pname));
  292.     format(string, sizeof(string), USER_ACCOUNTS, pname);
  293.     return string;
  294. }
  295. stock SendPermissionError(playerid)
  296. {
  297.     SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: You are not permitted to use this command ::.");
  298. }
  299. stock SendConnectionError(playerid)
  300. {
  301.     SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: Player not connected ::.");
  302.     return 1;
  303. }
  304. stock CheckBan(ip[])
  305. {
  306.     new string[128];
  307.     new File: file = fopen("zAdmin/bans.cfg", io_read);
  308.     while(fread(file, string))
  309.     {
  310.         if(strcmp(ip, string, true, strlen(ip)) == 0)
  311.         {
  312.             fclose(file);
  313.             return 1;
  314.         }
  315.     }
  316.     fclose(file);
  317.     return 0;
  318. }
  319. stock AddBan(ip[])
  320. {
  321.     if(CheckBan(ip) == 0)
  322.     {
  323.         new File: file = fopen("zAdmin/bans.cfg", io_write);
  324.         new string[20];
  325.         format(string, sizeof(string), "\n%s", ip);
  326.         fwrite(file, string);
  327.         fclose(file);
  328.         for(new i = 0; i < MAX_PLAYERS; i++)
  329.         {
  330.             new pIP[16];
  331.             GetPlayerIp(i, pIP, sizeof(pIP));
  332.             if(strcmp(pIP, ip) == 0)
  333.             {
  334.                 SendClientMessage(i, COLOR_WHITE, "SERVER: You are banned from this server.");
  335.                 Kick(i);
  336.             }
  337.         }
  338.         return 1;
  339.     }
  340.     return 0;
  341. }
  342. stock RemoveBan(ip[])
  343. {
  344.     if(CheckBan(ip) == 1)
  345.     {
  346.         new string[20];
  347.         new File: file = fopen("zAdmin/bans.cfg", io_read);
  348.         fcreate("zAdmin/tmpban.cfg");
  349.         new File: file2 = fopen("zAdmin/tmpban.cfg", io_append);
  350.         while(fread(file, string))
  351.         {
  352.             if(strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\n", string) != 0)
  353.             {
  354.                 fwrite(file2, string);
  355.             }
  356.         }
  357.         fclose(file);
  358.         fclose(file2);
  359.         file = fopen("zAdmin/bans.cfg", io_write);
  360.         file2 = fopen("zAdmin/tmpban.cfg", io_read);
  361.         while(fread(file2, string))
  362.         {
  363.             fwrite(file, string);
  364.         }
  365.         fclose(file);
  366.         fclose(file2);
  367.         fremove("zAdmin/tmpban.cfg");
  368.         return 1;
  369.     }
  370.     return 0;
  371. }
  372. stock SetCommandDefaults()
  373. {
  374.     CI[cmd_SetAdmin] = 1;
  375.     CI[cmd_Kick] = 1;
  376.     CI[cmd_Ban] = 1;
  377.     CI[cmd_Unban] = 1;
  378.     CI[cmd_Freeze] = 1;
  379.     CI[cmd_Unfreeze] = 1;
  380.     CI[cmd_Slap] = 1;
  381.     CI[cmd_Isolate] = 1;
  382.     CI[cmd_Unisolate] = 1;
  383.     CI[cmd_SetHealth] = 1;
  384.     CI[cmd_SetArmour] = 1;
  385.     CI[cmd_GiveGun] = 1;
  386.     CI[cmd_GiveCar] = 1;
  387.     CI[cmd_TakeGuns] = 1;
  388.     CI[cmd_Goto] = 1;
  389.     CI[cmd_GetHere] = 1;
  390.     CI[cmd_Explode] = 1;
  391.     CI[cmd_BanIP] = 1;
  392.     CI[cmd_UnbanIP] = 1;
  393.     SaveCommands();
  394. }
  395. // --------------------
  396.  
  397. // ----- [SAVING/LOADING] -----
  398. forward SaveAccount(playerid);
  399. public SaveAccount(playerid)
  400. {
  401.     if(pLogged[playerid] == true)
  402.     {
  403.         new Float: x, Float: y, Float: z, Float: a;
  404.         GetPlayerPos(playerid, x, y, z);
  405.         GetPlayerFacingAngle(playerid, a);
  406.        
  407.         PI[playerid][p_PosX] = x;
  408.         PI[playerid][p_PosY] = y;
  409.         PI[playerid][p_PosZ] = z;
  410.         PI[playerid][p_PosA] = a;
  411.        
  412.         new INI:File = INI_Open(UserPath(playerid));
  413.         INI_SetTag(File, "data");
  414.         INI_WriteInt(File, "Admin", PI[playerid][p_Admin]);
  415.         INI_WriteString(File, "IP", PI[playerid][p_IP]);
  416.         INI_WriteInt(File, "Level", PI[playerid][p_Level]);
  417.         INI_WriteInt(File, "Cash", PI[playerid][p_Cash]);
  418.         INI_WriteInt(File, "Skin", PI[playerid][p_Skin]);
  419.         INI_WriteFloat(File, "PosX", PI[playerid][p_PosX]);
  420.         INI_WriteFloat(File, "PosY", PI[playerid][p_PosY]);
  421.         INI_WriteFloat(File, "PosZ", PI[playerid][p_PosZ]);
  422.         INI_WriteFloat(File, "PosA", PI[playerid][p_PosA]);
  423.         INI_WriteInt(File, "Banned", PI[playerid][p_Banned]);
  424.         INI_WriteInt(File, "Isolated", PI[playerid][p_Isolated]);
  425.         INI_WriteInt(File, "IsolationTime", PI[playerid][p_IsolationTime]);
  426.         INI_WriteInt(File, "Muted", PI[playerid][p_Muted]);
  427.         INI_WriteFloat(File, "Health", PI[playerid][p_Health]);
  428.         INI_WriteFloat(File, "Armour", PI[playerid][p_Armour]);
  429.         INI_Close(File);
  430.     }
  431.     return 1;
  432. }
  433. forward LoadUser_data(playerid, name[], value[]);
  434. public LoadUser_data(playerid, name[], value[])
  435. {
  436.     INI_Int("Password", PI[playerid][p_Pass]);
  437.     INI_Int("Admin", PI[playerid][p_Admin]);
  438.     INI_String("IP", PI[playerid][p_IP], 16);
  439.     INI_Int("Level", PI[playerid][p_Level]);
  440.     INI_Int("Cash", PI[playerid][p_Cash]);
  441.     INI_Int("Skin", PI[playerid][p_Skin]);
  442.     INI_Float("PosX", PI[playerid][p_PosX]);
  443.     INI_Float("PosY", PI[playerid][p_PosY]);
  444.     INI_Float("PosZ", PI[playerid][p_PosZ]);
  445.     INI_Float("PosA", PI[playerid][p_PosA]);
  446.     INI_Int("Banned", PI[playerid][p_Banned]);
  447.     INI_Int("Isolated", PI[playerid][p_Isolated]);
  448.     INI_Int("IsolationTime", PI[playerid][p_IsolationTime]);
  449.     INI_Int("Muted", PI[playerid][p_Muted]);
  450.     INI_Float("Health", PI[playerid][p_Health]);
  451.     INI_Float("Armour", PI[playerid][p_Armour]);
  452.     return 1;
  453. }
  454. stock SaveCommands()
  455. {
  456.     new string[128];
  457.     new File: file = fopen("zAdmin/commands.cfg", io_write);
  458.     format(string, sizeof(string), "%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d",
  459.     CI[cmd_SetAdmin],
  460.     CI[cmd_Kick],
  461.     CI[cmd_Ban],
  462.     CI[cmd_Unban],
  463.     CI[cmd_Freeze],
  464.     CI[cmd_Unfreeze],
  465.     CI[cmd_Slap],
  466.     CI[cmd_Isolate],
  467.     CI[cmd_Unisolate],
  468.     CI[cmd_SetHealth],
  469.     CI[cmd_SetArmour],
  470.     CI[cmd_GiveGun],
  471.     CI[cmd_GiveCar],
  472.     CI[cmd_TakeGuns],
  473.     CI[cmd_Goto],
  474.     CI[cmd_GetHere],
  475.     CI[cmd_Explode]);
  476.     fwrite(file, string);
  477.     fclose(file);
  478.     return 1;
  479. }
  480. stock LoadCommands()
  481. {
  482.     new string[128];
  483.     new File: file = fopen("zAdmin/commands.cfg", io_read);
  484.     sscanf(string, "p<|>iiiiiiiiiiiiiiiiiii",
  485.     CI[cmd_SetAdmin],
  486.     CI[cmd_Kick],
  487.     CI[cmd_Ban],
  488.     CI[cmd_Unban],
  489.     CI[cmd_Freeze],
  490.     CI[cmd_Unfreeze],
  491.     CI[cmd_Slap],
  492.     CI[cmd_Isolate],
  493.     CI[cmd_Unisolate],
  494.     CI[cmd_SetHealth],
  495.     CI[cmd_SetArmour],
  496.     CI[cmd_GiveGun],
  497.     CI[cmd_GiveCar],
  498.     CI[cmd_TakeGuns],
  499.     CI[cmd_Goto],
  500.     CI[cmd_GetHere],
  501.     CI[cmd_Explode],
  502.     CI[cmd_BanIP],
  503.     CI[cmd_UnbanIP]);
  504.     fclose(file);
  505.     return 1;
  506. }
  507. // ----------------------------
  508.  
  509. public OnPlayerConnect(playerid)
  510. {
  511.     new string[256], pIP[16];
  512.     GetPlayerIp(playerid, pIP, sizeof(pIP));
  513.     if(CheckBan(pIP) == 1)
  514.     {
  515.         format(string, sizeof(string), ".:: ERROR: This IP (%s) is banned from the server ::.", pIP);
  516.         SendClientMessage(playerid, COLOR_REALRED, string);
  517.         return 1;
  518.     }
  519.     if(PI[playerid][p_Banned] == 1)
  520.     {
  521.         format(string, sizeof(string), ".:: ERROR: This account (%s) is banned from the server ::.", GetName(playerid));
  522.         SendClientMessage(playerid, COLOR_REALRED, string);
  523.         return 1;
  524.     }
  525.     if(PI[playerid][p_Banned] == 1 && CheckBan(pIP) == 0)
  526.     {
  527.         foreach(Player, i)
  528.         {
  529.             if(PI[i][p_Admin] >= 1)
  530.             {
  531.                 format(string, sizeof(string), ".:: %s just attempted to login to the server on a banned account, and has been automatically IP banned ::.", GetName(playerid));
  532.                 SendClientMessage(i, COLOR_YELLOW, string);
  533.                 AddBan(pIP);
  534.             }
  535.         }
  536.     }
  537.     format(string, sizeof(string), ".:: [CONNECT] %s has joined the server ::.", GetName(playerid));
  538.     SendClientMessageToAll(COLOR_GREY, string);
  539.     if(!fexist(UserPath(playerid)))
  540.     {
  541.         format(string, sizeof(string), ""COL_WHITE"Welcome, "COL_LIGHTBLUE"%s\n\n"COL_WHITE"Account status: "COL_NICERED"Unregistered\n\n"COL_WHITE"Please enter your desired password below to register.", GetName(playerid));
  542.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "zAdmin - Registration", string, "Register", "Quit");
  543.     }
  544.     else
  545.     {
  546.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  547.         SetTimerEx("UnsetLogin", 500, 0, "i", playerid);
  548.     }
  549.     return 1;
  550. }
  551.  
  552. public OnPlayerDisconnect(playerid, reason)
  553. {
  554.     new string[128];
  555.     if(pLogged[playerid] == true)
  556.     {
  557.         SaveAccount(playerid);
  558.         pLogged[playerid] = false;
  559.     }
  560.     switch(reason)
  561.     {
  562.         case 0: format(string, sizeof(string), ".:: [DISCONNECT] %s has left the server [TIMED-OUT] ::.", GetName(playerid));
  563.         case 1: format(string, sizeof(string), ".:: [DISCONNECT] %s has left the server [LEAVING] ::.", GetName(playerid));
  564.         case 2: format(string, sizeof(string), ".:: [DISCONNECT] %s has left the server [KICKED/BANNED] ::.", GetName(playerid));
  565.     }
  566.     SendClientMessageToAll(COLOR_GREY, string);
  567.     return 1;
  568. }
  569.  
  570. public OnPlayerSpawn(playerid)
  571. {
  572.     if(PI[playerid][p_PosX] == 0.0 && PI[playerid][p_PosY] == 0.0 && PI[playerid][p_PosZ] == 0.0)
  573.     {
  574.         SetPlayerSkin(playerid, PI[playerid][p_Skin]);
  575.         // You can set their position here.
  576.     }
  577.     else
  578.     {
  579.         if(USE_ZADMIN_POSITION == true)
  580.         {
  581.             SetPlayerPos(playerid, PI[playerid][p_PosX], PI[playerid][p_PosY], PI[playerid][p_PosZ]);
  582.             SetPlayerFacingAngle(playerid, PI[playerid][p_PosA]);
  583.         }
  584.         if(USE_ZADMIN_SKIN == true)
  585.         {
  586.             SetPlayerSkin(playerid, PI[playerid][p_Skin]);
  587.         }
  588.         if(USE_ZADMIN_MONEY == true)
  589.         {
  590.             ResetPlayerMoney(playerid);
  591.             GivePlayerMoney(playerid, PI[playerid][p_Cash]);
  592.         }
  593.     }
  594.     return 1;
  595. }
  596.  
  597. public OnPlayerDeath(playerid, killerid, reason)
  598. {
  599.     return 1;
  600. }
  601.  
  602. public OnVehicleSpawn(vehicleid)
  603. {
  604.     return 1;
  605. }
  606.  
  607. public OnVehicleDeath(vehicleid, killerid)
  608. {
  609.     return 1;
  610. }
  611.  
  612. public OnPlayerText(playerid, text[])
  613. {
  614.     return 1;
  615. }
  616.  
  617. public OnPlayerCommandText(playerid, cmdtext[])
  618. {
  619.     return 0;
  620. }
  621.  
  622. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  623. {
  624.     return 1;
  625. }
  626.  
  627. public OnPlayerExitVehicle(playerid, vehicleid)
  628. {
  629.     return 1;
  630. }
  631.  
  632. public OnPlayerStateChange(playerid, newstate, oldstate)
  633. {
  634.     return 1;
  635. }
  636.  
  637. public OnPlayerEnterCheckpoint(playerid)
  638. {
  639.     return 1;
  640. }
  641.  
  642. public OnPlayerLeaveCheckpoint(playerid)
  643. {
  644.     return 1;
  645. }
  646.  
  647. public OnPlayerEnterRaceCheckpoint(playerid)
  648. {
  649.     return 1;
  650. }
  651.  
  652. public OnPlayerLeaveRaceCheckpoint(playerid)
  653. {
  654.     return 1;
  655. }
  656.  
  657. public OnRconCommand(cmd[])
  658. {
  659.     return 1;
  660. }
  661.  
  662. public OnPlayerRequestSpawn(playerid)
  663. {
  664.     return 1;
  665. }
  666.  
  667. public OnObjectMoved(objectid)
  668. {
  669.     return 1;
  670. }
  671.  
  672. public OnPlayerObjectMoved(playerid, objectid)
  673. {
  674.     return 1;
  675. }
  676.  
  677. public OnPlayerPickUpPickup(playerid, pickupid)
  678. {
  679.     return 1;
  680. }
  681.  
  682. public OnVehicleMod(playerid, vehicleid, componentid)
  683. {
  684.     return 1;
  685. }
  686.  
  687. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  688. {
  689.     return 1;
  690. }
  691.  
  692. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  693. {
  694.     return 1;
  695. }
  696.  
  697. public OnPlayerSelectedMenuRow(playerid, row)
  698. {
  699.     return 1;
  700. }
  701.  
  702. public OnPlayerExitedMenu(playerid)
  703. {
  704.     return 1;
  705. }
  706.  
  707. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  708. {
  709.     return 1;
  710. }
  711.  
  712. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  713. {
  714.     return 1;
  715. }
  716.  
  717. public OnRconLoginAttempt(ip[], password[], success)
  718. {
  719.     return 1;
  720. }
  721.  
  722. public OnPlayerUpdate(playerid)
  723. {
  724.     return 1;
  725. }
  726.  
  727. public OnPlayerStreamIn(playerid, forplayerid)
  728. {
  729.     return 1;
  730. }
  731.  
  732. public OnPlayerStreamOut(playerid, forplayerid)
  733. {
  734.     return 1;
  735. }
  736.  
  737. public OnVehicleStreamIn(vehicleid, forplayerid)
  738. {
  739.     return 1;
  740. }
  741.  
  742. public OnVehicleStreamOut(vehicleid, forplayerid)
  743. {
  744.     return 1;
  745. }
  746.  
  747. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  748. {
  749.     new string[256];
  750.     if(dialogid == DIALOG_REGISTER)
  751.     {
  752.         if(!response) Kick(playerid);
  753.         if(response)
  754.         {
  755.             if(strlen(inputtext) >= 5 && strlen(inputtext) <= 16)
  756.             {
  757.                 new pIP[16];
  758.                 GetPlayerIp(playerid, pIP, sizeof(pIP));
  759.                 new INI:File = INI_Open(UserPath(playerid));
  760.                 INI_SetTag(File, "data");
  761.                 INI_WriteInt(File, "Password", udb_hash(inputtext));
  762.                 INI_WriteInt(File, "Admin", 0);
  763.                 INI_WriteString(File, "IP", pIP);
  764.                 INI_WriteInt(File, "Level", 0);
  765.                 INI_WriteInt(File, "Cash", 0);
  766.                 INI_WriteInt(File, "Skin", 299);
  767.                 INI_WriteFloat(File, "PosX", 0.0);
  768.                 INI_WriteFloat(File, "PosY", 0.0);
  769.                 INI_WriteFloat(File, "PosZ", 0.0);
  770.                 INI_WriteFloat(File, "PosA", 0.0);
  771.                 INI_WriteInt(File, "Banned", 0);
  772.                 INI_WriteInt(File, "Isolated", 0);
  773.                 INI_WriteInt(File, "IsolationTime", 0);
  774.                 INI_WriteInt(File, "Muted", 0);
  775.                 INI_WriteFloat(File, "Health", 100.0);
  776.                 INI_WriteFloat(File, "Armour", 0.0);
  777.                 INI_Close(File);
  778.                 PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0.0);
  779.                 format(string, sizeof(string), ".:: Account '%s' successfully registered with password '%s' ::.", GetName(playerid), inputtext);
  780.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  781.                 pLogged[playerid] = true;
  782.                 SetSpawnInfo(playerid, 0, 299, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
  783.                 SpawnPlayer(playerid);
  784.             }
  785.             else
  786.             {
  787.                 format(string, sizeof(string), ""COL_NICERED"ERROR: "COL_WHITE"Invalid password length. (5 - 16 characters.\n\n"COL_WHITE"Welcome, "COL_LIGHTBLUE"%s\n\n"COL_WHITE"Account status: "COL_NICERED"Unregistered\n\n"COL_WHITE"Please enter your desired password below to register.", GetName(playerid));
  788.                 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "zAdmin - Registration", string, "Register", "Quit");
  789.             }
  790.         }
  791.     }
  792.     if(dialogid == DIALOG_LOGIN)
  793.     {
  794.         if(!response) Kick(playerid);
  795.         if(response)
  796.         {
  797.             if(udb_hash(inputtext) == PI[playerid][p_Pass])
  798.             {
  799.                 format(string, sizeof(string), ".:: Successfully logged into account '%s' ::.", GetName(playerid));
  800.                 PlayerPlaySound(playerid, 5201, 0.0, 0.0, 0.0);
  801.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  802.                 SpawnPlayer(playerid);
  803.             }
  804.             else
  805.             {
  806.                 format(string, sizeof(string), ""COL_NICERED"ERROR: "COL_WHITE"Invalid password.\n\n"COL_WHITE"Welcome, "COL_LIGHTBLUE"%s\n\n"COL_WHITE"Account status: "COL_NICEGREEN"Registered\n\n"COL_WHITE"Please enter your password below to login.", GetName(playerid));
  807.                 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "zAdmin - Login", string, "Login", "Quit");
  808.             }
  809.         }
  810.     }
  811.     if(dialogid == DIALOG_CMD_MAIN)
  812.     {
  813.         if(response)
  814.         {
  815.             switch(listitem)
  816.             {
  817.                 case 0:
  818.                 {
  819.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: SetAdmin\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  820.                     SetPVarInt(playerid, "cmd_SetAdmin", 1);
  821.                 }
  822.                 case 1:
  823.                 {
  824.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Kick\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  825.                     SetPVarInt(playerid, "cmd_Kick", 1);
  826.                 }
  827.                 case 2:
  828.                 {
  829.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Ban\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  830.                     SetPVarInt(playerid, "cmd_Ban", 1);
  831.                 }
  832.                 case 3:
  833.                 {
  834.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Unban\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  835.                     SetPVarInt(playerid, "cmd_Unban", 1);
  836.                 }
  837.                 case 4:
  838.                 {
  839.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Freeze\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  840.                     SetPVarInt(playerid, "cmd_Freeze", 1);
  841.                 }
  842.                 case 5:
  843.                 {
  844.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Unfreeze\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  845.                     SetPVarInt(playerid, "cmd_Unfreeze", 1);
  846.                 }
  847.                 case 6:
  848.                 {
  849.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Slap\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  850.                     SetPVarInt(playerid, "cmd_Slap", 1);
  851.                 }
  852.                 case 7:
  853.                 {
  854.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Isolate\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  855.                     SetPVarInt(playerid, "cmd_Isolate", 1);
  856.                 }
  857.                 case 8:
  858.                 {
  859.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Unisolate\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  860.                     SetPVarInt(playerid, "cmd_Unisolate", 1);
  861.                 }
  862.                 case 9:
  863.                 {
  864.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: SetHealth\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  865.                     SetPVarInt(playerid, "cmd_SetHealth", 1);
  866.                 }
  867.                 case 10:
  868.                 {
  869.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: SetArmour\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  870.                     SetPVarInt(playerid, "cmd_SetArmour", 1);
  871.                 }
  872.                 case 11:
  873.                 {
  874.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: GiveGun\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  875.                     SetPVarInt(playerid, "cmd_GiveGun", 1);
  876.                 }
  877.                 case 12:
  878.                 {
  879.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: GiveCar\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  880.                     SetPVarInt(playerid, "cmd_GiveCar", 1);
  881.                 }
  882.                 case 13:
  883.                 {
  884.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: TakeGuns\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  885.                     SetPVarInt(playerid, "cmd_TakeGuns", 1);
  886.                 }
  887.                 case 14:
  888.                 {
  889.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Goto\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  890.                     SetPVarInt(playerid, "cmd_Goto", 1);
  891.                 }
  892.                 case 15:
  893.                 {
  894.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: GetHere\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  895.                     SetPVarInt(playerid, "cmd_GetHere", 1);
  896.                 }
  897.                 case 16:
  898.                 {
  899.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: Explode\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  900.                     SetPVarInt(playerid, "cmd_Explode", 1);
  901.                 }
  902.                 case 17:
  903.                 {
  904.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: BanIP\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  905.                     SetPVarInt(playerid, "cmd_BanIP", 1);
  906.                 }
  907.                 case 18:
  908.                 {
  909.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: UnbanIP\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  910.                     SetPVarInt(playerid, "cmd_UnbanIP", 1);
  911.                 }
  912.                 case 19:
  913.                 {
  914.                     ShowPlayerDialog(playerid, DIALOG_CMD_EDIT, DIALOG_STYLE_INPUT, "zAdmin - Command Editor", "Command name: SetSkin\n\nPlease enter the desired level for this command.", "Enter", "Cancel");
  915.                     SetPVarInt(playerid, "cmd_SetSkin", 1);
  916.                 }
  917.             }
  918.         }
  919.     }
  920.     if(dialogid == DIALOG_CMD_EDIT)
  921.     {
  922.         if(response)
  923.         {
  924.             if(strval(inputtext) > 0 && strval(inputtext) < 5)
  925.             {
  926.                 if(GetPVarInt(playerid, "cmd_SetAdmin") == 1)
  927.                 {
  928.                     format(string, sizeof(string), ".:: Command level set. [Command: SetAdmin | Level: %d] ::.", strval(inputtext));
  929.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  930.                     DeletePVar(playerid, "cmd_SetAdmin");
  931.                     CI[cmd_SetAdmin] = strval(inputtext);
  932.                     SaveCommands();
  933.                 }
  934.                 if(GetPVarInt(playerid, "cmd_Kick") == 1)
  935.                 {
  936.                     format(string, sizeof(string), ".:: Command level set. [Command: Kick | Level: %d] ::.", strval(inputtext));
  937.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  938.                     DeletePVar(playerid, "cmd_Kick");
  939.                     CI[cmd_Kick] = strval(inputtext);
  940.                     SaveCommands();
  941.                 }
  942.                 if(GetPVarInt(playerid, "cmd_Ban") == 1)
  943.                 {
  944.                     format(string, sizeof(string), ".:: Command level set. [Command: Ban | Level: %d] ::.", strval(inputtext));
  945.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  946.                     DeletePVar(playerid, "cmd_Ban");
  947.                     CI[cmd_Ban] = strval(inputtext);
  948.                     SaveCommands();
  949.                 }
  950.                 if(GetPVarInt(playerid, "cmd_Unban") == 1)
  951.                 {
  952.                     format(string, sizeof(string), ".:: Command level set. [Command: Unban | Level: %d] ::.", strval(inputtext));
  953.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  954.                     DeletePVar(playerid, "cmd_Unban");
  955.                     CI[cmd_Unban] = strval(inputtext);
  956.                     SaveCommands();
  957.                 }
  958.                 if(GetPVarInt(playerid, "cmd_Freeze") == 1)
  959.                 {
  960.                     format(string, sizeof(string), ".:: Command level set. [Command: Freeze | Level: %d] ::.", strval(inputtext));
  961.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  962.                     DeletePVar(playerid, "cmd_Freeze");
  963.                     CI[cmd_Freeze] = strval(inputtext);
  964.                     SaveCommands();
  965.                 }
  966.                 if(GetPVarInt(playerid, "cmd_Unfreeze") == 1)
  967.                 {
  968.                     format(string, sizeof(string), ".:: Command level set. [Command: Unfreeze | Level: %d] ::.", strval(inputtext));
  969.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  970.                     DeletePVar(playerid, "cmd_Unfreeze");
  971.                     CI[cmd_Unfreeze] = strval(inputtext);
  972.                     SaveCommands();
  973.                 }
  974.                 if(GetPVarInt(playerid, "cmd_Slap") == 1)
  975.                 {
  976.                     format(string, sizeof(string), ".:: Command level set. [Command: Slap | Level: %d] ::.", strval(inputtext));
  977.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  978.                     DeletePVar(playerid, "cmd_Slap");
  979.                     CI[cmd_Slap] = strval(inputtext);
  980.                     SaveCommands();
  981.                 }
  982.                 if(GetPVarInt(playerid, "cmd_Isolate") == 1)
  983.                 {
  984.                     format(string, sizeof(string), ".:: Command level set. [Command: Isolate | Level: %d] ::.", strval(inputtext));
  985.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  986.                     DeletePVar(playerid, "cmd_Isolate");
  987.                     CI[cmd_Isolate] = strval(inputtext);
  988.                     SaveCommands();
  989.                 }
  990.                 if(GetPVarInt(playerid, "cmd_Unisolate") == 1)
  991.                 {
  992.                     format(string, sizeof(string), ".:: Command level set. [Command: Unisolate | Level: %d] ::.", strval(inputtext));
  993.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  994.                     DeletePVar(playerid, "cmd_Unisolate");
  995.                     CI[cmd_Unisolate] = strval(inputtext);
  996.                     SaveCommands();
  997.                 }
  998.                 if(GetPVarInt(playerid, "cmd_SetHealth") == 1)
  999.                 {
  1000.                     format(string, sizeof(string), ".:: Command level set. [Command: SetHealth | Level: %d] ::.", strval(inputtext));
  1001.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1002.                     DeletePVar(playerid, "cmd_SetHealth");
  1003.                     CI[cmd_SetHealth] = strval(inputtext);
  1004.                     SaveCommands();
  1005.                 }
  1006.                 if(GetPVarInt(playerid, "cmd_SetArmour") == 1)
  1007.                 {
  1008.                     format(string, sizeof(string), ".:: Command level set. [Command: SetArmour | Level: %d] ::.", strval(inputtext));
  1009.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1010.                     DeletePVar(playerid, "cmd_SetArmour");
  1011.                     CI[cmd_SetArmour] = strval(inputtext);
  1012.                     SaveCommands();
  1013.                 }
  1014.                 if(GetPVarInt(playerid, "cmd_GiveGun") == 1)
  1015.                 {
  1016.                     format(string, sizeof(string), ".:: Command level set. [Command: GiveGun | Level: %d] ::.", strval(inputtext));
  1017.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1018.                     DeletePVar(playerid, "cmd_GiveGun");
  1019.                     CI[cmd_GiveGun] = strval(inputtext);
  1020.                     SaveCommands();
  1021.                 }
  1022.                 if(GetPVarInt(playerid, "cmd_GiveCar") == 1)
  1023.                 {
  1024.                     format(string, sizeof(string), ".:: Command level set. [Command: GiveCar | Level: %d] ::.", strval(inputtext));
  1025.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1026.                     DeletePVar(playerid, "cmd_GiveCar");
  1027.                     CI[cmd_GiveCar] = strval(inputtext);
  1028.                     SaveCommands();
  1029.                 }
  1030.                 if(GetPVarInt(playerid, "cmd_TakeGuns") == 1)
  1031.                 {
  1032.                     format(string, sizeof(string), ".:: Command level set. [Command: TakeGuns | Level: %d] ::.", strval(inputtext));
  1033.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1034.                     DeletePVar(playerid, "cmd_TakeGuns");
  1035.                     CI[cmd_TakeGuns] = strval(inputtext);
  1036.                     SaveCommands();
  1037.                 }
  1038.                 if(GetPVarInt(playerid, "cmd_Goto") == 1)
  1039.                 {
  1040.                     format(string, sizeof(string), ".:: Command level set. [Command: Goto | Level: %d] ::.", strval(inputtext));
  1041.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1042.                     DeletePVar(playerid, "cmd_Goto");
  1043.                     CI[cmd_Goto] = strval(inputtext);
  1044.                     SaveCommands();
  1045.                 }
  1046.                 if(GetPVarInt(playerid, "cmd_GetHere") == 1)
  1047.                 {
  1048.                     format(string, sizeof(string), ".:: Command level set. [Command: GetHere | Level: %d] ::.", strval(inputtext));
  1049.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1050.                     DeletePVar(playerid, "cmd_GetHere");
  1051.                     CI[cmd_GetHere] = strval(inputtext);
  1052.                     SaveCommands();
  1053.                 }
  1054.                 if(GetPVarInt(playerid, "cmd_Explode") == 1)
  1055.                 {
  1056.                     format(string, sizeof(string), ".:: Command level set. [Command: Explode | Level: %d] ::.", strval(inputtext));
  1057.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1058.                     DeletePVar(playerid, "cmd_Explode");
  1059.                     CI[cmd_Explode] = strval(inputtext);
  1060.                     SaveCommands();
  1061.                 }
  1062.                 if(GetPVarInt(playerid, "cmd_BanIP") == 1)
  1063.                 {
  1064.                     format(string, sizeof(string), ".:: Command level set. [Command: BanIP | Level: %d] ::.", strval(inputtext));
  1065.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1066.                     DeletePVar(playerid, "cmd_BanIP");
  1067.                     CI[cmd_BanIP] = strval(inputtext);
  1068.                     SaveCommands();
  1069.                 }
  1070.                 if(GetPVarInt(playerid, "cmd_UnbanIP") == 1)
  1071.                 {
  1072.                     format(string, sizeof(string), ".:: Command level set. [Command: UnbanIP | Level: %d] ::.", strval(inputtext));
  1073.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1074.                     DeletePVar(playerid, "cmd_UnbanIP");
  1075.                     CI[cmd_UnbanIP] = strval(inputtext);
  1076.                     SaveCommands();
  1077.                 }
  1078.                 if(GetPVarInt(playerid, "cmd_SetSkin") == 1)
  1079.                 {
  1080.                     format(string, sizeof(string), ".:: Command level set. [Command: SetSkin | Level: %d] ::.", strval(inputtext));
  1081.                     SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1082.                     DeletePVar(playerid, "cmd_SetSkin");
  1083.                     CI[cmd_SetSkin] = strval(inputtext);
  1084.                     SaveCommands();
  1085.                 }
  1086.             }
  1087.             else
  1088.             {
  1089.                 SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: Command level must be between 1 and 4 ::.");
  1090.             }
  1091.         }
  1092.     }
  1093.     return 1;
  1094. }
  1095.  
  1096. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  1097. {
  1098.     return 1;
  1099. }
  1100. CMD:editcmds(playerid, params[])
  1101. {
  1102.     if(PI[playerid][p_Admin] >= 4)
  1103.     {
  1104.         ShowPlayerDialog(playerid, DIALOG_CMD_MAIN, DIALOG_STYLE_LIST, "zAdmin - Command Editor", "SetAdmin\nKick\nBan\nUnban\nFreeze\nUnfreeze\nSlap\nIsolate\nUnisolate\nSetHealth\nSetArmour\nGiveGun\nGiveCar\nTakeGuns\nGoto\nGetHere\nExplode\nBanIP\nUnbanIP\nSetSkin", "Select", "Cancel");
  1105.     }
  1106.     else
  1107.     {
  1108.         SendPermissionError(playerid);
  1109.     }
  1110.     return 1;
  1111. }
  1112. CMD:setadmin(playerid, params[])
  1113. {
  1114.     if(PI[playerid][p_Admin] >= CI[cmd_SetAdmin])
  1115.     {
  1116.         new targetid, level, string[128];
  1117.         if(sscanf(params, "ud", targetid, level)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /setadmin [playerid] [level]");
  1118.  
  1119.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1120.         if(PI[targetid][p_Admin] == level) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player is already that level ::.");
  1121.  
  1122.         PI[targetid][p_Admin] = level;
  1123.         format(string, sizeof(string), ".:: You have set %s to a(n) %s ::.", GetName(targetid), GetAdminName(targetid));
  1124.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1125.         format(string, sizeof(string), ".:: %s %s has set you to a(n) %s ::.", GetAdminName(playerid), GetName(playerid), GetAdminName(targetid));
  1126.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1127.     }
  1128.     else
  1129.     {
  1130.         SendPermissionError(playerid);
  1131.     }
  1132.     return 1;
  1133. }
  1134. CMD:kick(playerid, params[])
  1135. {
  1136.     if(PI[playerid][p_Admin] >= CI[cmd_Kick])
  1137.     {
  1138.         new targetid, reason[64], string[128];
  1139.         if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [playerid] [reason]");
  1140.        
  1141.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1142.        
  1143.         format(string, sizeof(string), ".:: %s %s has kicked %s, reason: %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid), reason);
  1144.         SendClientMessageToAll(COLOR_REALRED, string);
  1145.         Kick(targetid);
  1146.     }
  1147.     else
  1148.     {
  1149.         SendPermissionError(playerid);
  1150.     }
  1151.     return 1;
  1152. }
  1153. CMD:ban(playerid, params[])
  1154. {
  1155.     if(PI[playerid][p_Admin] >= CI[cmd_Ban])
  1156.     {
  1157.         new targetid, reason[64], string[128], tIP[16];
  1158.         if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /ban [playerid] [reaosn]");
  1159.        
  1160.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1161.        
  1162.         format(string, sizeof(string), ".:: %s %s has banned %s, reason: %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid), reason);
  1163.         SendClientMessageToAll(COLOR_REALRED, string);
  1164.         GetPlayerIp(targetid, tIP, sizeof(tIP));
  1165.         PI[targetid][p_Banned] = 1;
  1166.         AddBan(tIP);
  1167.         Kick(targetid);
  1168.         SaveAccount(targetid);
  1169.     }
  1170.     else
  1171.     {
  1172.         SendPermissionError(playerid);
  1173.     }
  1174.     return 1;
  1175. }
  1176. CMD:unban(playerid, params[])
  1177. {
  1178.     if(PI[playerid][p_Admin] >= CI[cmd_Unban])
  1179.     {
  1180.         new targetname[MAX_PLAYER_NAME], string[128], pathstring[64];
  1181.         if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unban [account name]");
  1182.  
  1183.         format(pathstring, sizeof(pathstring), "zAdmin/Users/%s.ini", targetname);
  1184.         if(!fexist(pathstring)) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player's file does not exist.");
  1185.        
  1186.         new INI:File = INI_Open(pathstring);
  1187.         INI_SetTag(File, "data");
  1188.         INI_WriteInt(File, "Banned", 0);
  1189.         INI_Close(File);
  1190.        
  1191.         format(string, sizeof(string), ".:: %s %s has unbanned account '%s' ::.", GetAdminName(playerid), GetName(playerid), targetname);
  1192.         SendClientMessageToAll(COLOR_REALRED, string);
  1193.     }
  1194.     else
  1195.     {
  1196.         SendPermissionError(playerid);
  1197.     }
  1198.     return 1;
  1199. }
  1200. CMD:banip(playerid, params[])
  1201. {
  1202.     if(PI[playerid][p_Admin] >= CI[cmd_BanIP])
  1203.     {
  1204.         new tIP[16], string[128];
  1205.         if(sscanf(params, "s[16]", tIP)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /banip [IP]");
  1206.        
  1207.         if(CheckBan(tIP) == 1) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That IP is already banned ::.");
  1208.        
  1209.         format(string, sizeof(string), ".:: %s %s has banned IP '%s' ::.", GetAdminName(playerid), GetName(playerid), tIP);
  1210.         SendClientMessageToAll(COLOR_REALRED, string);
  1211.         AddBan(tIP);
  1212.     }
  1213.     else
  1214.     {
  1215.         SendPermissionError(playerid);
  1216.     }
  1217.     return 1;
  1218. }
  1219. CMD:unbanip(playerid, params[])
  1220. {
  1221.     if(PI[playerid][p_Admin] >= CI[cmd_UnbanIP])
  1222.     {
  1223.         new tIP[16], string[128];
  1224.         if(sscanf(params, "s[16]", tIP)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unbanip [IP]");
  1225.        
  1226.         if(CheckBan(tIP) == 0) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That IP is not banned ::.");
  1227.        
  1228.         format(string, sizeof(string), ".:: %s %s has unbanned IP '%s' ::.", GetAdminName(playerid), GetName(playerid), tIP);
  1229.         SendClientMessageToAll(COLOR_REALRED, string);
  1230.         RemoveBan(tIP);
  1231.     }
  1232.     else
  1233.     {
  1234.         SendPermissionError(playerid);
  1235.     }
  1236.     return 1;
  1237. }
  1238. CMD:freeze(playerid, params[])
  1239. {
  1240.     if(PI[playerid][p_Admin] >= CI[cmd_Freeze])
  1241.     {
  1242.         new targetid, string[128];
  1243.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /freeze [playerid]");
  1244.        
  1245.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1246.         if(pFrozen[targetid] == true) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player is already frozen ::.");
  1247.        
  1248.         format(string, sizeof(string), ".:: %s %s has frozen %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid));
  1249.         SendClientMessageToAll(COLOR_REALRED, string);
  1250.         TogglePlayerControllable(targetid, 0);
  1251.         pFrozen[targetid] = true;
  1252.     }
  1253.     else
  1254.     {
  1255.         SendPermissionError(playerid);
  1256.     }
  1257.     return 1;
  1258. }
  1259. CMD:unfreeze(playerid, params[])
  1260. {
  1261.     if(PI[playerid][p_Admin] >= CI[cmd_Unfreeze])
  1262.     {
  1263.         new targetid, string[128];
  1264.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unfreeze [playerid]");
  1265.        
  1266.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1267.         if(pFrozen[targetid] == false) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player is not frozen ::.");
  1268.        
  1269.         format(string, sizeof(string), ".:: %s %s has unfrozen %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid));
  1270.         SendClientMessageToAll(COLOR_REALRED, string);
  1271.         TogglePlayerControllable(targetid, 1);
  1272.         pFrozen[targetid] = false;
  1273.     }
  1274.     else
  1275.     {
  1276.         SendPermissionError(playerid);
  1277.     }
  1278.     return 1;
  1279. }
  1280. CMD:slap(playerid, params[])
  1281. {
  1282.     if(PI[playerid][p_Admin] >= CI[cmd_Slap])
  1283.     {
  1284.         new targetid, height, string[128];
  1285.         if(sscanf(params, "ud", targetid, height)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /slap [playerid] [height]");
  1286.  
  1287.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1288.        
  1289.         new Float: x, Float: y, Float: z;
  1290.         GetPlayerPos(targetid, x, y, z);
  1291.         format(string, sizeof(string), ".:: %s %s has slapped %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid));
  1292.         SendClientMessageToAll(COLOR_REALRED, string);
  1293.         SetPlayerPos(targetid, x, y, z+height);
  1294.         GameTextForPlayer(targetid, "~r~SLAPPED!", 3000, 5);
  1295.     }
  1296.     else
  1297.     {
  1298.         SendPermissionError(playerid);
  1299.     }
  1300.     return 1;
  1301. }
  1302. CMD:isolate(playerid, params[])
  1303. {
  1304.     if(PI[playerid][p_Admin] >= CI[cmd_Isolate])
  1305.     {
  1306.         new targetid, time, reason[64], string[128];
  1307.         if(sscanf(params, "uds[64]", targetid, time, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /isolate [playerid] [time(minutes)] [reason]");
  1308.        
  1309.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1310.         if(strlen(reason) <= 0) reason = "Not specified.";
  1311.         if(time < 1 || time > 30) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: Time must be between 1 and 30 ::.");
  1312.         if(PI[targetid][p_Isolated] == 1) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player is already isolated ::.");
  1313.  
  1314.         new Float: x, Float: y, Float: z;
  1315.         GetPlayerPos(targetid, x, y, z);
  1316.         format(string, sizeof(string), ".:: %s %s has isolated %s for %d minute(s), reason: %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid), time, reason);
  1317.         SendClientMessageToAll(COLOR_REALRED, string);
  1318.         PI[targetid][p_IsolationTime] = time;
  1319.         PI[targetid][p_Isolated] = 1;
  1320.         SetPlayerPos(targetid, x, y, z+2000);
  1321.         TogglePlayerControllable(targetid, 0);
  1322.     }
  1323.     else
  1324.     {
  1325.         SendPermissionError(playerid);
  1326.     }
  1327.     return 1;
  1328. }
  1329. CMD:unisolate(playerid, params[])
  1330. {
  1331.     if(PI[playerid][p_Admin] >= CI[cmd_Unisolate])
  1332.     {
  1333.         new targetid, string[128];
  1334.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unisolate [playerid]");
  1335.        
  1336.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1337.         if(PI[targetid][p_Isolated] == 0) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player is not isolated ::.");
  1338.        
  1339.         new Float: x, Float: y, Float: z;
  1340.         GetPlayerPos(targetid, x, y, z);
  1341.         format(string, sizeof(string), ".:: %s %s has un-isolated %s ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid));
  1342.         SendClientMessageToAll(COLOR_REALRED, string);
  1343.         SetPlayerPos(targetid, x, y, z-2000);
  1344.         TogglePlayerControllable(targetid, 1);
  1345.         PI[targetid][p_Isolated] = 0;
  1346.         PI[targetid][p_IsolationTime] = 0;
  1347.     }
  1348.     else
  1349.     {
  1350.         SendPermissionError(playerid);
  1351.     }
  1352.     return 1;
  1353. }
  1354. CMD:sethealth(playerid, params[])
  1355. {
  1356.     if(PI[playerid][p_Admin] >= CI[cmd_SetHealth])
  1357.     {
  1358.         new targetid, Float: health, string[128];
  1359.         if(sscanf(params, "uf", targetid, health)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /sethealth [playerid] [health]");
  1360.        
  1361.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1362.        
  1363.         format(string, sizeof(string), ".:: You have set %s's health to %.01f ::.", GetName(targetid), health);
  1364.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1365.         format(string, sizeof(string), ".:: %s %s has set your health to %.01f ::.", GetAdminName(playerid), GetName(playerid), health);
  1366.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1367.         SetPlayerHealth(targetid, health);
  1368.     }
  1369.     else
  1370.     {
  1371.         SendPermissionError(playerid);
  1372.     }
  1373.     return 1;
  1374. }
  1375. CMD:setarmour(playerid, params[])
  1376. {
  1377.     if(PI[playerid][p_Admin] >= CI[cmd_SetArmour])
  1378.     {
  1379.         new targetid, Float: armour, string[128];
  1380.         if(sscanf(params, "uf", targetid, armour)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /sethealth [playerid] [armour]");
  1381.  
  1382.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1383.  
  1384.         format(string, sizeof(string), ".:: You have set %s's armour to %.01f ::.", GetName(targetid), armour);
  1385.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1386.         format(string, sizeof(string), ".:: %s %s has set your armour to %.01f ::.", GetAdminName(playerid), GetName(playerid), armour);
  1387.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1388.         SetPlayerArmour(targetid, armour);
  1389.     }
  1390.     else
  1391.     {
  1392.         SendPermissionError(playerid);
  1393.     }
  1394.     return 1;
  1395. }
  1396. CMD:givegun(playerid, params[])
  1397. {
  1398.     if(PI[playerid][p_Admin] >= CI[cmd_GiveGun])
  1399.     {
  1400.         new targetid, weapon, string[128];
  1401.         if(sscanf(params, "ud", targetid, weapon)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givegun [playerid] [weapon]");
  1402.        
  1403.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1404.        
  1405.         format(string, sizeof(string), ".:: You have given %s weapon ID %d ::.", GetName(targetid), weapon);
  1406.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1407.         format(string, sizeof(string), ".:: %s %s has given you weapon ID %d ::.", GetAdminName(playerid), GetName(playerid), weapon);
  1408.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1409.         GivePlayerWeapon(targetid, weapon, 999999);
  1410.     }
  1411.     else
  1412.     {
  1413.         SendPermissionError(playerid);
  1414.     }
  1415.     return 1;
  1416. }
  1417. CMD:givecar(playerid, params[])
  1418. {
  1419.     if(PI[playerid][p_Admin] >= CI[cmd_GiveCar])
  1420.     {
  1421.         new targetid, car, string[128];
  1422.         if(sscanf(params, "ud", targetid, car)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givecar [playerid] [vehicleid]");
  1423.        
  1424.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1425.        
  1426.         new Float: x, Float: y, Float: z, Float: a;
  1427.         GetPlayerPos(targetid, x, y, z);
  1428.         GetPlayerFacingAngle(targetid, a);
  1429.         new rd1 = random(20);
  1430.         new rd2 = random(20);
  1431.         format(string, sizeof(string), ".:: You have given %s vehicle ID %d ::.", GetName(targetid), car);
  1432.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1433.         format(string, sizeof(string), ".:: %s %s has given you vehicle ID %d ::.", GetAdminName(playerid), GetName(playerid), car);
  1434.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1435.         new veh = CreateVehicle(car, x, y, z, a, rd1, rd2, -1);
  1436.         PutPlayerInVehicle(targetid, veh, 0);
  1437.     }
  1438.     else
  1439.     {
  1440.         SendPermissionError(playerid);
  1441.     }
  1442.     return 1;
  1443. }
  1444. CMD:takeguns(playerid, params[])
  1445. {
  1446.     if(PI[playerid][p_Admin] >= CI[cmd_TakeGuns])
  1447.     {
  1448.         new targetid, string[128];
  1449.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /takeguns [playerid]");
  1450.        
  1451.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1452.        
  1453.         format(string, sizeof(string), ".:: %s %s has stripped %s of all his weapons ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid));
  1454.         SendClientMessageToAll(COLOR_REALRED, string);
  1455.         ResetPlayerWeapons(targetid);
  1456.     }
  1457.     else
  1458.     {
  1459.         SendPermissionError(playerid);
  1460.     }
  1461.     return 1;
  1462. }
  1463. CMD:goto(playerid, params[])
  1464. {
  1465.     if(PI[playerid][p_Admin] >= CI[cmd_Goto])
  1466.     {
  1467.         new targetid;
  1468.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /goto [playerid]");
  1469.  
  1470.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1471.        
  1472.         new Float: x, Float: y, Float: z;
  1473.         GetPlayerPos(targetid, x, y, z);
  1474.         SetPlayerPos(playerid, x, y, z+0.2);
  1475.     }
  1476.     else
  1477.     {
  1478.         SendPermissionError(playerid);
  1479.     }
  1480.     return 1;
  1481. }
  1482. CMD:gethere(playerid, params[])
  1483. {
  1484.     if(PI[playerid][p_Admin] >= CI[cmd_GetHere])
  1485.     {
  1486.         new targetid, string[128];
  1487.         if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /gethere [playerid]");
  1488.  
  1489.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1490.  
  1491.         new Float: x, Float: y, Float: z;
  1492.         GetPlayerPos(playerid, x, y, z);
  1493.         format(string, sizeof(string), ".:: %s %s has teleported you to them ::.", GetAdminName(playerid), GetName(playerid));
  1494.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1495.         SetPlayerPos(targetid, x, y, z+0.2);
  1496.     }
  1497.     else
  1498.     {
  1499.         SendPermissionError(playerid);
  1500.     }
  1501.     return 1;
  1502. }
  1503. CMD:explode(playerid, params[])
  1504. {
  1505.     if(PI[playerid][p_Admin] >= CI[cmd_Explode])
  1506.     {
  1507.         new targetid, type, Float: radius, string[128];
  1508.         if(sscanf(params, "udf", targetid, type, radius)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /explode [playerid] [type(0-13)] [radius]");
  1509.        
  1510.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1511.         if(type < 0 || type > 13) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: Explosion type must must be between 0 and 13 ::.");
  1512.        
  1513.         new Float: x, Float: y, Float: z;
  1514.         GetPlayerPos(targetid, x, y, z);
  1515.         format(string, sizeof(string), ".:: %s %s has exploded %s [Type: %d | Radius: %.01f] ::.", GetAdminName(playerid), GetName(playerid), GetName(targetid), type, radius);
  1516.         SendClientMessageToAll(COLOR_REALRED, string);
  1517.         CreateExplosion(x, y, z, type, radius);
  1518.     }
  1519.     else
  1520.     {
  1521.         SendPermissionError(playerid);
  1522.     }
  1523.     return 1;
  1524. }
  1525. CMD:setskin(playerid, params[])
  1526. {
  1527.     if(PI[playerid][p_Admin] >= CI[cmd_SetSkin])
  1528.     {
  1529.         new targetid, skin, string[128];
  1530.         if(sscanf(params, "ui", targetid, skin)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /setskin [playerid] [skinid]");
  1531.        
  1532.         if(!IsPlayerConnected(targetid)) return SendConnectionError(playerid);
  1533.         if(GetPlayerSkin(targetid) == skin) return SendClientMessage(playerid, COLOR_REALRED, ".:: ERROR: That player already has that skin ::.");
  1534.        
  1535.         format(string, sizeof(string), ".:: You have set %s's skin to %i ::.", GetName(targetid), skin);
  1536.         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1537.         format(string, sizeof(string), ".:: %s %s has set your skin to %i ::.", GetAdminName(playerid), GetName(playerid), skin);
  1538.         SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
  1539.         SetPlayerSkin(targetid, skin);
  1540.         PI[targetid][p_Skin] = skin;
  1541.         SaveAccount(targetid);
  1542.     }
  1543.     else
  1544.     {
  1545.         SendPermissionError(playerid);
  1546.     }
  1547.     return 1;
  1548. }
Advertisement
Add Comment
Please, Sign In to add comment