Advertisement
Guest User

Admin Filterscript By Hipflop

a guest
May 6th, 2011
1,410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.77 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <dutils>
  4. #pragma unused ret_memcpy
  5.  
  6. #define FILTERSCRIPT
  7. #if defined FILTERSCRIPT
  8. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  9. #define COLOR_GREY 0xAFAFAFAA
  10. #define COLOR_ACTIVEBORDER 0xB4B4B4FF
  11. #define COLOR_ACTIVECAPTION 0x99B4D1FF
  12. #define COLOR_ACTIVECAPTIONTEXT 0x000000FF
  13. #define COLOR_ALICEBLUE 0xF0F8FFFF
  14. #define COLOR_ANTIQUEWHITE 0xFAEBD7FF
  15. #define COLOR_APPWORKSPACE 0xABABABFF
  16. #define COLOR_AQUA 0x00FFFFFF
  17. #define COLOR_AQUAMARINE 0x7FFFD4FF
  18. #define COLOR_AZURE 0xF0FFFFFF
  19. #define COLOR_BEIGE 0xF5F5DCFF
  20. #define COLOR_BISQUE 0xFFE4C4FF
  21. #define COLOR_BLACK 0x000000FF
  22. #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
  23. #define COLOR_BLUE 0x0000FFFF
  24. #define COLOR_BLUEVIOLET 0x8A2BE2FF
  25. #define COLOR_BROWN 0xA52A2AFF
  26. #define COLOR_BURLYWOOD 0xDEB887FF
  27. #define COLOR_BUTTONFACE 0xF0F0F0FF
  28. #define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
  29. #define COLOR_BUTTONSHADOW 0xA0A0A0FF
  30. #define COLOR_CADETBLUE 0x5F9EA0FF
  31. #define COLOR_CHARTREUSE 0x7FFF00FF
  32. #define COLOR_CHOCOLATE 0xD2691EFF
  33. #define COLOR_CONTROL 0xF0F0F0FF
  34. #define COLOR_CONTROLDARK 0xA0A0A0FF
  35. #define COLOR_CONTROLDARKDARK 0x696969FF
  36. #define COLOR_CONTROLLIGHT 0xE3E3E3FF
  37. #define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
  38. #define COLOR_CONTROLTEXT 0x000000FF
  39. #define COLOR_CORAL 0xFF7F50FF
  40. #define COLOR_CORNFLOWERBLUE 0x6495EDFF
  41. #define COLOR_CORNSILK 0xFFF8DCFF
  42. #define COLOR_CRIMSON 0xDC143CFF
  43. #define COLOR_CYAN 0x00FFFFFF
  44. #define COLOR_DARKBLUE 0x00008BFF
  45. #define COLOR_DARKCYAN 0x008B8BFF
  46. #define COLOR_DARKGOLDENROD 0xB8860BFF
  47. #define COLOR_DARKGRAY 0xA9A9A9FF
  48. #define COLOR_DARKGREEN 0x006400FF
  49. #define COLOR_DARKKHAKI 0xBDB76BFF
  50. #define COLOR_DARKMAGENTA 0x8B008BFF
  51. #define COLOR_DARKOLIVEGREEN 0x556B2FFF
  52. #define COLOR_DARKORANGE 0xFF8C00FF
  53. #define COLOR_DARKORCHID 0x9932CCFF
  54. #define COLOR_DARKRED 0x8B0000FF
  55. #define COLOR_DARKSALMON 0xE9967AFF
  56. #define COLOR_DARKSEAGREEN 0x8FBC8BFF
  57. #define COLOR_DARKSLATEBLUE 0x483D8BFF
  58. #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
  59. #define COLOR_DARKTURQUOISE 0x00CED1FF
  60. #define COLOR_DARKVIOLET 0x9400D3FF
  61. #define COLOR_DEEPPINK 0xFF1493FF
  62. #define COLOR_DEEPSKYBLUE 0x00BFFFFF
  63. #define COLOR_DESKTOP 0x000000FF
  64. #define COLOR_DIMGRAY 0x696969FF
  65. #define COLOR_DODGERBLUE 0x1E90FFFF
  66. #define COLOR_FIREBRICK 0xB22222FF
  67. #define COLOR_FLORALWHITE 0xFFFAF0FF
  68. #define COLOR_FORESTGREEN 0x228B22FF
  69. #define COLOR_FUCHSIA 0xFF00FFFF
  70. #define COLOR_GAINSBORO 0xDCDCDCFF
  71. #define COLOR_GHOSTWHITE 0xF8F8FFFF
  72. #define COLOR_GOLD 0xFFD700FF
  73. #define COLOR_GOLDENROD 0xDAA520FF
  74. #define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
  75. #define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
  76. #define COLOR_GRAY 0x808080FF
  77. #define COLOR_GRAYTEXT 0x808080FF
  78. #define COLOR_GREEN 0x008000FF
  79. #define COLOR_GREENYELLOW 0xADFF2FFF
  80. #define COLOR_HIGHLIGHT 0x3399FFFF
  81. #define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
  82. #define COLOR_HONEYDEW 0xF0FFF0FF
  83. #define COLOR_HOTPINK 0xFF69B4FF
  84. #define COLOR_HOTTRACK 0x0066CCFF
  85. #define COLOR_INACTIVEBORDER 0xF4F7FCFF
  86. #define COLOR_INACTIVECAPTION 0xBFCDDBFF
  87. #define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
  88. #define COLOR_INDIANRED 0xCD5C5CFF
  89. #define COLOR_INDIGO 0x4B0082FF
  90. #define COLOR_INFO 0xFFFFE1FF
  91. #define COLOR_INFOTEXT 0x000000FF
  92. #define COLOR_IVORY 0xFFFFF0FF
  93. #define COLOR_KHAKI 0xF0E68CFF
  94. #define COLOR_LAVENDER 0xE6E6FAFF
  95. #define COLOR_LAVENDERBLUSH 0xFFF0F5FF
  96. #define COLOR_LAWNGREEN 0x7CFC00FF
  97. #define COLOR_LEMONCHIFFON 0xFFFACDFF
  98. #define COLOR_LIGHTBLUE 0xADD8E6FF
  99. #define COLOR_LIGHTCORAL 0xF08080FF
  100. #define COLOR_LIGHTCYAN 0xE0FFFFFF
  101. #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
  102. #define COLOR_LIGHTGRAY 0xD3D3D3FF
  103. #define COLOR_LIGHTGREEN 0x90EE90FF
  104. #define COLOR_LIGHTPINK 0xFFB6C1FF
  105. #define COLOR_LIGHTSALMON 0xFFA07AFF
  106. #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
  107. #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
  108. #define COLOR_LIGHTSLATEGRAY 0x778899FF
  109. #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
  110. #define COLOR_LIGHTYELLOW 0xFFFFE0FF
  111. #define COLOR_LIME 0x00FF00FF
  112. #define COLOR_LIMEGREEN 0x32CD32FF
  113. #define COLOR_LINEN 0xFAF0E6FF
  114. #define COLOR_MAGENTA 0xFF00FFFF
  115. #define COLOR_MAROON 0x800000FF
  116. #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
  117. #define COLOR_MEDIUMBLUE 0x0000CDFF
  118. #define COLOR_MEDIUMORCHID 0xBA55D3FF
  119. #define COLOR_MEDIUMPURPLE 0x9370DBFF
  120. #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
  121. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  122. #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
  123. #define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
  124. #define COLOR_MEDIUMVIOLETRED 0xC71585FF
  125. #define COLOR_MENU 0xF0F0F0FF
  126. #define COLOR_MENUBAR 0xF0F0F0FF
  127. #define COLOR_MENUHIGHLIGHT 0x3399FFFF
  128. #define COLOR_MENUTEXT 0x000000FF
  129. #define COLOR_MIDNIGHTBLUE 0x191970FF
  130. #define COLOR_MINTCREAM 0xF5FFFAFF
  131. #define COLOR_MISTYROSE 0xFFE4E1FF
  132. #define COLOR_MOCCASIN 0xFFE4B5FF
  133. #define COLOR_NAVAJOWHITE 0xFFDEADFF
  134. #define COLOR_NAVY 0x000080FF
  135. #define COLOR_OLDLACE 0xFDF5E6FF
  136. #define COLOR_OLIVE 0x808000FF
  137. #define COLOR_OLIVEDRAB 0x6B8E23FF
  138. #define COLOR_ORANGE 0xFFA500FF
  139. #define COLOR_ORANGERED 0xFF4500FF
  140. #define COLOR_ORCHID 0xDA70D6FF
  141. #define COLOR_PALEGOLDENROD 0xEEE8AAFF
  142. #define COLOR_PALEGREEN 0x98FB98FF
  143. #define COLOR_PALETURQUOISE 0xAFEEEEFF
  144. #define COLOR_PALEVIOLETRED 0xDB7093FF
  145. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  146. #define COLOR_PEACHPUFF 0xFFDAB9FF
  147. #define COLOR_PERU 0xCD853FFF
  148. #define COLOR_PINK 0xFFC0CBFF
  149. #define COLOR_PLUM 0xDDA0DDFF
  150. #define COLOR_POWDERBLUE 0xB0E0E6FF
  151. #define COLOR_PURPLE 0x800080FF
  152. #define COLOR_RED 0xFF0000FF
  153. #define COLOR_ROSYBROWN 0xBC8F8FFF
  154. #define COLOR_ROYALBLUE 0x4169E1FF
  155. #define COLOR_SADDLEBROWN 0x8B4513FF
  156. #define COLOR_SALMON 0xFA8072FF
  157. #define COLOR_SANDYBROWN 0xF4A460FF
  158. #define COLOR_SCROLLBAR 0xC8C8C8FF
  159. #define COLOR_SEAGREEN 0x2E8B57FF
  160. #define COLOR_SEASHELL 0xFFF5EEFF
  161. #define COLOR_SIENNA 0xA0522DFF
  162. #define COLOR_SILVER 0xC0C0C0FF
  163. #define COLOR_SKYBLUE 0x87CEEBFF
  164. #define COLOR_SLATEBLUE 0x6A5ACDFF
  165. #define COLOR_SLATEGRAY 0x708090FF
  166. #define COLOR_SNOW 0xFFFAFAFF
  167. #define COLOR_SPRINGGREEN 0x00FF7FFF
  168. #define COLOR_STEELBLUE 0x4682B4FF
  169. #define COLOR_TAN 0xD2B48CFF
  170. #define COLOR_TEAL 0x008080FF
  171. #define COLOR_THISTLE 0xD8BFD8FF
  172. #define COLOR_TOMATO 0xFF6347FF
  173. #define COLOR_TRANSPARENT 0xFFFFFF00
  174. #define COLOR_TURQUOISE 0x40E0D0FF
  175. #define COLOR_VIOLET 0xEE82EEFF
  176. #define COLOR_WHEAT 0xF5DEB3FF
  177. #define COLOR_WHITE 0xFFFFFFFF
  178. #define COLOR_WHITESMOKE 0xF5F5F5FF
  179. #define COLOR_WINDOW 0xFFFFFFFF
  180. #define COLOR_WINDOWFRAME 0x646464FF
  181. #define COLOR_WINDOWTEXT 0x000000FF
  182. #define COLOR_YELLOW 0xFFFF00FF
  183. #define COLOR_YELLOWGREEN 0x9ACD32FF
  184. #define STEALTH_ORANGE 0xFF880000
  185. #define STEALTH_OLIVE 0x66660000
  186. #define STEALTH_GREEN 0x33DD1100
  187. #define STEALTH_PINK 0xFF22EE00
  188. #define STEALTH_BLUE 0x0077BB00
  189.  
  190. #define PlayerFile "Admin/Users/%s.ini"
  191. #define CommandFile "Admin/Settings/Commands.ini"
  192.  
  193. #endif
  194.  
  195. enum PLAYER_MAIN {
  196.     PLAYER_NAME[MAX_PLAYER_NAME],
  197.     PLAYER_IP[16],
  198.     PLAYER_REGGED,
  199.     PLAYER_PASS,
  200.     PLAYER_LEVEL,
  201.     PLAYER_MONEY,
  202. }
  203. new gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
  204. new gPlayerLogged[MAX_PLAYERS];
  205.  
  206. enum COMMANDS_MAIN {
  207.     KICK,
  208.     BAN
  209. }
  210. new gCommands[COMMANDS_MAIN];
  211.  
  212. public OnFilterScriptInit()
  213. {
  214.     print("\n************************************");
  215.     print("*                                  *");
  216.     print("* Admin Filterscript by Hipflop    *");
  217.     print("*                                  *");
  218.     print("************************************\n");
  219.  
  220.     // Level 0 = Noob
  221.     // Level 1 = Trusted Player
  222.     // Level 2 = Member
  223.     // Level 3 = Moderator
  224.     // Level 4 = Administrator
  225.     // Level 5 = Server owner
  226.  
  227.     if(!fexist(CommandFile))
  228.     {
  229.         dini_Create(CommandFile);
  230.         dini_IntSet(CommandFile, "Kick", 2);
  231.         dini_IntSet(CommandFile, "Ban", 3);
  232.     }
  233.    
  234.     gCommands[KICK] = dini_Int(CommandFile, "Kick");
  235.     gCommands[BAN] = dini_Int(CommandFile, "Ban");
  236.     return 1;
  237. }
  238.  
  239. public OnPlayerConnect(playerid)
  240. {
  241.     new file[100], name[MAX_PLAYER_NAME];
  242.     GetPlayerName(playerid, name, sizeof(name));
  243.     format(file, sizeof(file), PlayerFile, name);
  244.     if(!fexist(file))
  245.     {
  246.         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Please fill in your username as a password.", "Register", "Exit");
  247.     }
  248.     else if(fexist(file))
  249.     {
  250.         ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Logon", "Please fill in your password.", "Logon", "Exit");
  251.     }
  252.     return 1;
  253. }
  254.  
  255. public OnPlayerDisconnect(playerid, reason)
  256. {
  257.     new file[100];
  258.     format(file, sizeof(file), PlayerFile, gPlayerInfo[playerid][PLAYER_NAME]);
  259.     dini_Set(file, "Name", gPlayerInfo[playerid][PLAYER_NAME]);
  260.     dini_Set(file, "Ip", gPlayerInfo[playerid][PLAYER_IP]);
  261.     dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
  262.     dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
  263.     dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
  264.     dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  265.     gPlayerLogged[playerid] = 0;
  266.     return 1;
  267. }
  268.  
  269. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  270. {
  271.     if(dialogid == 1)
  272.     {
  273.         if(response)
  274.         {
  275.             if(strlen(inputtext))
  276.             {
  277.                 new file[100], name[MAX_PLAYER_NAME], ip[16], string[128];
  278.                 GetPlayerName(playerid, name, sizeof(name));
  279.                 GetPlayerIp(playerid, ip, sizeof(ip));
  280.                 format(file, sizeof(file), PlayerFile, name);
  281.                 dini_Create(file);
  282.                 dini_Set(file, "Name", name);
  283.                 dini_Set(file, "Ip", ip);
  284.                 dini_IntSet(file, "Registered", 1);
  285.                 dini_IntSet(file, "Password", num_hash(inputtext));
  286.                 dini_IntSet(file, "Level", 0);
  287.                 dini_IntSet(file, "Money", 50);
  288.                 format(string, sizeof(string), "[SYSTEM] You succesfully registered the player %s.", name);
  289.                 SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
  290.                 strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  291.                 strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  292.                 gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  293.                 gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  294.                 GivePlayerMoney(playerid, dini_Int(file, "Money"));
  295.                 gPlayerLogged[playerid] = 1;
  296.             }
  297.             else if(!strlen(inputtext))
  298.             {
  299.                 SendClientMessage(playerid, COLOR_RED, "[SYSTEM] You must fill in a password!");
  300.                 ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Please fill in your username as a password.", "Register", "Exit");
  301.             }
  302.         }
  303.         else if(!response)
  304.         {
  305.             SendClientMessage(playerid, COLOR_RED, "[SYSTEM] You need to register in order to play!");
  306.             Kick(playerid);
  307.         }
  308.     }
  309.    
  310.     if(dialogid == 2)
  311.     {
  312.         if(response)
  313.         {
  314.             if(strlen(inputtext))
  315.             {
  316.                 new file[100], name[MAX_PLAYER_NAME], string[128];
  317.                 GetPlayerName(playerid, name, sizeof(name));
  318.                 format(file, sizeof(file), PlayerFile, name);
  319.                 if(num_hash(inputtext) == dini_Int(file, "Password"))
  320.                 {
  321.                     strcat(gPlayerInfo[playerid][PLAYER_NAME], dini_Get(file, "Name"));
  322.                     strcat(gPlayerInfo[playerid][PLAYER_IP], dini_Get(file, "Ip"));
  323.                     gPlayerInfo[playerid][PLAYER_PASS] = dini_Int(file, "Password");
  324.                     gPlayerInfo[playerid][PLAYER_LEVEL] = dini_Int(file, "Level");
  325.                     GivePlayerMoney(playerid, dini_Int(file, "Money"));
  326.                     gPlayerLogged[playerid] = 1;
  327.                     format(string, sizeof(string), "[SYSTEM] Welcome back, %s", name);
  328.                     SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
  329.                 }
  330.                 else if(num_hash(inputtext) != dini_Int(file, "Password"))
  331.                 {
  332.                     SendClientMessage(playerid, COLOR_RED, "[SYSTEM] Wrong password!");
  333.                     ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Logon", "Please fill in your password.", "Logon", "Exit");
  334.                 }
  335.             }
  336.             else if(!strlen(inputtext))
  337.             {
  338.                 SendClientMessage(playerid, COLOR_RED, "[SYSTEM] You must fill in your password!");
  339.                 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Logon", "Please fill in your password.", "Logon", "Exit");
  340.             }
  341.         }
  342.         else if(!response)
  343.         {
  344.             SendClientMessage(playerid, COLOR_RED, "[SYSTEM] You need to logon in order to play!");
  345.             Kick(playerid);
  346.         }
  347.     }
  348.     return 1;
  349. }
  350.  
  351. public OnPlayerCommandText(playerid, cmdtext[])
  352. {
  353.     dcmd(kick, 4, cmdtext);
  354.     dcmd(ban, 3, cmdtext);
  355.     return 0;
  356. }
  357.  
  358. dcmd_kick(playerid, params[])
  359. {
  360.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[KICK])
  361.     {
  362.         new string[128];
  363.         format(string, sizeof(string), "You must be a level %d administrator to use that command!", gCommands[KICK]);
  364.         SendClientMessage(playerid, COLOR_ORANGE, string);
  365.     }
  366.     else
  367.     {
  368.         new tmp[256], tmp2[256], index, id;
  369.         tmp = strtok(params, index);
  370.         tmp2 = strtok(params, index);
  371.        
  372.         if(!strlen(tmp))
  373.         {
  374.             SendClientMessage(playerid, COLOR_ORANGE, "[KICK] Usage: /kick [ID] [REASON]");
  375.         }
  376.         else if(!strlen(tmp2))
  377.         {
  378.             SendClientMessage(playerid, COLOR_ORANGE, "[KICK] Usage: /kick [ID] [REASON]");
  379.         }
  380.         else
  381.         {
  382.             id = strval(tmp);
  383.             if(!IsPlayerConnected(id))
  384.             {
  385.                 SendClientMessage(playerid, COLOR_ORANGE, "[KICK] That player is not connected.");
  386.             }
  387.             else if(id == playerid)
  388.             {
  389.                 SendClientMessage(playerid, COLOR_ORANGE, "[KICK] You can't kick yourself.");
  390.             }
  391.             else if(gPlayerInfo[id][PLAYER_LEVEL] > gPlayerInfo[playerid][PLAYER_LEVEL])
  392.             {
  393.                 SendClientMessage(playerid, COLOR_ORANGE, "[KICK] That player has a higher level than you.");
  394.             }
  395.             else
  396.             {
  397.                 new string[256], name[MAX_PLAYER_NAME];
  398.                 GetPlayerName(id, name, sizeof(name));
  399.                 if(id >= 0 && id <= 9)
  400.                 {
  401.                     format(string, sizeof(string), "[KICK] You have been kicked. Reason: %s.", params[2]);
  402.                     SendClientMessage(id, COLOR_ORANGE, string);
  403.                     Kick(id);
  404.                     format(string, sizeof(string), "[KICK] Player %s has been kicked. Reason: %s.", name, params[2]);
  405.                     SendClientMessageToAll(COLOR_ORANGE, string);
  406.                 }
  407.                 else if(id >= 10 && id <= 99)
  408.                 {
  409.                     format(string, sizeof(string), "[KICK] You have been kicked. Reason: %s.", params[3]);
  410.                     SendClientMessage(id, COLOR_ORANGE, string);
  411.                     Kick(id);
  412.                     format(string, sizeof(string), "[KICK] Player %s has been kicked. Reason: %s.", name, params[3]);
  413.                     SendClientMessageToAll(COLOR_ORANGE, string);
  414.                 }
  415.             }
  416.         }
  417.     }
  418.     return 1;
  419. }
  420.  
  421. dcmd_ban(playerid, params[])
  422. {
  423.     if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[BAN])
  424.     {
  425.         new string[128];
  426.         format(string, sizeof(string), "You must be a level %d administrator to use that command!", gCommands[BAN]);
  427.         SendClientMessage(playerid, COLOR_ORANGE, string);
  428.     }
  429.     else
  430.     {
  431.         new tmp[256], tmp2[256], index, id;
  432.         tmp = strtok(params, index);
  433.         tmp2 = strtok(params, index);
  434.        
  435.         if(!strlen(tmp))
  436.         {
  437.             SendClientMessage(playerid, COLOR_ORANGE, "[BAN] Usage: /ban [ID] [REASON]");
  438.         }
  439.         else if(!strlen(tmp2))
  440.         {
  441.             SendClientMessage(playerid, COLOR_ORANGE, "[BAN] Usage: /ban [ID] [REASON]");
  442.         }
  443.         else
  444.         {
  445.             id = strval(tmp);
  446.             if(!IsPlayerConnected(id))
  447.             {
  448.                 SendClientMessage(playerid, COLOR_ORANGE, "[BAN] That player is not connected.");
  449.             }
  450.             else if(id == playerid)
  451.             {
  452.                 SendClientMessage(playerid, COLOR_ORANGE, "[BAN] You can't ban yourself.");
  453.             }
  454.             else if(gPlayerInfo[id][PLAYER_LEVEL] > gPlayerInfo[playerid][PLAYER_LEVEL])
  455.             {
  456.                 SendClientMessage(playerid, COLOR_ORANGE, "[BAN] That player has a higher level than you.");
  457.             }
  458.             else
  459.             {
  460.                 new string[256], name[MAX_PLAYER_NAME];
  461.                 GetPlayerName(id, name, sizeof(name));
  462.                 if(id >= 0 && id <= 9)
  463.                 {
  464.                     format(string, sizeof(string), "[BAN] You have been banned. Reason: %s.", params[2]);
  465.                     SendClientMessage(id, COLOR_ORANGE, string);
  466.                     BanEx(id, params[2]);
  467.                     format(string, sizeof(string), "[BAN] Player %s has been kicked. Reason: %s.", name, params[2]);
  468.                     SendClientMessageToAll(COLOR_ORANGE, string);
  469.                 }
  470.                 else if(id >= 10 && id <= 99)
  471.                 {
  472.                     format(string, sizeof(string), "[BAN] You have been banned. Reason: %s.", params[3]);
  473.                     SendClientMessage(id, COLOR_ORANGE, string);
  474.                     BanEx(id, params[3]);
  475.                     format(string, sizeof(string), "[BAN] Player %s has been kicked. Reason: %s.", name, params[3]);
  476.                     SendClientMessageToAll(COLOR_ORANGE, string);
  477.                 }
  478.             }
  479.         }
  480.     }
  481.     return 1;
  482. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement