Advertisement
Guest User

Untitled

a guest
Feb 26th, 2016
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 251.16 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3. #include <sscanf2>
  4. #include <YSI\y_ini>
  5. #include <ZCMD>
  6. #include <foreach>
  7. #include <streamer>
  8. native WP_Hash(buffer[], len, const str[]);
  9.  
  10. // Features
  11. //==============================================================================
  12. // - Dialog based registration and login system.
  13. // - Whirlpool hashed passwords.
  14. // - Efficent script! Uses YCMD, sscanf 2.0, y_ini and foreach, efficent PVar usage - deletes the PVar instead of setting it to 0 to free memory :).
  15. // - Advanced IRC system - easy to setup and use!
  16. // - User friendly.
  17. // - Anti RCON login.
  18. // - Anti command spam.
  19. // - Anti text spam.
  20. // - Anti text repeat.
  21. // - Auto-ip login.
  22. // - Easy to translate the script into your language.
  23. // - Efficent connect time updating - no timers involved!
  24. // - Various ban methods: temporaly bans, range bans. You also have the ability to unban players ingame using /unban !
  25. // - Nice use of colour embedding to allow for a more structured filterscript.
  26. // - Ability to send messages to IRC from in-game and also PM users on IRC from in-game. Works for all players not only administrators.
  27. // - Ability to disable commands in-game for a certain player using /toggle(all)cmd.
  28. //==============================================================================
  29. // Commands
  30. //==============================================================================
  31. //##############################################################################
  32. // Player Commands
  33. //##############################################################################
  34. // - /stats /irc /ircpm /report
  35. //##############################################################################
  36. // Admin Commands
  37. //##############################################################################
  38. // - /setlevel /register /login /toggleengine /heal /kick /ban /setname /setgravity
  39. // - /setvhealth /setarmour /sethealth /setscore /setmoney /setweather /setskin
  40. // - /setworld /setinterior /slap /akill /jetpack /crash /disarm /dedisarm
  41. // - /mute /unmute /freeze /unfreeze /cage /uncage /amsg /asay /listweapons
  42. // - /clearchat /spectate /setvip /changepass /getinfo /warn /clearwarnings
  43. // - /giveweapon /giveallweapon /crashall /slapall /akillall /freezeall /unfreezeall
  44. // - /warnall /clearallwarnings /muteall /unmuteall /disarmall /dedisarmall
  45. // - /uncageall /cageall /kickall /banall /healall /toggleallengines /setallvhealth
  46. // - /setallarmour /setallhealth /setallmoney /setallscore /setallskin /setallworld
  47. // - /setallinterior /rangeban /tempban /up /down /north /south /east /west /vehicle
  48. // - /destroyvehicle /removecar /givemoney /givescore /giveallmoney /giveallscore
  49. // - /goto /gotop /gotopos /send /sendp /get /getp /acmds /reconnect /reconnectall
  50. // - /togglecmd /toggleallcmd /godmode
  51. //##############################################################################
  52. // IRC Commands
  53. //##############################################################################
  54. // - !say !asay !ssay !irccmds !getid !getname !pm !amsg !admins !vip !getinfo
  55. // - !iban !tempban !rangeban !banall !ikick !kickall !cage !cageall !uncage
  56. // - !freeze !freezeall !unfreeze !unfreezeall !warn !warnall !clearwarnings
  57. // - !mute !unmute !muteall !unmuteall !disarm !dedisarm !disarmall
  58. // - !giveallweapon !crash !crashall !botjoin !botleave !botregister
  59. // - !togglecmd !toggleallcmd !akill !slap !giveweapon !clearallwarnings
  60. // - !uncageall !botidentify !dedisarmall
  61. //==============================================================================
  62. // Configuration
  63. //==============================================================================
  64. /*
  65. - To disable a feature, simply comment out the feature such as shown below:
  66. //#define EXAMPLE_CONFIGURATION
  67. - To enable a feature, simply remove the comment infront of the feature such as shown below:
  68. #define EXAMPLE_CONFIGURATION
  69.  
  70. */
  71. //==============================================================================
  72. #define GA_USE_ANTIRCON
  73. #define GA_USE_AUTOLOGIN
  74. #define GA_HIGH_PING_KICK
  75. #define GA_ANTI_CMDSPAM
  76. #define GA_ANTI_CHATSPAM
  77. //#define GA_SAVE_LOGS
  78. //#define GA_USE_IRC
  79. #if defined GA_USE_IRC
  80. #include <irc>
  81. #define IRC_SERVER "irc.gamerxserver.com" // The IRC server to connect to
  82. #define IRC_PORT 6667 // The port to connect to the IRC server.
  83. #define IRC_USE_SSL false
  84. #define IRC_CONNECT_DELAY 5 // Time to wait between connecting each bot (in seconds).
  85. #define IRC_CONNECT_ATTEMPTS 5 // How many attempts it will try to connect to the IRC server.
  86. #define IRC_REGISTER_DELAY 30000 // Time to wait before registering each bot (in ms).
  87. #define IRC_CHANNEL "#AdminScript" // Normal channel
  88. #define IRC_ECHO_CHANNEL "#AdminScript.echo" // Echo channel
  89. #define IRC_ADMIN_ECHO_CHANNEL "#AdminScript.aecho" // Admin echo channel
  90. #define IRC_MAX_BOTS 2 // Bots it will try to connect
  91. #define IRC_BOT_NICKNAME "AdminScript" // The bots nickname. If the bots nickname is f.ex: MAdmin, the nick will be MAdmin[botid] (MAdmin[1], MAdmin[2], etc) on connect.
  92. #define IRC_BOT_PASSWORD "changeme" // The bots password which it will identify it when it connects :)
  93. #define IRC_BOT_EMAIL "AdminScript@google.com"
  94. new gGroupID, gBotID[IRC_MAX_BOTS char];
  95. #endif
  96. #define GA_MUST_LOGIN_TO_SPAWN
  97. #define GA_MUST_REGISTER
  98. #define GA_MUST_LOGIN
  99. #define GA_ANTI_CMDSPAM_KICK_ADMINS
  100. #define GA_ANTI_TEXTREPEAT_KICK_ADMINS
  101. #define GA_ANTI_TEXTSPAM_KICK_ADMINS
  102. #define GA_SAVE_DEATHS
  103. #define GA_SAVE_KILLS
  104. #define GA_SAVE_SKIN
  105. #define GA_SAVE_SCORE
  106. #define GA_SAVE_MONEY
  107. #define GA_SAVE_WANTEDLEVEL
  108. #define GA_SAVE_DRUNKLEVEL
  109. #define GA_SAVE_FIGHTSTYLE
  110. #define GA_SAVE_WEAPONS
  111. #define GA_SAVE_ADMINWEAPONS
  112. //==============================================================================
  113. /*
  114. - All GA_TIME_BETWEEN_[...] values are in seconds.
  115. */
  116. #define GA_TIMER_RATE 999
  117. #define GA_MINUTES_BETWEEN_AUTOSAVE 10
  118. #define GA_MAX_RCONLOGIN_ATTEMPTS 3
  119. #define GA_MAX_LOGIN_ATTEMPTS 3
  120. #define GA_MAX_CMD_SPAM 7
  121. #define GA_MAX_TEXT_SPAM 7
  122. #define GA_MAX_TEXT_REPEAT 5
  123. #define GA_TIME_BETWEEN_CMDS 4
  124. #define GA_TIME_BETWEEN_TEXT 4
  125. #define GA_TIME_FOR_MUST_LOGIN 120
  126. #define GA_TIME_FOR_MUST_REGISTER 180
  127. #define GA_KICK_DELAY 500
  128. #define SERVER 0
  129. #define ADMIN 1
  130. #define NPC_LEVEL_LIMIT 10
  131. #define MAX_VIP_LVL 5
  132. #define MAX_ADMIN_LVL 10
  133. #define ALL_CMDS_LVL 10
  134. #define GA_MIN_PASSWORD 4
  135. #define GA_MAX_PASSWORD 30
  136. #define GA_MAX_PING 1000
  137. #define MAX_WARNINGS 3
  138. #define WARN_ACTION 0 // 0 = kick | 1 = ban
  139. #define BANEVADE_ACTION 1 // 0 = kick | 1 = ban
  140. #define GA_INFOMENU 1500
  141. #define GA_REGISTERMENU 1501
  142. #define GA_LOGINMENU 1502
  143. //==============================================================================
  144. #define SERVER_NAME "My Server Name"
  145. #define ACCOUNTPATH "/MAdmin/Accounts/%s.ini"
  146. #define ACCOUNTPATH_LENGTH (50)
  147. #define TEMPBAN "/MAdmin/Tempbans.txt"
  148. #define BANFILE "/MAdmin/Bans.txt"
  149. #define GA_DC_HEADER "{A9C4E4}MAdmin {00CC33}v1.0 {A9C4E4}by {00CC33}[03]Kakioshe"
  150. #define INVALID_CMD_MSG "Invalid command. Type /commands for a list of commands."
  151. #define ANTI_CMD_SPAM_MSG "Please wait before using another command."
  152. #define SERVER_KICK "<-[SERVER KICK]-> %s (%d) - Reason: %s."
  153. #define ADMIN_KICK "<-[ADMIN KICK]-> %s (%d) - Reason: %s."
  154. #define ADMIN_WARN "<-[ADMIN WARN]-> %s (%d) - Reason: %s."
  155. #define ADMIN_MUTE "<-[ADMIN MUTE]-> %s (%d) - Reason: %s."
  156. #define ADMIN_UNMUTE "<-[ADMIN UNMUTE]-> %s (%d) has been unmuted."
  157. #define ADMIN_CAGE "<-[ADMIN CAGE]-> %s (%d) - Reason: %s."
  158. #define ADMIN_UNCAGE "<-[ADMIN UNCAGE]-> %s (%d) has been uncaged."
  159. #define ADMIN_FREEZE "<-[ADMIN FREEZE]-> %s (%d) - Reason: %s."
  160. #define ADMIN_UNFREEZE "<-[ADMIN UNFREEZE]-> %s (%d) has been unfrozen."
  161. #define KICK_PLAYER_MSG "You've been kicked from the server. Reason: %s"
  162. #define KICK_GAMETEXT "~n~ ~w~You've been ~r~kicked ~w~from the ~y~server~w~!"
  163. #define SERVER_BAN "<-[SERVER BAN]-> %s (%d) - Reason: %s."
  164. #define ADMIN_BAN "<-[ADMIN BAN]-> %s (%d) - Reason: %s."
  165. #define I_KICK_MSG "You've kicked %s (%d). Reason: %s."
  166. #define I_BAN_MSG "You've banned %s (%d). Reason: %s."
  167. #define I_BAN_INFORMATION "You've been "DC_ERROR"banned "DC_DIALOG"from the server.\n\n\n"DC_INFO"Your IP:"DC_DIALOG" %s\n"DC_INFO"Your username:"DC_DIALOG" %s\n"DC_INFO"Ban type:"DC_DIALOG" %s\n"DC_INFO"Ban reason:"DC_DIALOG" %s"
  168. #define I_KICK_INFORMATION "You've been "DC_ERROR"kicked "DC_DIALOG"from the server.\n\n\n"DC_INFO"Your IP:"DC_DIALOG" %s\n"DC_INFO"Your username:"DC_DIALOG" %s\n"DC_INFO"Kick type:"DC_DIALOG" %s\n"DC_INFO"Kick reason:"DC_DIALOG" %s"
  169. #define BAN_PLAYER_MSG "You've been banned from the server. Reason: %s"
  170. #define BAN_GAMETEXT "~n~ ~w~You've been ~r~banned ~w~from the ~y~server~w~!"
  171. #define E_INVALID_PASSWORD_LENGTH "Invalid password length. Your password must be between "#GA_MIN_PASSWORD" and "#GA_MAX_PASSWORD" characters."
  172. #define E_INVALID_PASSWORD "Invalid password. Attempt %d/"#GA_MAX_LOGIN_ATTEMPTS"."
  173. #define E_NEED_TO_LOGIN "This player needs to be registered and logged in for you to use this command on them."
  174. #define E_NOT_CONNECTED "Invalid player."
  175. #define E_NOT_SPAWNED1 "You need to spawn to be able to use this command."
  176. #define E_NOT_SPAWNED2 "You can only use this command on spawned players."
  177. #define E_NPC "You need to be level "#NPC_LEVEL_LIMIT" or above to use this command on this NPC."
  178. #define ADMIN_CMD_MSG "*** ADMIN CMD: %s (%d) Has Used The Command /%s."
  179. #define E_HIGHER_LEVEL "You can not use this command on this player as they're a higher level than you and/or an RCON admin."
  180. #define E_CANT_USE_ON_YOURSELF "You can not use this command on yourself."
  181. #define I_REGISTRATION_CANCEL ""DC_ERROR"Warning!"DC_DIALOG" You've decided "DC_ERROR"not"DC_DIALOG" to register. Your stats will "DC_ERROR"not"DC_DIALOG" be saved unless you register.\n\nYou can bring up this menu again by typing "DC_INFO"/register"DC_DIALOG"."
  182. #define I_ACCOUNT_REGISTERED "Account "DC_INFO"%s "DC_DIALOG"successfully registered with the password "DC_INFO"%s"DC_DIALOG".\nRemember it for later use.\n\n"DC_INFO"You've been automaticly logged in."
  183. #define I_LOGIN_CANCEL ""DC_ERROR"Warning!"DC_DIALOG" You've decided "DC_ERROR"not"DC_DIALOG" to login. Your stats will "DC_ERROR"not"DC_DIALOG" be saved unless you login.\n\nYou can bring up this menu again by typing "DC_INFO"/login"DC_DIALOG"."
  184. #define I_LOGIN_SUCCESS "Successfully logged in.\n\n"DC_INFO"Admin level:"DC_DIALOG" %d.\n"DC_INFO"VIP level:"DC_DIALOG" %d."
  185. #define I_AUTO_LOGIN_SUCCESS "You've been automaticly logged in.\n\n"DC_INFO"Admin level:"DC_DIALOG" %d.\n"DC_INFO"VIP level:"DC_DIALOG" %d."
  186. #define E_MUTED "You're muted. You can not talk."
  187. #define E_STOP_SPAM "Stop spamming! If you continue spamming you will be kicked."
  188. #define E_STOP_REPEAT "Stop repeating yourself!"
  189. //==============================================================================
  190. // Variables
  191. //==============================================================================
  192. new CMDSString[1500], IsDisarmed[MAX_PLAYERS char], pwhash[MAX_PLAYERS][130], GodMode[MAX_PLAYERS char], PlayerIP[MAX_PLAYERS][16];
  193. new GA_Timer, GA_Seconds, GA_Minutes;
  194. new FreezeTime[MAX_PLAYERS][2], CageTime[MAX_PLAYERS][2], MuteTime[MAX_PLAYERS][2], DisarmTime[MAX_PLAYERS][2], TDTime[MAX_PLAYERS][2];
  195. new Text:AnnouncementTextdraw[MAX_PLAYERS], MessageSent[MAX_PLAYERS][2 char];
  196. //==============================================================================
  197. // Macros
  198. //==============================================================================
  199. #undef MAX_PLAYER_NAME
  200. #define MAX_PLAYER_NAME 24
  201. #define UpdatePVarInt(%0,%1,%2) SetPVarInt(%0, %1, (GetPVarInt(%0, %1) + %2))
  202. #define SetPlayerMoney(%0,%1) ResetPlayerMoney(%0), GivePlayerMoney(%0, %1)
  203. #define YesNo(%0) ((%0) == (1)) ? ("Yes") : ("No")
  204. #define Answer(%0,%1,%2) (%0) == (1) ? (%1) : (%2)
  205. #define AddS(%0) (%0 != 1 && %0 != -1) ? ("s") : ("")
  206. #define SendMSG(%0,%1,%2,%3) do{new _str[128]; format(_str, 128, %2, %3); SendClientMessage(%0, %1, _str);}while(FALSE)
  207. #define SendMSGToAll(%0,%1,%2) do{new _str[128]; format(_str, 128, %1, %2); SendClientMessageToAll(%0, _str);}while(FALSE)
  208. #define ShowPlayerDialogEx(%0,%1,%2,%3,%4,%5,%6,%7) do{CMDSString = ""; format(CMDSString, sizeof(CMDSString), %6, %7); ShowPlayerDialog(%0, %1, %2, %3, CMDSString, %4, %5);}while(FALSE)
  209. #define DeCapitalize(%1) for(new ToLowerChar; ToLowerChar < strlen(%1); ToLowerChar++) if(%1[ToLowerChar] > 64 && %1[ToLowerChar] < 91 ) %1[ToLowerChar] += 32
  210. #if defined GA_USE_IRC
  211. #define IRC_GroupSayEx(%0,%1,%2,%3) do{CMDSString = ""; format(CMDSString, sizeof(CMDSString), %2, %3); IRC_GroupSay(%0, %1, CMDSString);}while(FALSE)
  212. #define IRC_GroupNoticeEx(%0,%1,%2,%3) do{CMDSString = ""; format(CMDSString, sizeof(CMDSString), %2, %3); IRC_GroupNotice(%0, %1, CMDSString);}while(FALSE)
  213. #endif
  214. #define GivePlayerScore(%0,%1) SetPlayerScore(%0, (GetPlayerScore(%0) + %1))
  215. #define function%0(%1) forward %0(%1); public %0(%1)
  216. //==============================================================================
  217. // Colours
  218. //==============================================================================
  219. #define COLOUR_ERROR 0xFF0000AA
  220. #define COLOUR_ADMIN 0xCC00CCAA
  221. #define COLOUR_INFO 0x00CC33AA
  222. #define COLOUR_DIALOG 0xA9C4E4AA
  223. #define COLOUR_IRC 0x0066CCFF
  224. #define COLOUR_SAMP 0xA9C4E4FF
  225. #define COLOUR_PM 0xFFFF2AFF
  226. //==============================================================================
  227. #define DC_SAMP "{A9C4E4}"
  228. #define DC_DIALOG "{A9C4E4}"
  229. #define DC_ERROR "{FF0000}"
  230. #define DC_ADMIN "{CC00CC}"
  231. #define DC_INFO "{00CC33}"
  232. #define DC_TD_BLUE "{2B346E}"
  233. #define DC_TD_PURPLE "{925FDA}"
  234. #define DC_TD_GREEN "{2F5A26}"
  235. #define DC_TD_BLACK "{000000}"
  236. #define DC_TD_RED "{9C1619}"
  237. #define DC_TD_YELLOW "{C4A656}"
  238. #define DC_TD_WHITE "{C3C3C3}"
  239. #define DC_TD_ARROW "{6B696B}"
  240. //==============================================================================
  241. public OnFilterScriptInit()
  242. {
  243. new filename[ACCOUNTPATH_LENGTH];
  244. if(!fexist(TEMPBAN))
  245. {
  246. fcreate(TEMPBAN);
  247. printf("The file "TEMPBAN" didn't exist. Creating the file...");
  248. }
  249. if(!fexist(BANFILE))
  250. {
  251. fcreate(BANFILE);
  252. printf("The file "BANFILE" didn't exist. Creating the file...");
  253. }
  254. foreach(Character, i)
  255. {
  256. GetPlayerIp(i, PlayerIP[i], 16);
  257. if(IsPlayerNPC(i) && GetPVarType(i, "Level") >= 1)
  258. {
  259. SetPVarInt(i, "Level", MAX_ADMIN_LVL);
  260. if(GetPlayerState(i) == PLAYER_STATE_ONFOOT || IsPlayerInAnyVehicle(i))
  261. {
  262. SetPVarInt(i, "Spawned", 1);
  263. }
  264. continue;
  265. }
  266. if(BanCheck(i)) continue;
  267. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(i)));
  268. switch(fexist(filename))
  269. {
  270. case 0: ShowPlayerDialogEx(i, GA_REGISTERMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Register", "Cancel", "Welcome to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is "DC_ERROR"not "DC_DIALOG"registered.\nPlease register an account to avoid stat loss.\nEnter the password for your new account below:", SERVER_NAME, pNick(i));
  271. case 1:
  272. {
  273. #if defined GA_USE_AUTOLOGIN
  274. INI_ParseFile(filename, "InitLogin", false, true, i, true, false);
  275. switch(strcmp(GetPVarStringEx(i, "GA_TMP_LASTIP"), GetPlayerIpEx(i), true))
  276. {
  277. case 0:
  278. {
  279. SetPVarInt(i, "LoggedIn", 1);
  280. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(i)));
  281. INI_ParseFile(filename, "LoginPlayer", false, true, i, true, false);
  282. GameTextForPlayer(i, " ~n~ ~n~~p~Auto-Login Successfull!", 6000, 6);
  283. ShowPlayerDialogEx(i, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_AUTO_LOGIN_SUCCESS, GetPVarInt(i, "Level"), GetPVarInt(i, "VIP"));
  284. }
  285. case 1: ShowPlayerDialogEx(i, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "Welcome back to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is registered.\nEnter the password for this account to login:", SERVER_NAME, pNick(i));
  286. }
  287. #else
  288. ShowPlayerDialogEx(i, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "Welcome back to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is registered.\nEnter the password for this account to login:", SERVER_NAME, pNick(i));
  289. #endif
  290. }
  291. }
  292. CreateTextDraw(i);
  293. if(GetPlayerState(i) == PLAYER_STATE_ONFOOT || IsPlayerInAnyVehicle(i))
  294. {
  295. SetPVarInt(i, "Spawned", 1);
  296. }
  297. SetPVarInt(i, "ConnectTime", GetTickCount());
  298. FreezeTime[i][0] = CageTime[i][0] = MuteTime[i][0] = DisarmTime[i][0] = MessageSent[i]{0} = IsDisarmed{i} = GodMode{i} = TDTime[i][0] = 0;
  299. FreezeTime[i][1] = CageTime[i][1] = MuteTime[i][1] = DisarmTime[i][1] = MessageSent[i]{1} = TDTime[i][1] = 0;
  300. }
  301. #if defined GA_USE_IRC
  302. new string[50];
  303. print("Attempting to connect "#IRC_MAX_BOTS" bots...");
  304. for(new bot = 1; bot <= IRC_MAX_BOTS; bot++)
  305. {
  306. format(string, sizeof(string), "%s[%d]", IRC_BOT_NICKNAME, bot);
  307. gBotID{(bot-1)} = IRC_Connect(IRC_SERVER, IRC_PORT, string, string, string, IRC_USE_SSL);
  308. IRC_SetIntData(gBotID{(bot-1)}, E_IRC_CONNECT_DELAY, (IRC_CONNECT_DELAY * bot));
  309. IRC_SetIntData(gBotID{(bot-1)}, E_IRC_CONNECT_ATTEMPTS, IRC_CONNECT_ATTEMPTS);
  310. }
  311. gGroupID = IRC_CreateGroup();
  312. print("Connect initalized...");
  313. #endif
  314. GA_Timer = SetTimer("GA_Update", GA_TIMER_RATE, 1);
  315. print("Starting MAdmin timer (timer rate "#GA_TIMER_RATE")...");
  316. print("\n\n>> MAdmin v1.0 by [03]Kakioshe has been successfully loaded!\n\n");
  317. return 1;
  318. }
  319. public OnFilterScriptExit()
  320. {
  321. KillTimer(GA_Timer);
  322. #if defined GA_USE_IRC
  323. print("Disconnecting IRC bots...");
  324. for(new bot = 0; bot < IRC_MAX_BOTS; bot++)
  325. {
  326. IRC_Quit(gBotID{bot}, "Thank you for using MAdmin v1.0 by [03]Kakioshe");
  327. }
  328. IRC_DestroyGroup(gGroupID);
  329. print("Bots disconnected...");
  330. #endif
  331. print("Saving player stats and deleting PVars...");
  332. foreach(Player, i)
  333. {
  334. SavePlayerStats(i);
  335. pwhash[i] = "";
  336. MAdmin_DeletePVars(i);
  337. }
  338. print("All players stats have been saved and PVars deleted...");
  339. print("\n\n>> MAdmin v1.0 by [03]Kakioshe has been successfully unloaded!\n\n");
  340. return 1;
  341. }
  342. public OnPlayerConnect(playerid)
  343. {
  344. GetPlayerIp(playerid, PlayerIP[playerid], 16);
  345. SetPVarInt(playerid, "ConnectTime", GetTickCount());
  346. if(IsPlayerNPC(playerid))
  347. {
  348. SetPVarInt(playerid, "Level", MAX_ADMIN_LVL);
  349. SetPVarInt(playerid, "Spawned", 1);
  350. return 1;
  351. }
  352. if(BanCheck(playerid)) return 1;
  353. if(GetPVarInt(playerid, "Relogin") == 1)
  354. {
  355. DeletePVar(playerid, "Relogin");
  356. SendClientMessage(playerid, COLOUR_SAMP, "Reconnect successfull! Connected to "DC_INFO""SERVER_NAME""DC_SAMP"!");
  357. GameTextForPlayer(playerid, "~n~~g~Connected to ~n~~p~"SERVER_NAME"!", 6000, 3);
  358. }
  359. new filename[ACCOUNTPATH_LENGTH];
  360. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  361. switch(fexist(filename))
  362. {
  363. case 0: ShowPlayerDialogEx(playerid, GA_REGISTERMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Register", "Cancel", "Welcome to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is "DC_ERROR"not "DC_DIALOG"registered.\nPlease register an account to avoid stat loss.\nEnter the password for your new account below:", SERVER_NAME, pNick(playerid));
  364. case 1:
  365. {
  366. #if defined GA_USE_AUTOLOGIN
  367. INI_ParseFile(filename, "InitLogin", false, true, playerid, true, false);
  368. switch(strcmp(GetPVarStringEx(playerid, "GA_TMP_LASTIP"), GetPlayerIpEx(playerid), true))
  369. {
  370. case 0:
  371. {
  372. SetPVarInt(playerid, "LoggedIn", 1);
  373. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  374. INI_ParseFile(filename, "LoginPlayer", false, true, playerid, true, false);
  375. GameTextForPlayer(playerid, " ~n~ ~n~~p~Auto-Login Successfull!", 6000, 6);
  376. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_AUTO_LOGIN_SUCCESS, GetPVarInt(playerid, "Level"), GetPVarInt(playerid, "VIP"));
  377. }
  378. case 1: ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "Welcome back to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is registered.\nEnter the password for this account to login:", SERVER_NAME, pNick(playerid));
  379. }
  380. #else
  381. ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "Welcome back to "DC_INFO"%s"DC_DIALOG", %s!\n\nThis account is registered.\nEnter the password for this account to login:", SERVER_NAME, pNick(playerid));
  382. #endif
  383. }
  384. }
  385. CreateTextDraw(playerid);
  386. FreezeTime[playerid][0] = CageTime[playerid][0] = MuteTime[playerid][0] = MessageSent[playerid]{0} = DisarmTime[playerid][0] = IsDisarmed{playerid} = GodMode{playerid} = TDTime[playerid][0] = 0;
  387. FreezeTime[playerid][1] = CageTime[playerid][1] = MuteTime[playerid][1] = MessageSent[playerid]{1} = DisarmTime[playerid][1] = TDTime[playerid][1] = 0;
  388. #if defined GA_USE_IRC
  389. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[connect] 3%s (%d) has joined the server.", pNick(playerid), playerid);
  390. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[connect] 3%s (%d) has joined the server (IP: %s).", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  391. #endif
  392. TextDrawHideForPlayer(playerid, AnnouncementTextdraw[playerid]);
  393. return 1;
  394. }
  395. public OnPlayerDisconnect(playerid, reason)
  396. {
  397. SavePlayerStats(playerid);
  398. IsDisarmed{playerid} = 0, GodMode{playerid} = 0;
  399. if(GetPVarInt(playerid, "Relogin") == 1)
  400. {
  401. new string[25];
  402. format(string, sizeof(string), "unbanip %s", GetPlayerIpEx(playerid));
  403. SendRconCommand(string);
  404. SendClientMessage(playerid, COLOUR_SAMP, "Connecting to "DC_INFO""SERVER_NAME""DC_SAMP"...");
  405. GameTextForPlayer(playerid, "~n~~g~Connecting to ~n~~p~"SERVER_NAME"...", 6000, 3);
  406. }
  407. #if defined GA_USE_IRC
  408. switch(reason)
  409. {
  410. case 0:
  411. {
  412. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Timeout).", pNick(playerid), playerid);
  413. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Timeout) - (IP: %s).", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  414. }
  415. case 1:
  416. {
  417. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Quit).", pNick(playerid), playerid);
  418. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Quit) - (IP: %s).", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  419. }
  420. case 2:
  421. {
  422. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Kicked/Banned).", pNick(playerid), playerid);
  423. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[disconnect] 3%s (%d) has left the server (Kicked/Banned) - (IP: %s).", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  424. }
  425. }
  426. #endif
  427. TextDrawHideForPlayer(playerid, AnnouncementTextdraw[playerid]);
  428. return 1;
  429. }
  430.  
  431. public OnPlayerSpawn(playerid)
  432. {
  433. SetPVarInt(playerid, "Spawned", 1);
  434. #if defined GA_USE_IRC
  435. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[spawn] 3%s (%d) has spawned.", pNick(playerid), playerid);
  436. #endif
  437. return 1;
  438. }
  439.  
  440. public OnPlayerDeath(playerid, killerid, reason)
  441. {
  442. DeletePVar(playerid, "Spawned");
  443. UncagePlayer(playerid);
  444. #if defined GA_USE_IRC
  445. switch(IsPlayerConnected(killerid))
  446. {
  447. case 0: IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[death] 3%s (%d) died (%s).", pNick(playerid), playerid, GetDeathReason(killerid, reason));
  448. case 1: IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[death] 3%s (%d) was killed by %s (%d) (%s).", pNick(playerid), playerid, pNick(killerid), killerid, GetDeathReason(killerid, reason));
  449. }
  450. #endif
  451. return 1;
  452. }
  453. public OnPlayerText(playerid, text[])
  454. {
  455. if(GetPVarInt(playerid, "Muted") == 1)
  456. {
  457. SendClientMessage(playerid, COLOUR_ERROR, E_MUTED);
  458. return 0;
  459. }
  460. if(GetPVarInt(playerid, "CapsDisabled") == 1)
  461. {
  462. DeCapitalize(text);
  463. SendPlayerMessageToAll(playerid, text);
  464. }
  465. SetPVarInt(playerid, "TextSpam", (GetPVarInt(playerid, "TextSpam") + 1));
  466. if(GetSecondsBetweenAction(GetPVarInt(playerid, "LastChat")) >= GA_TIME_BETWEEN_TEXT)
  467. {
  468. DeletePVar(playerid, "TextSpam");
  469. }
  470. if(GetPVarInt(playerid, "TextSpam") >= GA_MAX_TEXT_SPAM)
  471. {
  472. switch(IsAdmin(playerid))
  473. {
  474. case 0:
  475. {
  476. KickEx(playerid, SERVER, "Chat Spam");
  477. return 0;
  478. }
  479. case 1:
  480. {
  481. #if defined GA_ANTI_TEXTSPAM_KICK_ADMINS
  482. KickEx(playerid, SERVER, "Chat Spam");
  483. return 0;
  484. #endif
  485. }
  486. }
  487. }
  488. if(GA_MAX_TEXT_SPAM >= 4 && (GetPVarInt(playerid, "TextSpam") == (GA_MAX_TEXT_SPAM-2) || GetPVarInt(playerid, "TextSpam") == (GA_MAX_TEXT_SPAM-1)))
  489. {
  490. switch(IsAdmin(playerid))
  491. {
  492. case 0: return SendClientMessage(playerid, COLOUR_ERROR, E_STOP_SPAM);
  493. case 1:
  494. {
  495. #if defined GA_ANTI_TEXTREPEAT_KICK_ADMINS
  496. return SendClientMessage(playerid, COLOUR_ERROR, E_STOP_SPAM);
  497. #endif
  498. }
  499. }
  500. }
  501. switch(strcmp(text, GetPVarStringEx(playerid, "LastMessage"), false))
  502. {
  503. case 0:
  504. {
  505. UpdatePVarInt(playerid, "RepeatingTextCount", 1);
  506. if(GA_MAX_TEXT_REPEAT >= 4 && (GetPVarInt(playerid, "RepeatingTextCount") == (GA_MAX_TEXT_REPEAT-2) || GetPVarInt(playerid, "RepeatingTextCount") == (GA_MAX_TEXT_REPEAT-1)))
  507. {
  508. switch(IsAdmin(playerid))
  509. {
  510. case 0: return SendClientMessage(playerid, COLOUR_ERROR, E_STOP_REPEAT);
  511. case 1:
  512. {
  513. #if defined GA_ANTI_TEXTREPEAT_KICK_ADMINS
  514. return SendClientMessage(playerid, COLOUR_ERROR, E_STOP_REPEAT);
  515. #endif
  516. }
  517. }
  518. }
  519. if(GetPVarInt(playerid, "RepeatingTextCount") >= GA_MAX_TEXT_REPEAT)
  520. {
  521. switch(IsAdmin(playerid))
  522. {
  523. case 0:
  524. {
  525. KickEx(playerid, SERVER, "Repeating Same Text More Than "#GA_MAX_TEXT_REPEAT" Times");
  526. return 0;
  527. }
  528. case 1:
  529. {
  530. #if defined GA_ANTI_TEXTREPEAT_KICK_ADMINS
  531. KickEx(playerid, SERVER, "Repeating Same Text More Than "#GA_MAX_TEXT_REPEAT" Times");
  532. return 0;
  533. #endif
  534. }
  535. }
  536. }
  537. }
  538. case 1: DeletePVar(playerid, "RepeatingTextCount");
  539. }
  540. SetPVarInt(playerid, "LastChat", GetTickCount());
  541. SetPVarString(playerid, "LastMessage", text);
  542. #if defined GA_USE_IRC
  543. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7[chat] 3%s (%d): %s", pNick(playerid), playerid, text);
  544. #endif
  545. return 1;
  546. }
  547. public OnPlayerStateChange(playerid, newstate, oldstate)
  548. {
  549. foreach(Player, i)
  550. {
  551. if(GetPVarInt(i, "SpectatingPlayer") == playerid && GetPVarInt(i, "Spectating") == 1)
  552. {
  553. if(newstate == PLAYER_STATE_ONFOOT)
  554. {
  555. SetPlayerInterior(i, GetPlayerInterior(playerid));
  556. SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  557. TogglePlayerSpectating(i, 1);
  558. PlayerSpectatePlayer(i, playerid);
  559. }
  560. if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  561. {
  562. SetPlayerInterior(i, GetPlayerInterior(playerid));
  563. SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  564. TogglePlayerSpectating(i, 1);
  565. PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
  566. }
  567. break;
  568. }
  569. }
  570. return 1;
  571. }
  572.  
  573. public OnPlayerRequestSpawn(playerid)
  574. {
  575. #if defined GA_MUST_LOGIN_TO_SPAWN
  576. if(GetPVarType(playerid, "LoggedIn") == PLAYER_VARTYPE_NONE)
  577. {
  578. ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "You "DC_ERROR"must "DC_DIALOG"login to spawn, "DC_INFO"%s!\n\n"DC_DIALOG"Enter the password for your account below:", pNick(playerid));
  579. return 0;
  580. }
  581. #endif
  582. return 1;
  583. }
  584. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  585. {
  586. foreach(Player, i)
  587. {
  588. if(GetPVarInt(i, "SpectatingPlayer") == playerid && GetPVarInt(i, "Spectating") == 1)
  589. {
  590. SetPlayerInterior(i, newinteriorid);
  591. break;
  592. }
  593. }
  594. return 1;
  595. }
  596.  
  597. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  598. {
  599. return 1;
  600. }
  601. public OnRconLoginAttempt(ip[], password[], success)
  602. {
  603. #if defined GA_USE_ANTIRCON
  604. if(!success)
  605. {
  606. foreach(Player, i)
  607. {
  608. if(IsPlayerAdmin(i)) continue;
  609. if(!strcmp(GetPlayerIpEx(i), ip, true))
  610. {
  611. UpdatePVarInt(i, "RconLogins", 1);
  612. #if defined GA_USE_IRC
  613. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[rcon login] 3%s (%d) attempted to login to RCON (Attempt: %d/"#GA_MAX_RCONLOGIN_ATTEMPTS").", pNick(i), i, GetPVarInt(i, "RconLogins"));
  614. #endif
  615. if(GetPVarInt(i, "RconLogins") >= GA_MAX_RCONLOGIN_ATTEMPTS)
  616. {
  617. BanEx2(i, SERVER, "Failed to login to RCON "#GA_MAX_RCONLOGIN_ATTEMPTS" times");
  618. }
  619. break;
  620. }
  621. }
  622. }
  623. #endif
  624. return 1;
  625. }
  626. public OnPlayerUpdate(playerid)
  627. {
  628. if(IsDisarmed{playerid} == 1)
  629. {
  630. SetPlayerArmedWeapon(playerid, 0);
  631. }
  632. return 1;
  633. }
  634. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  635. {
  636. new INI:file, filename[ACCOUNTPATH_LENGTH], buf[129];
  637. //strreplace2(inputtext, "%", " ");
  638. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  639. if(dialogid == GA_REGISTERMENU)
  640. {
  641. switch(response)
  642. {
  643. case 0:
  644. {
  645. #if defined GA_MUST_REGISTER
  646. ShowPlayerDialogEx(playerid, GA_REGISTERMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Register", "Cancel", "You must register an account to play on %s!\n\nEnter the password for your new account below:", SERVER_NAME);
  647. #else
  648. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_REGISTRATION_CANCEL, "");
  649. #endif
  650. }
  651. case 1:
  652. {
  653. new year, month, day, hour, minute, second, RegDate[20];
  654. if(strlen(inputtext) < GA_MIN_PASSWORD || strlen(inputtext) > GA_MAX_PASSWORD) return SendClientMessage(playerid, COLOUR_ERROR, E_INVALID_PASSWORD_LENGTH);
  655. fcreate(filename);
  656. getdate(year, month, day);
  657. gettime(hour, minute, second);
  658. format(RegDate, sizeof(RegDate), "%02d/%02d/%02d %02d:%02d:%02d", day, month, year, hour, minute, second);
  659. WP_Hash(buf, sizeof(buf), inputtext);
  660. file = INI_Open(filename);
  661. INI_WriteString(file, "PasswordHash", buf);
  662. INI_WriteString(file, "RegisteredIP", GetPlayerIpEx(playerid));
  663. INI_WriteString(file, "LastIP", GetPlayerIpEx(playerid));
  664. INI_WriteString(file, "RegisterDate", RegDate);
  665. INI_WriteString(file, "LastVisit", RegDate);
  666. INI_Close(file);
  667. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_ACCOUNT_REGISTERED, pNick(playerid), inputtext);
  668. GameTextForPlayer(playerid, " ~n~ ~n~~p~Account registered!", 6000, 6);
  669. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  670. SetPVarInt(playerid, "LoggedIn", 1);
  671. SavePlayerStats(playerid);
  672. #if defined GA_USE_IRC
  673. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[registration] 3%s (%d) registered from IP %s.", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  674. #endif
  675. }
  676. }
  677. return 1;
  678. }
  679. if(dialogid == GA_LOGINMENU)
  680. {
  681. switch(response)
  682. {
  683. case 0:
  684. {
  685. #if defined GA_MUST_LOGIN
  686. ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "You "DC_ERROR"must "DC_DIALOG"login to play on "DC_INFO"%s!\n\n"DC_DIALOG"Enter the password for this account to login:", SERVER_NAME);
  687. #else
  688. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_LOGIN_CANCEL, "");
  689. #endif
  690. }
  691. case 1:
  692. {
  693. if(strlen(inputtext) < GA_MIN_PASSWORD || strlen(inputtext) > GA_MAX_PASSWORD) return SendClientMessage(playerid, COLOUR_ERROR, E_INVALID_PASSWORD_LENGTH);
  694. WP_Hash(buf, sizeof(buf), inputtext);
  695. if(strcmp(pwhash[playerid], buf, true))
  696. {
  697. UpdatePVarInt(playerid, "PasswordAttempts", 1);
  698. new attempts = GetPVarInt(playerid, "PasswordAttempts");
  699. #if defined GA_USE_IRC
  700. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[failed login] 3%s (%d) failed to login from IP %s (Attempt: %d/"#GA_MAX_LOGIN_ATTEMPTS").", pNick(playerid), playerid, GetPlayerIpEx(playerid), attempts);
  701. #endif
  702. SendMSG(playerid, COLOUR_ERROR, E_INVALID_PASSWORD, attempts);
  703. if(attempts >= GA_MAX_LOGIN_ATTEMPTS)
  704. {
  705. switch(GetPVarInt(playerid, "tmpLevel"))
  706. {
  707. case 0: KickEx(playerid, SERVER, "Failed Login");
  708. default: BanEx2(playerid, SERVER, "Failed Administrator Login");
  709. }
  710. }
  711. }
  712. else
  713. {
  714. SetPVarInt(playerid, "LoggedIn", 1);
  715. INI_ParseFile(filename, "LoginPlayer", false, true, playerid, true, false);
  716. DeletePVar(playerid, "PasswordAttempts");
  717. GameTextForPlayer(playerid, " ~n~ ~n~~p~Login Successfull!", 6000, 6);
  718. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_LOGIN_SUCCESS, GetPVarInt(playerid, "Level"), GetPVarInt(playerid, "VIP"));
  719. #if defined GA_USE_IRC
  720. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[login] 3%s (%d) logged in from IP %s.", pNick(playerid), playerid, GetPlayerIpEx(playerid));
  721. #endif
  722. }
  723. }
  724. }
  725. return 1;
  726. }
  727. return 0;
  728. }
  729. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  730. {
  731. return 1;
  732. }
  733. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  734. {
  735. switch(success)
  736. {
  737. case 1:
  738. {
  739. if(GetSecondsBetweenAction(GetPVarInt(playerid, "LastCommand")) < GA_TIME_BETWEEN_CMDS)
  740. {
  741. UpdatePVarInt(playerid, "CommandSpam", 1);
  742. new CommandSpam = GetPVarInt(playerid, "CommandSpam");
  743. if(CommandSpam >= GA_MAX_CMD_SPAM)
  744. {
  745. switch(IsAdmin(playerid))
  746. {
  747. case 0: return KickEx(playerid, SERVER, "Command Spam");
  748. #if defined GA_ANTI_CMDSPAM_KICK_ADMINS
  749. case 1: return KickEx(playerid, SERVER, "Command Spam");
  750. #endif
  751. }
  752. }
  753. if(GA_MAX_CMD_SPAM >= 4 && (CommandSpam == (GA_MAX_CMD_SPAM-2) || CommandSpam == (GA_MAX_CMD_SPAM-1)))
  754. {
  755. switch(IsAdmin(playerid))
  756. {
  757. case 0: return SendClientMessage(playerid, COLOUR_ERROR, ANTI_CMD_SPAM_MSG);
  758. #if defined GA_ANTI_CMDSPAM_KICK_ADMINS
  759. case 1: return SendClientMessage(playerid, COLOUR_ERROR, ANTI_CMD_SPAM_MSG);
  760. #endif
  761. }
  762. }
  763. }
  764. if(GetSecondsBetweenAction(GetPVarInt(playerid, "LastCommand")) > GA_TIME_BETWEEN_CMDS && GetPVarType(playerid, "CommandSpam") != PLAYER_VARTYPE_NONE)
  765. {
  766. DeletePVar(playerid, "CommandSpam");
  767. }
  768. SetPVarInt(playerid, "LastCommand", GetTickCount());
  769. return 1;
  770. }
  771. }
  772. return SendClientMessage(playerid, COLOUR_ERROR, INVALID_CMD_MSG);
  773. }
  774. //##############################################################################
  775. new Float:GI_X2, Float:GI_Y2, Float:GI_Z2;
  776. stock Float:GX(playerid)
  777. {
  778. GetPlayerPos(playerid, GI_X2, GI_Y2, GI_Z2);
  779. return GI_X2;
  780. }
  781. stock Float:GY(playerid)
  782. {
  783. GetPlayerPos(playerid, GI_X2, GI_Y2, GI_Z2);
  784. return GI_Y2;
  785. }
  786. stock Float:GZ(playerid)
  787. {
  788. GetPlayerPos(playerid, GI_X2, GI_Y2, GI_Z2);
  789. return GI_Z2;
  790. }
  791. stock SetPlayerPosEx(playerid, Float:GA_X, Float:GA_Y, Float:GA_Z, interior = -1, world = -1)
  792. {
  793. new vehicleid = GetPlayerVehicleID(playerid);
  794. if(interior == -1)
  795. {
  796. interior = GetPlayerInterior(playerid);
  797. }
  798. if(world == -1)
  799. {
  800. world = GetPlayerVirtualWorld(playerid);
  801. }
  802. SetPlayerInterior(playerid, interior), SetPlayerVirtualWorld(playerid, world);
  803. switch(IsPlayerInAnyVehicle(playerid))
  804. {
  805. case 0: SetPlayerPos(playerid, GA_X, GA_Y, GA_Z);
  806. case 1: LinkVehicleToInterior(vehicleid, interior), SetVehicleVirtualWorld(vehicleid, world), SetVehiclePos(vehicleid, GA_X, GA_Y, GA_Z);
  807. }
  808. return 1;
  809. }
  810. //==============================================================================
  811. // Commands
  812. //==============================================================================
  813. CMD:acmds(playerid, params[])
  814. {
  815. if(IsAdminEx(playerid, 1))
  816. {
  817. #pragma unused params
  818. CMDSString = "";
  819. new lvl = GetPVarInt(playerid, "Level");
  820. if(lvl < 3) strcat(CMDSString, ""DC_INFO"Common Commands:"DC_DIALOG" /godmode /heal /jetpack /listweapons /clearchat /spectate /getinfo\n");
  821. if(lvl >= 3 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Common Commands:"DC_DIALOG" /godmode /heal /jetpack /listweapons /clearchat /spectate /getinfo /reconnect\n");
  822. if(lvl >= 1 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Punishment Commands:"DC_DIALOG" /kick /ban /tempban /akill /slap /crash /(de)disarm /(un)mute /(un)freeze /(un)cage\n");
  823. if(lvl >= 1 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Punishment Commands:"DC_DIALOG" /warn /clearwarnings\n");
  824. if(lvl == 2 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Give/Set Commands:"DC_DIALOG" /setvhealth /setarmour /sethealth /giveweapon\n");
  825. if(lvl >= 3 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Give/Set Commands:"DC_DIALOG" /setvhealth /setarmour /sethealth /setmoney /setweather /setinterior /setworld /setskin /setscore /giveweapon /givemoney /givescore\n");
  826. if(lvl >= 1 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Tele Commands:"DC_DIALOG" /up /down /north /south /east /west /goto /gotop /gotopos /send /sendp /get /getp\n");
  827. if(lvl >= 1 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Vehicle Commands:"DC_DIALOG" /toggleengine /vehicle /destroyvehicle /removecar\n");
  828. if(lvl >= 1 || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"Messaging Commands:"DC_DIALOG" /text /textp /amsg /asay\n");
  829. if(lvl >= ALL_CMDS_LVL || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"\"All\" Commands:"DC_DIALOG" /giveallweapon /crashall /slapall /akillall /(un)freezeall /warnall /clearallwarnings\n");
  830. if(lvl >= ALL_CMDS_LVL || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"\"All\" Commands:"DC_DIALOG" /(un)muteall /(de)disarmall /(un)cageall /banall /healall /setallarmour\n");
  831. if(lvl >= ALL_CMDS_LVL || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"\"All\" Commands:"DC_DIALOG" /setallhealth /setallmoney /setallscore /setallskin /setallworld /setallinterior\n");
  832. if(lvl >= ALL_CMDS_LVL || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"\"All\" Commands:"DC_DIALOG" /giveallscore /giveallmoney /reconnectall\n");
  833. if(lvl >= MAX_ADMIN_LVL || IsPlayerAdmin(playerid)) strcat(CMDSString, ""DC_INFO"RCON/Level "#MAX_ADMIN_LVL" Commands:"DC_DIALOG" /setlevel /setvip /rangeban /setname /setgravity /togglecmd /toggleallcmd");
  834. ShowPlayerDialog(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, CMDSString, "Close", "");
  835. return 1;
  836. }
  837. else return 0;
  838. }
  839. CMD:setlevel(playerid, params[])
  840. {
  841. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  842. {
  843. new id, amount;
  844. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setlevel (nick/id) (level: 0-"#MAX_ADMIN_LVL")");
  845. if(GetPVarType(id, "LoggedIn") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NEED_TO_LOGIN);
  846. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  847. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  848. if(amount < 0 || amount > MAX_ADMIN_LVL) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setlevel (nick/id) (level: 0-"#MAX_ADMIN_LVL")");
  849. else
  850. {
  851. SetPVarInt(id, "Level", amount);
  852. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has set your administrator level to %d.", pNick(playerid), playerid, amount);
  853. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) administrator level to %d.", pNick(id), id, amount);
  854. #if defined GA_USE_IRC
  855. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setlevel] 3%s (%d) set %s (%d) to administrator level %d.", pNick(playerid), playerid, pNick(id), id, amount);
  856. #endif
  857. if(amount > 0)
  858. {
  859. SendClientMessage(id, COLOUR_INFO, "Type /admincommands (/acmds) For A List Of Commands.");
  860. }
  861. SendAdminCommand(playerid, "setlevel");
  862. #if defined GA_SAVE_LOGS
  863. new log[128];
  864. format(log, sizeof(log), "%s (%d) was set to level %d by %s (%d).", pNick(id), id, amount, pNick(playerid), playerid);
  865. SaveLog("/MAdmin/Logs/AdministratorLogs.txt", log);
  866. #endif
  867. SavePlayerStats(id);
  868. }
  869. return 1;
  870. }
  871. else return 0;
  872. }
  873. CMD:setvip(playerid, params[])
  874. {
  875. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  876. {
  877. new id, amount;
  878. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setvip (nick/id) (level: 0-"#MAX_VIP_LVL")");
  879. if(GetPVarType(id, "LoggedIn") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NEED_TO_LOGIN);
  880. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  881. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  882. if(amount < 0 || amount > MAX_VIP_LVL) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setvip (nick/id) (level: 0-"#MAX_VIP_LVL")");
  883. else
  884. {
  885. SetPVarInt(id, "VIP", amount);
  886. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has set your VIP level to %d.", pNick(playerid), playerid, amount);
  887. SendMSG(playerid, COLOUR_INFO, "You've set %s (%d) to a level %d VIP", pNick(id), id, amount);
  888. #if defined GA_USE_IRC
  889. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setvip] 3%s (%d) set %s (%d) to VIP level %d.", pNick(playerid), playerid, pNick(id), id, amount);
  890. #endif
  891. #if defined GA_SAVE_LOGS
  892. new log[128];
  893. format(log, sizeof(log), "%s (%d) was set to a level %d VIP by %s (%d).", pNick(id), id, amount, pNick(playerid), playerid);
  894. SaveLog("/MAdmin/Logs/VIPLogs.txt", log);
  895. #endif
  896. SavePlayerStats(id);
  897. SendAdminCommand(playerid, "setvip");
  898. return 1;
  899. }
  900. }
  901. else return 0;
  902. }
  903. CMD:setname(playerid, params[])
  904. {
  905. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  906. {
  907. new id, name[(MAX_PLAYER_NAME + 1)], pName1[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
  908. if(sscanf(params, "us["#MAX_PLAYER_NAME"]", id, name)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setname (nick/id) (new name)");
  909. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  910. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  911. if(name[MAX_PLAYER_NAME]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 3 and "#MAX_PLAYER_NAME" characters.");
  912. else
  913. {
  914. GetPlayerName(id, pName1, MAX_PLAYER_NAME), GetPlayerName(playerid, pName2, MAX_PLAYER_NAME);
  915. switch(SetPlayerName(id, name))
  916. {
  917. case 0: return SendClientMessage(playerid, COLOUR_ERROR, "This player is already using this name.");
  918. case -1: return SendClientMessage(playerid, COLOUR_ERROR, "Unable to set the players name (name in use or the name contains invalid characters).");
  919. case 1:
  920. {
  921. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has set your name to a \"%s\".", pName2, playerid, name);
  922. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) name to \"%s\".", pName1, id, name);
  923. #if defined GA_USE_IRC
  924. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setname] 3%s (%d) set %s's (%d) name to \"%s\".", pNick(playerid), playerid, pNick(id), id, name);
  925. #endif
  926. SendAdminCommand(playerid, "setname");
  927. }
  928. }
  929. return 1;
  930. }
  931. }
  932. else return 0;
  933. }
  934. CMD:setgravity(playerid, params[])
  935. {
  936. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  937. {
  938. new Float:amount;
  939. if(sscanf(params, "f", amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setgravity (float: gravity)");
  940. else
  941. {
  942. SetGravity(amount);
  943. SendMSGToAll(COLOUR_INFO, "Administrator %s (%d) has set the gravity to %f", pNick(playerid), playerid, amount);
  944. SendMSG(playerid, COLOUR_INFO, "You've set the gravity to %f.", amount);
  945. #if defined GA_USE_IRC
  946. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setgravity] 3%s (%d) set the gravity to %f.", pNick(playerid), playerid, amount);
  947. #endif
  948. SendAdminCommand(playerid, "setgravity");
  949. return 1;
  950. }
  951. }
  952. else return 0;
  953. }
  954. CMD:setscore(playerid, params[])
  955. {
  956. if(IsAdminEx(playerid, 3))
  957. {
  958. new id, amount;
  959. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setscore (nick/id) (amount)");
  960. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  961. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  962. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  963. if(id == playerid && !IsAdminEx(playerid, MAX_ADMIN_LVL)) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  964. else
  965. {
  966. SetPlayerScore(id, amount);
  967. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) score to %d.", pNick(id), id, amount);
  968. #if defined GA_USE_IRC
  969. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setscore] 3%s (%d) set %s's (%d) score to %d.", pNick(playerid), playerid, pNick(id), id, amount);
  970. #endif
  971. SendAdminCommand(playerid, "setscore");
  972. return 1;
  973. }
  974. }
  975. else return 0;
  976. }
  977. CMD:givescore(playerid, params[])
  978. {
  979. if(IsAdminEx(playerid, 3))
  980. {
  981. new id, amount;
  982. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /givescore (nick/id) (amount)");
  983. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  984. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  985. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  986. if(id == playerid && !IsAdminEx(playerid, MAX_ADMIN_LVL)) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  987. else
  988. {
  989. GivePlayerScore(id, amount);
  990. SendMSG(playerid, COLOUR_INFO, "You've given %s (%d) %d score.", pNick(id), id, amount);
  991. #if defined GA_USE_IRC
  992. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[givescore] 3%s (%d) gave %s (%d) %d score (Current score: %d).", pNick(playerid), playerid, pNick(id), id, amount, GetPlayerScore(id));
  993. #endif
  994. SendAdminCommand(playerid, "givescore");
  995. return 1;
  996. }
  997. }
  998. else return 0;
  999. }
  1000. CMD:setallscore(playerid, params[])
  1001. {
  1002. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1003. {
  1004. new amount = strval(params);
  1005. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallscore (amount)");
  1006. else
  1007. {
  1008. new count;
  1009. foreach(Player, i)
  1010. {
  1011. if(IsAdmin(i)) continue;
  1012. SetPlayerScore(i, amount);
  1013. count++;
  1014. }
  1015. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators score to %d (%d in total).", amount, count);
  1016. #if defined GA_USE_IRC
  1017. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setallscore] 3%s (%d) set all non-administrators score to %d.", pNick(playerid), playerid, amount);
  1018. #endif
  1019. SendAdminCommand(playerid, "setallscore");
  1020. return 1;
  1021. }
  1022. }
  1023. else return 0;
  1024. }
  1025. CMD:giveallscore(playerid, params[])
  1026. {
  1027. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1028. {
  1029. new amount = strval(params);
  1030. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /giveallscore (amount)");
  1031. else
  1032. {
  1033. new count;
  1034. foreach(Player, i)
  1035. {
  1036. if(IsAdmin(i)) continue;
  1037. GivePlayerScore(i, amount);
  1038. count++;
  1039. }
  1040. SendMSG(playerid, COLOUR_INFO, "You've given all non-administrators %d score (%d in total).", amount, count);
  1041. #if defined GA_USE_IRC
  1042. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setscore] 3%s (%d) gave all non-administrators %d score..", pNick(playerid), playerid, amount);
  1043. #endif
  1044. SendAdminCommand(playerid, "giveallscore");
  1045. return 1;
  1046. }
  1047. }
  1048. else return 0;
  1049. }
  1050. CMD:setskin(playerid, params[])
  1051. {
  1052. if(IsAdminEx(playerid, 3))
  1053. {
  1054. new id, amount;
  1055. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setscore (nick/id) (skin ID)");
  1056. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1057. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1058. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1059. if(!IsValidSkin(amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid skin ID.");
  1060. else
  1061. {
  1062. SetPlayerSkin(id, amount);
  1063. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has set your skin to %d.", pNick(playerid), playerid, amount);
  1064. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) skin to %d.", pNick(id), id, amount);
  1065. #if defined GA_USE_IRC
  1066. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setskin] 3%s (%d) set %s's (%d) skin to %d.", pNick(playerid), playerid, pNick(id), id, amount);
  1067. #endif
  1068. SendAdminCommand(playerid, "setskin");
  1069. return 1;
  1070. }
  1071. }
  1072. else return 0;
  1073. }
  1074. CMD:setallskin(playerid, params[])
  1075. {
  1076. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1077. {
  1078. new amount = strval(params);
  1079. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallskin (skin ID)");
  1080. if(!IsValidSkin(amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid skin ID.");
  1081. else
  1082. {
  1083. new count;
  1084. foreach(Player, i)
  1085. {
  1086. if(IsAdmin(i)) continue;
  1087. SetPlayerSkin(i, amount);
  1088. count++;
  1089. }
  1090. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators skin to %d (%d in total).", amount, count);
  1091. #if defined GA_USE_IRC
  1092. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setallskin] 3%s (%d) set all non-administrators skin to %d.", pNick(playerid), playerid, amount);
  1093. #endif
  1094. SendAdminCommand(playerid, "setallskin");
  1095. return 1;
  1096. }
  1097. }
  1098. else return 0;
  1099. }
  1100. CMD:setworld(playerid, params[])
  1101. {
  1102. if(IsAdminEx(playerid, 4))
  1103. {
  1104. new id, amount;
  1105. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setworld (nick/id) (virtual world)");
  1106. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1107. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1108. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1109. else
  1110. {
  1111. SetPlayerVirtualWorld(id, amount);
  1112. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) virtual world to %d.", pNick(id), id, amount);
  1113. SendAdminCommand(playerid, "setworld");
  1114. return 1;
  1115. }
  1116. }
  1117. else return 0;
  1118. }
  1119. CMD:setallworld(playerid, params[])
  1120. {
  1121. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1122. {
  1123. new amount = strval(params);
  1124. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallworld (world)");
  1125. else
  1126. {
  1127. new count;
  1128. foreach(Player, i)
  1129. {
  1130. if(IsAdmin(i)) continue;
  1131. SetPlayerVirtualWorld(i, amount);
  1132. count++;
  1133. }
  1134. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators virtual world to %d (%d in total).", amount, count);
  1135. SendAdminCommand(playerid, "setallworld");
  1136. return 1;
  1137. }
  1138. }
  1139. else return 0;
  1140. }
  1141. CMD:setinterior(playerid, params[])
  1142. {
  1143. if(IsAdminEx(playerid, 4))
  1144. {
  1145. new id, amount;
  1146. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setinterior (nick/id) (interior)");
  1147. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1148. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1149. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1150. else
  1151. {
  1152. SetPlayerInterior(id, amount);
  1153. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) interior to %d.", pNick(id), id, amount);
  1154. SendAdminCommand(playerid, "setinterior");
  1155. return 1;
  1156. }
  1157. }
  1158. else return 0;
  1159. }
  1160. CMD:setallinterior(playerid, params[])
  1161. {
  1162. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1163. {
  1164. new amount = strval(params);
  1165. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallinterior (interior)");
  1166. else
  1167. {
  1168. new count;
  1169. foreach(Player, i)
  1170. {
  1171. if(IsAdmin(i)) continue;
  1172. SetPlayerInterior(i, amount);
  1173. count++;
  1174. }
  1175. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators interior to %d (%d in total).", amount, count);
  1176. SendAdminCommand(playerid, "setallinterior");
  1177. return 1;
  1178. }
  1179. }
  1180. else return 0;
  1181. }
  1182. CMD:setweather(playerid, params[])
  1183. {
  1184. if(IsAdminEx(playerid, 3))
  1185. {
  1186. new amount;
  1187. if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setweather (nick/id) (weather id)");
  1188. else
  1189. {
  1190. SetWeather(amount);
  1191. SendMSGToAll(COLOUR_INFO, "Administrator %s (%d) has set the weather to %d.", pNick(playerid), playerid, amount);
  1192. SendMSG(playerid, COLOUR_INFO, "You've set the weather to %d.", amount);
  1193. #if defined GA_USE_IRC
  1194. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setweather] 3%s (%d) set the weather to %d.", pNick(playerid), playerid, amount);
  1195. #endif
  1196. SendAdminCommand(playerid, "setweather");
  1197. return 1;
  1198. }
  1199. }
  1200. else return 0;
  1201. }
  1202. CMD:setmoney(playerid, params[])
  1203. {
  1204. if(IsAdminEx(playerid, 3))
  1205. {
  1206. new id, amount;
  1207. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setmoney (nick/id) (amount)");
  1208. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1209. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1210. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1211. if(id == playerid && !IsAdminEx(playerid, MAX_ADMIN_LVL)) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  1212. else
  1213. {
  1214. SetPlayerMoney(id, amount);
  1215. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) money to $%d.", pNick(id), id, amount);
  1216. #if defined GA_USE_IRC
  1217. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setmoney] 3%s (%d) set %s's (%d) money to $%d.", pNick(playerid), playerid, pNick(id), id, amount);
  1218. #endif
  1219. SendAdminCommand(playerid, "setmoney");
  1220. return 1;
  1221. }
  1222. }
  1223. else return 0;
  1224. }
  1225. CMD:givemoney(playerid, params[])
  1226. {
  1227. if(IsAdminEx(playerid, 3))
  1228. {
  1229. new id, amount;
  1230. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /givemoney (nick/id) (amount)");
  1231. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1232. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1233. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1234. if(id == playerid && !IsAdminEx(playerid, MAX_ADMIN_LVL)) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  1235. else
  1236. {
  1237. GivePlayerMoney(id, amount);
  1238. SendMSG(playerid, COLOUR_INFO, "You've given %s (%d) $%d.", pNick(id), id, amount);
  1239. #if defined GA_USE_IRC
  1240. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[givemoney] 3%s (%d) given %s (%d) $%d (Current cash: $%d)", pNick(playerid), playerid, pNick(id), id, amount, GetPlayerMoney(id));
  1241. #endif
  1242. SendAdminCommand(playerid, "givemoney");
  1243. return 1;
  1244. }
  1245. }
  1246. else return 0;
  1247. }
  1248. CMD:setallmoney(playerid, params[])
  1249. {
  1250. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1251. {
  1252. new amount = strval(params);
  1253. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallmoney (amount)");
  1254. else
  1255. {
  1256. new count;
  1257. foreach(Player, i)
  1258. {
  1259. if(IsAdmin(i)) continue;
  1260. SetPlayerMoney(i, amount);
  1261. count++;
  1262. }
  1263. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators money to $%d (%d in total).", amount, count);
  1264. #if defined GA_USE_IRC
  1265. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setallmoney] 3%s (%d) set all non-administrators money to $%d.", pNick(playerid), playerid, amount);
  1266. #endif
  1267. SendAdminCommand(playerid, "setallmoney");
  1268. return 1;
  1269. }
  1270. }
  1271. else return 0;
  1272. }
  1273. CMD:giveallmoney(playerid, params[])
  1274. {
  1275. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1276. {
  1277. new amount = strval(params);
  1278. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /giveallmoney (amount)");
  1279. else
  1280. {
  1281. new count;
  1282. foreach(Player, i)
  1283. {
  1284. if(IsAdmin(i)) continue;
  1285. GivePlayerMoney(i, amount);
  1286. count++;
  1287. }
  1288. SendMSG(playerid, COLOUR_INFO, "You've given all non-administrators $%d (%d in total).", amount, count);
  1289. #if defined GA_USE_IRC
  1290. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[setmoney] 3%s (%d) gave all non-administrators $%d.", pNick(playerid), playerid, amount);
  1291. #endif
  1292. SendAdminCommand(playerid, "giveallmoney");
  1293. return 1;
  1294. }
  1295. }
  1296. else return 0;
  1297. }
  1298. CMD:sethealth(playerid, params[])
  1299. {
  1300. if(IsAdminEx(playerid, 2))
  1301. {
  1302. new id, Float:amount;
  1303. if(sscanf(params, "uf", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /sethealth (nick/id) (float: health)");
  1304. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1305. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1306. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1307. else
  1308. {
  1309. SetPlayerHealth(id, amount);
  1310. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) health to %0.2f.", pNick(id), id, amount);
  1311. SendAdminCommand(playerid, "sethealth");
  1312. return 1;
  1313. }
  1314. }
  1315. else return 0;
  1316. }
  1317. CMD:setallhealth(playerid, params[])
  1318. {
  1319. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1320. {
  1321. new Float:amount = floatstr(params);
  1322. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallhealth (float: armour)");
  1323. else
  1324. {
  1325. new count;
  1326. foreach(Player, i)
  1327. {
  1328. if(IsAdmin(i)) continue;
  1329. SetPlayerHealth(i, amount);
  1330. count++;
  1331. }
  1332. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators health to %0.2f (%d in total).", amount, count);
  1333. SendAdminCommand(playerid, "setallhealth");
  1334. return 1;
  1335. }
  1336. }
  1337. else return 0;
  1338. }
  1339. CMD:setarmour(playerid, params[])
  1340. {
  1341. if(IsAdminEx(playerid, 2))
  1342. {
  1343. new id, Float:amount;
  1344. if(sscanf(params, "uf", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setarmour (nick/id) (float: armour)");
  1345. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1346. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1347. else
  1348. {
  1349. SetPlayerArmour(id, amount);
  1350. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) armour to %0.2f.", pNick(id), id, amount);
  1351. SendAdminCommand(playerid, "setarmour");
  1352. return 1;
  1353. }
  1354. }
  1355. else return 0;
  1356. }
  1357. CMD:setallarmour(playerid, params[])
  1358. {
  1359. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1360. {
  1361. new Float:amount = floatstr(params);
  1362. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallarmour (float: armour)");
  1363. else
  1364. {
  1365. new count;
  1366. foreach(Player, i)
  1367. {
  1368. if(IsAdmin(i)) continue;
  1369. SetPlayerArmour(i, amount);
  1370. count++;
  1371. }
  1372. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators armour to %0.2f (%d in total).", amount, count);
  1373. SendAdminCommand(playerid, "setallarmour");
  1374. return 1;
  1375. }
  1376. }
  1377. else return 0;
  1378. }
  1379. CMD:setvhealth(playerid, params[])
  1380. {
  1381. if(IsAdminEx(playerid, 2))
  1382. {
  1383. new id, Float:amount;
  1384. if(sscanf(params, "uf", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setvhealth (nick/id) (float: vehicle health)");
  1385. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1386. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1387. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1388. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOUR_INFO, "This player is not in a vehicle.");
  1389. else
  1390. {
  1391. SetVehicleHealth(GetPlayerVehicleID(id), amount);
  1392. SendMSG(playerid, COLOUR_INFO, "You've set %s's (%d) vehicle health to %0.2f.", pNick(id), id, amount);
  1393. SendAdminCommand(playerid, "setvhealth");
  1394. return 1;
  1395. }
  1396. }
  1397. else return 0;
  1398. }
  1399. CMD:setallvhealth(playerid, params[])
  1400. {
  1401. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1402. {
  1403. new Float:amount = floatstr(params);
  1404. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /setallvhealth (float: vehicle health)");
  1405. else
  1406. {
  1407. new count;
  1408. foreach(Player, i)
  1409. {
  1410. if(IsAdmin(i) || !IsPlayerInAnyVehicle(i)) continue;
  1411. SetVehicleHealth(GetPlayerVehicleID(i), amount);
  1412. count++;
  1413. }
  1414. SendMSG(playerid, COLOUR_INFO, "You've set all non-administrators vehicle health to %0.2f (%d in total).", amount, count);
  1415. SendAdminCommand(playerid, "setallvhealth");
  1416. return 1;
  1417. }
  1418. }
  1419. else return 0;
  1420. }
  1421. CMD:toggleengine(playerid, params[])
  1422. {
  1423. if(IsAdminEx(playerid, 2))
  1424. {
  1425. new id, amount, engine, lights, alarm, doors, bonnet, boot, objective;
  1426. if(sscanf(params, "ud", id, amount)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleengine (nick/id) (toggle: 0/1)");
  1427. if(amount != 0 && amount != 1) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleengine (nick/id) (toggle: 0/1)");
  1428. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1429. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1430. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1431. else
  1432. {
  1433. SendMSG(playerid, COLOUR_INFO, "You've turned %s's (%d) vehicle engine %s.", pNick(id), id, Answer(amount, "on", "off"));
  1434. GetVehicleParamsEx(GetPlayerVehicleID(id), engine, lights, alarm, doors, bonnet, boot, objective);
  1435. SetVehicleParamsEx(GetPlayerVehicleID(id), amount, lights, alarm, doors, bonnet, boot, objective);
  1436. SendAdminCommand(playerid, "toggleengine");
  1437. return 1;
  1438. }
  1439. }
  1440. else return 0;
  1441. }
  1442. CMD:toggleallengines(playerid, params[])
  1443. {
  1444. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1445. {
  1446. new amount = strval(params), engine, lights, alarm, doors, bonnet, boot, objective, count;
  1447. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleallengines (toggle: 0/1)");
  1448. if(amount != 0 && amount != 1) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleallengines (toggle: 0/1)");
  1449. else
  1450. {
  1451. foreach(Player, i)
  1452. {
  1453. if(IsAdmin(i)) continue;
  1454. GetVehicleParamsEx(GetPlayerVehicleID(i), engine, lights, alarm, doors, bonnet, boot, objective);
  1455. SetVehicleParamsEx(GetPlayerVehicleID(i), amount, lights, alarm, doors, bonnet, boot, objective);
  1456. SendMSG(playerid, COLOUR_INFO, "Administrator %s (%d) has turned your vehicle engine %s.", pNick(playerid), playerid, Answer(amount, "on", "off"));
  1457. count++;
  1458. }
  1459. SendMSG(playerid, COLOUR_INFO, "You've turned %s all non-administrators vehicle engine (%d in total).", Answer(amount, "on", "off"), count);
  1460. SendAdminCommand(playerid, "toggleallengines");
  1461. return 1;
  1462. }
  1463. }
  1464. else return 0;
  1465. }
  1466. CMD:heal(playerid, params[])
  1467. {
  1468. if(IsAdminEx(playerid, 1))
  1469. {
  1470. new id, type[9];
  1471. if(sscanf(params, "uS(all)[8]", id, type)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /heal (nick/id) (type: health/armour/vehicle/all)");
  1472. if(type[8]) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /heal (nick/id) (type: health/armour/vehicle/all)");
  1473. if(strcmp(type, "health", true) && strcmp(type, "armour", true) && strcmp(type, "vehicle", true) && strcmp(type, "all", true)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /heal (nick/id) (type: health/armour/vehicle/all)");
  1474. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1475. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1476. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1477. else
  1478. {
  1479. DeCapitalize(type);
  1480. SendMSG(playerid, COLOUR_INFO, "You've healed %s (%d). Healing mode: %s", pNick(id), id, type);
  1481. if(!strcmp(type, "health"))
  1482. {
  1483. SetPlayerHealth(id, 100.0);
  1484. }
  1485. if(!strcmp(type, "armour"))
  1486. {
  1487. SetPlayerArmour(id, 100.0);
  1488. }
  1489. if(!strcmp(type, "vehicle"))
  1490. {
  1491. if(IsPlayerInAnyVehicle(id))
  1492. {
  1493. SetVehicleHealth(GetPlayerVehicleID(id), 1000.0);
  1494. RepairVehicle(GetPlayerVehicleID(id));
  1495. }
  1496. }
  1497. if(!strcmp(type, "all"))
  1498. {
  1499. SetPlayerArmour(id, 100.0);
  1500. SetPlayerHealth(id, 100.0);
  1501. if(IsPlayerInAnyVehicle(id))
  1502. {
  1503. SetVehicleHealth(GetPlayerVehicleID(id), 1000.0);
  1504. RepairVehicle(GetPlayerVehicleID(id));
  1505. }
  1506. }
  1507. SendAdminCommand(playerid, "heal");
  1508. return 1;
  1509. }
  1510. }
  1511. else return 0;
  1512. }
  1513. CMD:healall(playerid, params[])
  1514. {
  1515. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1516. {
  1517. new type[9], count;
  1518. if(sscanf(params, "S(all)[8]", type)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /healall (type: health/armour/vehicle/all)");
  1519. if(type[8]) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /heal (nick/id) (type: health/armour/vehicle/all)");
  1520. if(strcmp(type, "health", true) && strcmp(type, "armour", true) && strcmp(type, "vehicle", true) && strcmp(type, "all", true)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /heal (nick/id) (type: health/armour/vehicle/all)");
  1521. else
  1522. {
  1523. if(!strcmp(type, "health"))
  1524. {
  1525. foreach(Player, i)
  1526. {
  1527. SetPlayerHealth(i, 100.0);
  1528. count++;
  1529. }
  1530. }
  1531. if(!strcmp(type, "armour"))
  1532. {
  1533. foreach(Player, i)
  1534. {
  1535. SetPlayerArmour(i, 100.0);
  1536. count++;
  1537. }
  1538. }
  1539. if(!strcmp(type, "vehicle"))
  1540. {
  1541. foreach(Player, i)
  1542. {
  1543. if(IsPlayerInAnyVehicle(i))
  1544. {
  1545. SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
  1546. RepairVehicle(GetPlayerVehicleID(i));
  1547. count++;
  1548. }
  1549. }
  1550. }
  1551. if(!strcmp(type, "all"))
  1552. {
  1553. foreach(Player, i)
  1554. {
  1555. SetPlayerArmour(i, 100.0);
  1556. SetPlayerHealth(i, 100.0);
  1557. if(IsPlayerInAnyVehicle(i))
  1558. {
  1559. SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
  1560. RepairVehicle(GetPlayerVehicleID(i));
  1561. count++;
  1562. }
  1563. }
  1564. }
  1565. DeCapitalize(type);
  1566. SendMSG(playerid, COLOUR_INFO, "You've healed all non-administrators (%d in total). Healing mode: %s", count, type);
  1567. SendAdminCommand(playerid, "healall");
  1568. return 1;
  1569. }
  1570. }
  1571. else return 0;
  1572. }
  1573. CMD:ban(playerid, params[])
  1574. {
  1575. if(IsAdminEx(playerid, 1))
  1576. {
  1577. new id, reason[51], INI:file, filename[ACCOUNTPATH_LENGTH];
  1578. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /ban (nick/id) (optional: reason)");
  1579. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1580. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1581. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1582. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1583. else
  1584. {
  1585. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  1586. if(fexist(filename))
  1587. {
  1588. file = INI_Open(filename);
  1589. INI_WriteInt(file, "Banned", 1);
  1590. INI_Close(file);
  1591. }
  1592. BanEx2(id, ADMIN, reason, playerid);
  1593. SendAdminCommand(playerid, "ban");
  1594. return 1;
  1595. }
  1596. }
  1597. else return 0;
  1598. }
  1599. CMD:unban(playerid, params[])
  1600. {
  1601. if(IsAdminEx(playerid, 3))
  1602. {
  1603. new INI:file, File:bfile, filename[ACCOUNTPATH_LENGTH], line[128], ip[16], reason[61], kicker[8], admin[(MAX_PLAYER_NAME + 1)], user[(MAX_PLAYER_NAME + 1)], date[21];
  1604. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /unban (account)");
  1605. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(params));
  1606. if(!fexist(filename)) return SendClientMessage(playerid, COLOUR_ERROR, "This account does not exist.");
  1607. else
  1608. {
  1609. INI_ParseFile(filename, "UnbanPlayer", false, true, playerid, true, false);
  1610. if(GetPVarType(playerid, "UnbanPlayerBanned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, "This account is not banned.");
  1611. file = INI_Open(filename);
  1612. INI_WriteInt(file, "Banned", 0);
  1613. INI_Close(file);
  1614. #if defined GA_USE_SAMPBAN
  1615. format(filename, sizeof(filename), "unbanip %s", GetPVarStringEx(playerid, "UnbanPlayerIP"));
  1616. SendRconCommand(filename);
  1617. #else
  1618. bfile = fopen(BANFILE, io_read);
  1619. if(file)
  1620. {
  1621. while(fread(bfile, line, sizeof(line)))
  1622. {
  1623. sscanf(line, "p<|>s[16]s["#MAX_PLAYER_NAME"]s[60]s[7]s["#MAX_PLAYER_NAME"]s[20]", ip, user, reason, kicker, admin, date);
  1624. if(!strcmp(GetPVarStringEx(playerid, "UnbanPlayerIP"), ip, true))
  1625. {
  1626. fdelete_line(BANFILE, line);
  1627. break;
  1628. }
  1629. }
  1630. }
  1631. #endif
  1632. #if defined GA_USE_IRC
  1633. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[unban] 3%s (%d) unbanned the account %s.", pNick(playerid), playerid, params);
  1634. #endif
  1635. SendMSG(playerid, COLOUR_INFO, "You've unbanned the account %s.", params);
  1636. SendAdminCommand(playerid, "unban");
  1637. return 1;
  1638. }
  1639. }
  1640. else return 0;
  1641. }
  1642. CMD:tempban(playerid, params[])
  1643. {
  1644. if(IsAdminEx(playerid, 1))
  1645. {
  1646. new id, days, reason[51], year, month, day;
  1647. if(sscanf(params, "udS(No Reason Specified)[50]", id, days, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /tempban (nick/id) (days) (optional: reason)");
  1648. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1649. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1650. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1651. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1652. else
  1653. {
  1654. new File:tmpban = fopen(TEMPBAN, io_append);
  1655. if(tmpban)
  1656. {
  1657. getdate(year, month, day);
  1658. day += days;
  1659. switch(IsMonth31(month))
  1660. {
  1661. case 1:
  1662. {
  1663. if(day > 31)
  1664. {
  1665. month += 1;
  1666. if(month > 12)
  1667. {
  1668. year += 1;
  1669. while(day > 31) day -=31;
  1670. }
  1671. else while(day > 31) day -= 31;
  1672. }
  1673. }
  1674. case 0:
  1675. {
  1676. if(day > 30)
  1677. {
  1678. month += 1;
  1679. if(month > 12)
  1680. {
  1681. year += 1;
  1682. while(day > 30) day -= 30;
  1683. }
  1684. else while(day > 30) day -= 30;
  1685. }
  1686. if(IsMonth29(year) && month == 2)
  1687. {
  1688. if(day > 29)
  1689. {
  1690. month += 1;
  1691. if(month > 12)
  1692. {
  1693. year += 1;
  1694. while(day > 29) day -= 29;
  1695. }
  1696. else while(day > 29) day -= 29;
  1697. }
  1698. }
  1699. if(!IsMonth29(year) && month == 2)
  1700. {
  1701. if(day > 28)
  1702. {
  1703. month += 1;
  1704. if(month > 12)
  1705. {
  1706. year += 1;
  1707. while(day > 28) day -= 28;
  1708. }
  1709. else while(day > 28) day -= 28;
  1710. }
  1711. }
  1712. }
  1713. }
  1714. CMDSString = "";
  1715. new date[3], time[3];
  1716. getdate(date[2], date[1], date[0]), gettime(time[0], time[1], time[2]);
  1717. format(CMDSString, sizeof(CMDSString), "%d|%d|%d|%s|%s|%02d/%02d/%02d - %02d:%02d:%02d\n\r", day, month, year, GetPlayerIpEx(id), pNick(id), date[0], date[1], date[2], time[0], time[1], time[2]);
  1718. fwrite(tmpban, CMDSString);
  1719. fclose(tmpban);
  1720. }
  1721. #if defined GA_USE_IRC
  1722. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[tempban] 3%s (%d) temporaly banned %s (%d) for %d day%s - Expires at %d/%d/%d. Reason: %s.", pNick(playerid), playerid, pNick(id), id, days, AddS(days), day, month, year, reason);
  1723. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "*** %d DAY%s BAN: %s (%d) - Reason: %s.", days, AddS(days), pNick(id), id, reason);
  1724. #endif
  1725. SendMSG(playerid, COLOUR_INFO, "You've banned %s (%d) for %d day%s - Expires at %d/%d/%d. Reason: %s.", pNick(id), id, days, AddS(days), day, month, year, reason);
  1726. SendMSGToAll(COLOUR_ADMIN, "*** %d DAY%s BAN: %s (%d) - Reason: %s.", days, AddS(days), pNick(id), id, reason);
  1727. #if defined GA_SAVE_LOGS
  1728. format(CMDSString, sizeof(CMDSString), "%s (%d) Has Been Temporaly Banned By %s (%d) for %d day%s. Expires at %d/%d/%d. Ban Reason: %s.\n\r", pNick(id), id, pNick(playerid), playerid, days, AddS(days), day, month, year, reason);
  1729. SaveLog("/MAdmin/Logs/TempBans.txt", CMDSString);
  1730. #endif
  1731. ClearChat(0, id);
  1732. SendMSG(id, COLOUR_INFO, "You've been temporaly banned from the server for %d day%s. Expires at: %d/%d/%d. Reason: %s", days, AddS(days), day, month, year, reason);
  1733. GameTextForPlayer(id, KICK_GAMETEXT, (999999 * 999999), 3);
  1734. Kick(id);
  1735. SendAdminCommand(playerid, "tempban");
  1736. return 1;
  1737. }
  1738. }
  1739. else return 0;
  1740. }
  1741. CMD:rangeban(playerid, params[])
  1742. {
  1743. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  1744. {
  1745. new id, ranges, INI:file, filename[ACCOUNTPATH_LENGTH];
  1746. if(sscanf(params, "uD(1)", id, ranges)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /rangeban (nick/id) (optional: IP ranges)");
  1747. if(ranges < 0 || ranges > 3) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid IP range amount. The IP range must be between 1 and 3.");
  1748. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1749. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1750. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1751. else
  1752. {
  1753. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  1754. if(fexist(filename))
  1755. {
  1756. file = INI_Open(filename);
  1757. INI_WriteInt(file, "Banned", 1);
  1758. INI_Close(file);
  1759. }
  1760. #if defined GA_USE_IRC
  1761. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[rangeban] 3%s (%d) rangebanned %s (%d) - (Ranges banned: %d).", pNick(playerid), playerid, pNick(id), id, ranges);
  1762. #endif
  1763. SendMSG(playerid, COLOUR_INFO, "You've rangebanned %s (%d) [IP: %s]. Total ranges banned: %d.", pNick(id), id, GetPlayerIpEx(id), ranges);
  1764. RangeBan(id, ranges);
  1765. SendAdminCommand(playerid, "rangeban");
  1766. return 1;
  1767. }
  1768. }
  1769. else return 0;
  1770. }
  1771. /*
  1772. CMD:togglecmd(playerid, params[])
  1773. {
  1774. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  1775. {
  1776. new id, cmd[51], toggle;
  1777. if(sscanf(params, "us[50]d", id, cmd, toggle)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /togglecmd (nick/id) (command) (toggle: 0/1)");
  1778. if(cmd[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid command length. The command must be between 1 and 50 characters.");
  1779. if(toggle != 0 && toggle != 1) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /togglecmd (nick/id) (command) (toggle: 0/1)");
  1780. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1781. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1782. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1783. else
  1784. {
  1785. new bool:mode = !!toggle;
  1786. Command_SetPlayerNamed(cmd, id, mode);
  1787. #if defined GA_USE_IRC
  1788. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[togglecmd] 3%s (%d) %s the command %s for %s (%d).", pNick(playerid), playerid, Answer(toggle, "Enabled", "Disabled"), cmd, pNick(id), id);
  1789. #endif
  1790. SendMSG(playerid, COLOUR_INFO, "You've %s the command %s for %s (%d).", Answer(toggle, "Enabled", "Disabled"), cmd, pNick(id), id);
  1791. SendAdminCommand(playerid, "togglecmd");
  1792. return 1;
  1793. }
  1794. }
  1795. else return 0;
  1796. }
  1797. CMD:toggleallcmd(playerid, params[])
  1798. {
  1799. if(IsAdminEx(playerid, MAX_ADMIN_LVL))
  1800. {
  1801. new cmd[51], toggle;
  1802. if(sscanf(params, "s[50]d", cmd, toggle)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleallcmd (command) (toggle: 0/1)");
  1803. if(cmd[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid command length. The command must be between 1 and 50 characters.");
  1804. if(toggle != 0 && toggle != 1) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /toggleallcmd (command) (toggle: 0/1)");
  1805. else
  1806. {
  1807. new count, bool:mode = !!toggle;
  1808. foreach(Player, i)
  1809. {
  1810. if(IsAdmin(i)) continue;
  1811. Command_SetPlayerNamed(cmd, i, mode);
  1812. count++;
  1813. }
  1814. #if defined GA_USE_IRC
  1815. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[toggleallcmd] 3%s (%d) %s the command %s for all non-administrators.", pNick(playerid), playerid, Answer(toggle, "Enabled", "Disabled"), cmd);
  1816. #endif
  1817. SendMSG(playerid, COLOUR_INFO, "You've %s the command %s for all non-administrators.", Answer(toggle, "Enabled", "Disabled"), cmd);
  1818. SendAdminCommand(playerid, "toggleallcmd");
  1819. return 1;
  1820. }
  1821. }
  1822. else return 0;
  1823. }
  1824. */
  1825. CMD:banall(playerid, params[])
  1826. {
  1827. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1828. {
  1829. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /banall (reason)");
  1830. if(params[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1831. else
  1832. {
  1833. new count;
  1834. foreach(Player, i)
  1835. {
  1836. if(IsAdmin(i)) continue;
  1837. BanEx2(i, ADMIN, params, playerid, 0);
  1838. count++;
  1839. }
  1840. #if defined GA_USE_IRC
  1841. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[banall] 3%s (%d) banned all non-administrators. Reason: %s.", pNick(playerid), playerid, params);
  1842. #endif
  1843. SendMSG(playerid, COLOUR_INFO, "You've banned all non-administrators (%d in total). Reason: %s.", count, params);
  1844. SendAdminCommand(playerid, "banall");
  1845. return 1;
  1846. }
  1847. }
  1848. else return 0;
  1849. }
  1850. CMD:reconnect(playerid, params[])
  1851. {
  1852. if(IsAdminEx(playerid, 3))
  1853. {
  1854. new id, reason[51];
  1855. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /reconnect (nick/id) (optional: reason)");
  1856. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1857. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1858. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1859. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1860. else
  1861. {
  1862. new tmp[23];
  1863. for(new i = 0; i < 100; i++)
  1864. {
  1865. SendClientMessage(id, COLOUR_INFO, " ");
  1866. }
  1867. GameTextForPlayer(id, "~n~~g~Reconnecting to ~n~~p~"SERVER_NAME"!~n~~w~Do ~r~not ~p~quit ~w~the game!", 6000, 3);
  1868. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has forced a reconnect on you. Reason: %s.", pNick(playerid), playerid, reason);
  1869. SendMSG(playerid, COLOUR_INFO, "You've forced a reconnect on %s (%d). Reason: %s.", pNick(id), id, reason);
  1870. SendClientMessage(id, COLOUR_SAMP, "Reconnecting to "DC_INFO""SERVER_NAME""DC_SAMP"... Do not quit the game.");
  1871. format(tmp, sizeof(tmp), "banip %s", GetPlayerIpEx(id));
  1872. SendRconCommand(tmp);
  1873. SetPVarInt(id, "Relogin", 1);
  1874. SendAdminCommand(playerid, "reconnect");
  1875. return 1;
  1876. }
  1877. }
  1878. else return 0;
  1879. }
  1880. CMD:reconnectall(playerid, params[])
  1881. {
  1882. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1883. {
  1884. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /reconnectall (reason)");
  1885. if(params[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1886. else
  1887. {
  1888. new count, tmp[23];
  1889. foreach(Player, i)
  1890. {
  1891. if(IsAdmin(i)) continue;
  1892. GameTextForPlayer(i, "~n~~g~Reconnecting to ~n~~p~"SERVER_NAME"!~n~~w~Do ~r~not ~p~quit ~w~the game!", 6000, 3);
  1893. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has forced a reconnect on you. Reason: %s.", pNick(playerid), playerid, params);
  1894. SendClientMessage(i, COLOUR_SAMP, "Reconnecting to "DC_INFO""SERVER_NAME""DC_SAMP"... Do not quit the game.");
  1895. format(tmp, sizeof(tmp), "banip %s", GetPlayerIpEx(i));
  1896. SendRconCommand(tmp);
  1897. SetPVarInt(i, "Relogin", 1);
  1898. count++;
  1899. }
  1900. SendMSG(playerid, COLOUR_INFO, "You've reconnected all non-administrators (%d in total). Reason: %s.", count, params);
  1901. #if defined GA_USE_IRC
  1902. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[reconnectall] 3%s (%d) reconnected all non-administrators. Reason: %s.", pNick(playerid), playerid, params);
  1903. #endif
  1904. SendAdminCommand(playerid, "reconnectall");
  1905. return 1;
  1906. }
  1907. }
  1908. else return 0;
  1909. }
  1910. CMD:kick(playerid, params[])
  1911. {
  1912. if(IsAdminEx(playerid, 1))
  1913. {
  1914. new id, reason[51];
  1915. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /kick (nick/id) (optional: reason)");
  1916. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1917. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1918. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1919. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1920. else
  1921. {
  1922. KickEx(id, ADMIN, reason, playerid);
  1923. SendAdminCommand(playerid, "kick");
  1924. return 1;
  1925. }
  1926. }
  1927. else return 0;
  1928. }
  1929. CMD:kickall(playerid, params[])
  1930. {
  1931. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1932. {
  1933. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /kickall (reason)");
  1934. if(params[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1935. else
  1936. {
  1937. new count;
  1938. foreach(Player, i)
  1939. {
  1940. if(IsAdmin(i)) continue;
  1941. KickEx(i, ADMIN, params, playerid, 0);
  1942. count++;
  1943. }
  1944. SendMSG(playerid, COLOUR_INFO, "You've kicked all non-administrators (%d in total). Reason: %s.", count, params);
  1945. #if defined GA_USE_IRC
  1946. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[kickall] 3%s (%d) kicked all non-administrators. Reason: %s.", pNick(playerid), playerid, params);
  1947. #endif
  1948. SendAdminCommand(playerid, "kickall");
  1949. return 1;
  1950. }
  1951. }
  1952. else return 0;
  1953. }
  1954. CMD:cage(playerid, params[])
  1955. {
  1956. if(IsAdminEx(playerid, 1))
  1957. {
  1958. new id, reason[51], seconds;
  1959. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /cage (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  1960. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1961. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  1962. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  1963. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  1964. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  1965. else
  1966. {
  1967. CageTime[id][0] = GetTickCount(), CageTime[id][1] = seconds;
  1968. CagePlayer(id);
  1969. SetPVarInt(id, "Caged", 1);
  1970. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has caged you. Reason: %s.", pNick(playerid), playerid, reason);
  1971. SendMSG(playerid, COLOUR_INFO, "You've caged %s (%d). Reason: %s.", pNick(id), id, reason);
  1972. #if defined GA_USE_IRC
  1973. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_CAGE"", pNick(id), id, reason);
  1974. #endif
  1975. SendMSGToAll(COLOUR_ADMIN, ADMIN_CAGE, pNick(id), id, reason);
  1976. SendAdminCommand(playerid, "cage");
  1977. return 1;
  1978. }
  1979. }
  1980. else return 0;
  1981. }
  1982. CMD:cageall(playerid, params[])
  1983. {
  1984. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  1985. {
  1986. new reason[51], seconds;
  1987. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /cageall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  1988. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  1989. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  1990. else
  1991. {
  1992. new count;
  1993. foreach(Player, i)
  1994. {
  1995. if(IsAdmin(i)) continue;
  1996. CageTime[i][0] = GetTickCount(), CageTime[i][1] = seconds;
  1997. CagePlayer(i);
  1998. SetPVarInt(i, "Caged", 1);
  1999. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has caged you. Reason: %s.", pNick(playerid), playerid, reason);
  2000. count++;
  2001. }
  2002. SendMSG(playerid, COLOUR_INFO, "You've caged all non-administrators (%d in total). Reason: %s.", count, reason);
  2003. SendAdminCommand(playerid, "cageall");
  2004. return 1;
  2005. }
  2006. }
  2007. else return 0;
  2008. }
  2009. CMD:uncage(playerid, params[])
  2010. {
  2011. if(IsAdminEx(playerid, 1))
  2012. {
  2013. new id;
  2014. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /uncage (nick/id)");
  2015. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2016. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2017. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2018. else
  2019. {
  2020. CageTime[id][1] = 0;
  2021. UncagePlayer(id);
  2022. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has uncaged you.", pNick(playerid), playerid);
  2023. SendMSG(playerid, COLOUR_INFO, "You've uncaged %s (%d).", pNick(id), id);
  2024. DeletePVar(id, "Caged");
  2025. #if defined GA_USE_IRC
  2026. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNCAGE"", pNick(id), id);
  2027. #endif
  2028. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNCAGE, pNick(id), id);
  2029. SendAdminCommand(playerid, "uncage");
  2030. return 1;
  2031. }
  2032. }
  2033. else return 0;
  2034. }
  2035. CMD:uncageall(playerid, params[])
  2036. {
  2037. #pragma unused params
  2038. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2039. {
  2040. new count;
  2041. foreach(Player, i)
  2042. {
  2043. if(IsAdmin(i) || GetPVarInt(i, "Caged") == PLAYER_VARTYPE_NONE) continue;
  2044. CageTime[i][1] = 0;
  2045. UncagePlayer(i);
  2046. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has uncaged you.", pNick(playerid), playerid);
  2047. DeletePVar(i, "Caged");
  2048. count++;
  2049. }
  2050. SendMSG(playerid, COLOUR_INFO, "You've uncaged all non-administrators (%d in total).", count);
  2051. SendAdminCommand(playerid, "uncageall");
  2052. return 1;
  2053. }
  2054. else return 0;
  2055. }
  2056. CMD:freeze(playerid, params[])
  2057. {
  2058. if(IsAdminEx(playerid, 1))
  2059. {
  2060. new id, reason[51], seconds;
  2061. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /freeze (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2062. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2063. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2064. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2065. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2066. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2067. else
  2068. {
  2069. FreezeTime[id][0] = GetTickCount(), FreezeTime[id][1] = seconds;
  2070. TogglePlayerControllable(id, 0);
  2071. SetPVarInt(id, "Frozen", 1);
  2072. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has frozen you. Reason: %s.", pNick(playerid), playerid, reason);
  2073. SendMSG(playerid, COLOUR_INFO, "You've frozen %s (%d). Reason: %s.", pNick(id), id, reason);
  2074. #if defined GA_USE_IRC
  2075. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_FREEZE"", pNick(id), id, reason);
  2076. #endif
  2077. SendMSGToAll(COLOUR_ADMIN, ADMIN_FREEZE, pNick(id), id, reason);
  2078. SendAdminCommand(playerid, "freeze");
  2079. return 1;
  2080. }
  2081. }
  2082. else return 0;
  2083. }
  2084. CMD:freezeall(playerid, params[])
  2085. {
  2086. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2087. {
  2088. new reason[51], seconds;
  2089. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /freezeall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2090. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2091. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2092. else
  2093. {
  2094. new count;
  2095. foreach(Player, i)
  2096. {
  2097. FreezeTime[i][0] = GetTickCount(), FreezeTime[i][1] = seconds;
  2098. TogglePlayerControllable(i, 0);
  2099. SetPVarInt(i, "Frozen", 1);
  2100. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has frozen you. Reason: %s.", pNick(playerid), playerid, reason);
  2101. count++;
  2102. }
  2103. SendMSG(playerid, COLOUR_INFO, "You've frozen all non-administrators (%d in total). Reason: %s.", count, reason);
  2104. SendAdminCommand(playerid, "freezeall");
  2105. return 1;
  2106. }
  2107. }
  2108. else return 0;
  2109. }
  2110. CMD:unfreeze(playerid, params[])
  2111. {
  2112. if(IsAdminEx(playerid, 1))
  2113. {
  2114. new id;
  2115. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /unfreeze (nick/id)");
  2116. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2117. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2118. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2119. else
  2120. {
  2121. FreezeTime[id][1] = 0;
  2122. TogglePlayerControllable(id, 1);
  2123. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has unfrozen you.", pNick(playerid), playerid);
  2124. SendMSG(playerid, COLOUR_INFO, "You've unfrozen %s (%d).", pNick(id), id);
  2125. DeletePVar(id, "Frozen");
  2126. #if defined GA_USE_IRC
  2127. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNFREEZE"", pNick(id), id);
  2128. #endif
  2129. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNFREEZE, pNick(id), id);
  2130. SendAdminCommand(playerid, "unfreeze");
  2131. return 1;
  2132. }
  2133. }
  2134. else return 0;
  2135. }
  2136. CMD:unfreezeall(playerid, params[])
  2137. {
  2138. #pragma unused params
  2139. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2140. {
  2141. new count;
  2142. foreach(Player, i)
  2143. {
  2144. if(IsAdmin(i) || GetPVarInt(i, "Frozen") == PLAYER_VARTYPE_NONE) continue;
  2145. FreezeTime[i][1] = 0;
  2146. TogglePlayerControllable(i, 1);
  2147. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has unfrozen you.", pNick(playerid), playerid);
  2148. DeletePVar(i, "Frozen");
  2149. count++;
  2150. }
  2151. SendMSG(playerid, COLOUR_INFO, "You've unfrozen all non-administrators (%d in total).", count);
  2152. SendAdminCommand(playerid, "unfreezeall");
  2153. return 1;
  2154. }
  2155. else return 0;
  2156. }
  2157. CMD:spectate(playerid, params[])
  2158. {
  2159. if(IsAdminEx(playerid, 1))
  2160. {
  2161. new id;
  2162. if(sscanf(params, "u", id) && GetPVarInt(playerid, "Spectating") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /spectate (nick/id)");
  2163. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2164. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2165. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2166. if(id == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2167. if(GetPVarType(playerid, "Spectating") == PLAYER_VARTYPE_NONE)
  2168. {
  2169. new Float:Pos;
  2170. GetPlayerFacingAngle(playerid, Pos);
  2171. SetPVarInt(playerid, "Spectating", 1);
  2172. SetPVarInt(playerid, "SpectatingPlayer", id);
  2173. SetPVarFloat(playerid, "OldPosX", GX(playerid));
  2174. SetPVarFloat(playerid, "OldPosY", GY(playerid));
  2175. SetPVarFloat(playerid, "OldPosZ", GZ(playerid));
  2176. SetPVarFloat(playerid, "OldAngle", Pos);
  2177. SetPVarInt(playerid, "OldWorld", GetPlayerVirtualWorld(playerid));
  2178. SetPVarInt(playerid, "OldInterior", GetPlayerVirtualWorld(playerid));
  2179. SetPlayerInterior(playerid, GetPlayerInterior(id));
  2180. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
  2181. TogglePlayerSpectating(playerid, 1);
  2182. switch(IsPlayerInAnyVehicle(id))
  2183. {
  2184. case 0: PlayerSpectatePlayer(playerid, id);
  2185. case 1: PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
  2186. }
  2187. SendMSG(playerid, COLOUR_INFO, "You're now spectating %s (%d).", pNick(id), id);
  2188. SendAdminCommand(playerid, "spectate");
  2189. return 1;
  2190. }
  2191. if(GetPVarInt(playerid, "Spectating") == 1)
  2192. {
  2193. DeletePVar(playerid, "Spectating");
  2194. DeletePVar(playerid, "SpectatingPlayer");
  2195. TogglePlayerSpectating(playerid, 0);
  2196. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "OldWorld"));
  2197. SetPlayerInterior(playerid, GetPVarInt(playerid, "OldInterior"));
  2198. SetPlayerPos(playerid, GetPVarFloat(playerid, "OldPosX"), GetPVarFloat(playerid, "OldPosY"), GetPVarFloat(playerid, "OldPosZ"));
  2199. SetPlayerFacingAngle(playerid, GetPVarFloat(playerid, "OldAngle"));
  2200. SendMSG(playerid, COLOUR_INFO, "You've stopped spectating %s (%d).", pNick(id), id);
  2201. return 1;
  2202. }
  2203. return 1;
  2204. }
  2205. else return 0;
  2206. }
  2207. CMD:warn(playerid, params[])
  2208. {
  2209. if(IsAdminEx(playerid, 1))
  2210. {
  2211. new id, reason[51];
  2212. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /warn (nick/id) (optional: reason)");
  2213. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2214. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2215. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2216. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2217. else
  2218. {
  2219. UpdatePVarInt(id, "Warnings", 1);
  2220. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has given you a warning. Total warnings: %d/"#MAX_WARNINGS". Reason: %s.", pNick(playerid), playerid, GetPVarInt(id, "Warnings"), reason);
  2221. SendMSG(playerid, COLOUR_INFO, "You've given %s (%d) a warning. Reason: %s.", pNick(id), id, reason);
  2222. #if defined GA_USE_IRC
  2223. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_WARN"", pNick(id), id, reason);
  2224. #endif
  2225. SendMSGToAll(COLOUR_ADMIN, ADMIN_WARN, pNick(id), id, reason);
  2226. if(GetPVarInt(id, "Warnings") == MAX_WARNINGS)
  2227. {
  2228. switch(WARN_ACTION)
  2229. {
  2230. case 0: KickEx(id, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  2231. case 1: BanEx2(id, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  2232. }
  2233. }
  2234. SendAdminCommand(playerid, "warn");
  2235. return 1;
  2236. }
  2237. }
  2238. else return 0;
  2239. }
  2240. CMD:warnall(playerid, params[])
  2241. {
  2242. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2243. {
  2244. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /warnall (reason)");
  2245. if(params[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2246. else
  2247. {
  2248. new count;
  2249. foreach(Player, i)
  2250. {
  2251. if(IsAdmin(i)) continue;
  2252. UpdatePVarInt(i, "Warnings", 1);
  2253. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has given you a warning. Total warnings: %d/"#MAX_WARNINGS". Reason: %s.", pNick(playerid), playerid, GetPVarInt(i, "Warnings"), params);
  2254. if(GetPVarInt(i, "Warnings") == MAX_WARNINGS)
  2255. {
  2256. switch(WARN_ACTION)
  2257. {
  2258. case 0: KickEx(i, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  2259. case 1: BanEx2(i, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  2260. }
  2261. }
  2262. count++;
  2263. }
  2264. SendMSG(playerid, COLOUR_INFO, "You've given all non-administrators on the server a warning (%d players). Reason: %s.", count, params);
  2265. SendAdminCommand(playerid, "warnall");
  2266. return 1;
  2267. }
  2268. }
  2269. else return 0;
  2270. }
  2271. CMD:clearallwarnings(playerid, params[])
  2272. {
  2273. #pragma unused params
  2274. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2275. {
  2276. new count;
  2277. foreach(Player, i)
  2278. {
  2279. if(GetPVarType(i, "Warnings") == PLAYER_VARTYPE_NONE || IsAdmin(i)) continue;
  2280. DeletePVar(i, "Warnings");
  2281. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has removed all your warnings.", pNick(playerid), playerid);
  2282. count++;
  2283. }
  2284. SendMSG(playerid, COLOUR_INFO, "You've removed the warnings for all non-administrators (%d in total).", count);
  2285. SendAdminCommand(playerid, "clearallwarnings");
  2286. return 1;
  2287. }
  2288. else return 0;
  2289. }
  2290. CMD:clearwarnings(playerid, params[])
  2291. {
  2292. if(IsAdminEx(playerid, 1))
  2293. {
  2294. new id;
  2295. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /clearwarnings (nick/id)");
  2296. if(GetPVarType(id, "Warnings") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, "This player do not have any warnings to clear.");
  2297. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2298. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2299. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2300. else
  2301. {
  2302. DeletePVar(id, "Warnings");
  2303. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has removed all your warnings.", pNick(playerid), playerid);
  2304. SendMSG(playerid, COLOUR_INFO, "You've removed %s's (%d) warnings.", pNick(id), id);
  2305. SendAdminCommand(playerid, "clearwarnings");
  2306. return 1;
  2307. }
  2308. }
  2309. else return 0;
  2310. }
  2311. CMD:mute(playerid, params[])
  2312. {
  2313. if(IsAdminEx(playerid, 1))
  2314. {
  2315. new id, reason[51], seconds;
  2316. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /mute (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2317. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2318. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2319. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2320. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2321. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2322. else
  2323. {
  2324. MuteTime[id][0] = GetTickCount(), MuteTime[id][1] = seconds;
  2325. SetPVarInt(id, "Muted", 1);
  2326. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has muted you. Reason: %s.", pNick(playerid), playerid, reason);
  2327. SendMSG(playerid, COLOUR_INFO, "You've muted %s (%d). Reason: %s.", pNick(id), id, reason);
  2328. #if defined GA_USE_IRC
  2329. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_MUTE"", pNick(id), id, reason);
  2330. #endif
  2331. SendMSGToAll(COLOUR_ADMIN, ADMIN_MUTE, pNick(id), id, reason);
  2332. SendAdminCommand(playerid, "mute");
  2333. return 1;
  2334. }
  2335. }
  2336. else return 0;
  2337. }
  2338. CMD:unmute(playerid, params[])
  2339. {
  2340. if(IsAdminEx(playerid, 1))
  2341. {
  2342. new id;
  2343. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /unmute (nick/id)");
  2344. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2345. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2346. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2347. else
  2348. {
  2349. MuteTime[id][1] = 0;
  2350. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has unmuted you.", pNick(playerid), playerid);
  2351. SendMSG(playerid, COLOUR_INFO, "You've unmuted %s (%d).", pNick(id), id);
  2352. DeletePVar(id, "Muted");
  2353. #if defined GA_USE_IRC
  2354. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNMUTE"", pNick(id), id);
  2355. #endif
  2356. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNMUTE, pNick(id), id);
  2357. SendAdminCommand(playerid, "unmute");
  2358. return 1;
  2359. }
  2360. }
  2361. else return 0;
  2362. }
  2363. CMD:muteall(playerid, params[])
  2364. {
  2365. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2366. {
  2367. new reason[51], seconds;
  2368. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /muteall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2369. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2370. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2371. else
  2372. {
  2373. new count;
  2374. foreach(Player, i)
  2375. {
  2376. if(IsAdmin(i)) continue;
  2377. MuteTime[i][0] = GetTickCount(), MuteTime[i][1] = seconds;
  2378. SetPVarInt(i, "Muted", 1);
  2379. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has muted you. Reason: %s.", pNick(playerid), playerid, reason);
  2380. count++;
  2381. }
  2382. SendMSG(playerid, COLOUR_INFO, "You've muted all non-administrators (%d in total). Reason: %s.", count, reason);
  2383. SendAdminCommand(playerid, "muteall");
  2384. return 1;
  2385. }
  2386. }
  2387. else return 0;
  2388. }
  2389. CMD:unmuteall(playerid, params[])
  2390. {
  2391. #pragma unused params
  2392. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2393. {
  2394. new count;
  2395. foreach(Player, i)
  2396. {
  2397. if(IsAdmin(i) || GetPVarInt(i, "Muted") == PLAYER_VARTYPE_NONE) continue;
  2398. MuteTime[i][1] = 0;
  2399. SetPVarInt(i, "Muted", 1);
  2400. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has unmuted you.", pNick(playerid), playerid);
  2401. }
  2402. SendMSG(playerid, COLOUR_INFO, "You've unmuted all non-administrators (%d in total).", count);
  2403. SendAdminCommand(playerid, "unmuteall");
  2404. return 1;
  2405. }
  2406. else return 0;
  2407. }
  2408. CMD:godmode(playerid, params[])
  2409. {
  2410. if(IsAdminEx(playerid, 1))
  2411. {
  2412. new amount = strval(params);
  2413. if(isnull(params) || (amount != 0 && amount != 1)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /godmode (toggle: 0/1)");
  2414. if(GodMode{playerid} == amount)
  2415. {
  2416. SendMSG(playerid, COLOUR_ERROR, "You have already %s godmode.", Answer(amount, "enabled", "disabled"));
  2417. return 0;
  2418. }
  2419. else
  2420. {
  2421. switch(amount)
  2422. {
  2423. case 0: SendClientMessage(playerid, COLOUR_INFO, "Godmode disabled. Type /godmode 1 to enable it.");
  2424. case 1: SendClientMessage(playerid, COLOUR_INFO, "Godmode enabled. Type /godmode 0 to disable it.");
  2425. }
  2426. GodMode{playerid} = amount;
  2427. SendAdminCommand(playerid, "godmode");
  2428. return 1;
  2429. }
  2430. }
  2431. else return 0;
  2432. }
  2433. CMD:disarm(playerid, params[])
  2434. {
  2435. if(IsAdminEx(playerid, 1))
  2436. {
  2437. new id, reason[51], seconds;
  2438. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /disarm (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2439. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2440. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2441. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2442. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2443. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2444. else
  2445. {
  2446. DisarmTime[id][0] = GetTickCount(), DisarmTime[id][1] = seconds;
  2447. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has disarmed you. Reason: %s.", pNick(playerid), playerid, reason);
  2448. SendMSG(playerid, COLOUR_INFO, "You've disarmed %s (%d). Reason: %s.", pNick(id), id, reason);
  2449. IsDisarmed{id} = 1;
  2450. SendAdminCommand(playerid, "disarm");
  2451. return 1;
  2452. }
  2453. }
  2454. else return 0;
  2455. }
  2456. CMD:disarmall(playerid, params[])
  2457. {
  2458. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2459. {
  2460. new reason[51], seconds;
  2461. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /disarmall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  2462. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2463. if(seconds < 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  2464. else
  2465. {
  2466. new count;
  2467. foreach(Player, i)
  2468. {
  2469. if(IsAdmin(i)) continue;
  2470. DisarmTime[i][0] = GetTickCount(), DisarmTime[i][1] = seconds;
  2471. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has disarmed you. Reason: %s.", pNick(playerid), playerid, reason);
  2472. IsDisarmed{i} = 1;
  2473. count++;
  2474. }
  2475. SendMSG(playerid, COLOUR_INFO, "You've disarmed all non-administrators (%d in total). Reason: %s.", count, reason);
  2476. SendAdminCommand(playerid, "disarmall");
  2477. return 1;
  2478. }
  2479. }
  2480. else return 0;
  2481. }
  2482. CMD:dedisarmall(playerid, params[])
  2483. {
  2484. #pragma unused params
  2485. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2486. {
  2487. new count;
  2488. foreach(Player, i)
  2489. {
  2490. if(IsAdmin(i) || !IsDisarmed{i}) continue;
  2491. DisarmTime[i][1] = 0;
  2492. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) have de-disarmed you.", pNick(playerid), playerid);
  2493. IsDisarmed{i} = 0;
  2494. count++;
  2495. }
  2496. SendMSG(playerid, COLOUR_INFO, "You've de-disarmed all non-administrators (%d in total).", count);
  2497. SendAdminCommand(playerid, "dedisarmall");
  2498. return 1;
  2499. }
  2500. else return 0;
  2501. }
  2502. CMD:dedisarm(playerid, params[])
  2503. {
  2504. if(IsAdminEx(playerid, 1))
  2505. {
  2506. new id;
  2507. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /dedisarm (nick/id)");
  2508. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2509. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2510. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2511. else
  2512. {
  2513. DisarmTime[id][1] = 0;
  2514. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) have de-disarmed you.", pNick(playerid), playerid);
  2515. SendMSG(playerid, COLOUR_INFO, "You've de-disarmed %s (%d).", pNick(id), id);
  2516. IsDisarmed{id} = 0;
  2517. SendAdminCommand(playerid, "dedisarm");
  2518. return 1;
  2519. }
  2520. }
  2521. else return 0;
  2522. }
  2523. CMD:giveweapon(playerid, params[])
  2524. {
  2525. if(IsAdminEx(playerid, 1))
  2526. {
  2527. new id, weapon[21], ammo;
  2528. if(sscanf(params, "us[20]d", id, weapon, ammo)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /giveweapon (nick/id) (weapon name) (ammo)");
  2529. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2530. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2531. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2532. if(GetWeaponIDFromName(weapon) == -1) return SendClientMessage(playerid, COLOUR_ERROR, "Multiple weapon mames found. Please be more specific.");
  2533. if(GetWeaponIDFromName(weapon) == -2 || weapon[20]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid weapon name.");
  2534. else
  2535. {
  2536. switch(GetWeaponIDFromName(weapon))
  2537. {
  2538. case 1, 10..13, 17..18, 35..39, 42..45:
  2539. {
  2540. switch(IsAdmin(id))
  2541. {
  2542. case 0: return SendClientMessage(playerid, COLOUR_ERROR, "You can not give this weapon to this player.");
  2543. case 1: GivePlayerWeapon(id, GetWeaponIDFromName(weapon), ammo);
  2544. }
  2545. }
  2546. default:
  2547. {
  2548. GivePlayerWeapon(id, GetWeaponIDFromName(weapon), ammo);
  2549. }
  2550. }
  2551. new weapname[32];
  2552. GetWeaponName(GetWeaponIDFromName(weapon), weapname, sizeof(weapname));
  2553. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has given you a %s (ID: %d) with %d ammo.", pNick(playerid), playerid, weapname, GetWeaponIDFromName(weapname), ammo);
  2554. SendMSG(playerid, COLOUR_INFO, "You've given %s (%d) a %s (ID: %d) with %d ammo.", pNick(id), id, weapname, GetWeaponIDFromName(weapname), ammo);
  2555. SendAdminCommand(playerid, "giveweapon");
  2556. }
  2557. return 1;
  2558. }
  2559. else return 0;
  2560. }
  2561. CMD:giveallweapon(playerid, params[])
  2562. {
  2563. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2564. {
  2565. new weapon[21], ammo;
  2566. if(sscanf(params, "s[20]d", weapon, ammo)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /giveweapon (weapon name) (ammo)");
  2567. if(GetWeaponIDFromName(weapon) == -1) return SendClientMessage(playerid, COLOUR_ERROR, "Multiple weapon mames found. Please be more specific.");
  2568. if(GetWeaponIDFromName(weapon) == -2 || weapon[20]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid weapon name.");
  2569. else
  2570. {
  2571. switch(GetWeaponIDFromName(weapon))
  2572. {
  2573. case 1, 10..13, 17..18, 35..39, 42..45:
  2574. {
  2575. foreach(Player, i)
  2576. {
  2577. switch(IsAdmin(i))
  2578. {
  2579. case 1: GivePlayerWeapon(i, GetWeaponIDFromName(weapon), ammo);
  2580. }
  2581. }
  2582. }
  2583. default:
  2584. {
  2585. foreach(Player, i)
  2586. {
  2587. GivePlayerWeapon(i, GetWeaponIDFromName(weapon), ammo);
  2588. }
  2589. }
  2590. }
  2591. new weapname[32];
  2592. GetWeaponName(GetWeaponIDFromName(weapon), weapname, sizeof(weapname));
  2593. SendMSGToAll(COLOUR_INFO, "Administrator %s (%d) has given everyone on the server a %s (ID: %d) with %d ammo.", pNick(playerid), playerid, weapname, GetWeaponIDFromName(weapname), ammo);
  2594. SendAdminCommand(playerid, "giveallweapon");
  2595. }
  2596. return 1;
  2597. }
  2598. else return 0;
  2599. }
  2600. CMD:crash(playerid, params[])
  2601. {
  2602. if(IsAdminEx(playerid, 4))
  2603. {
  2604. new id;
  2605. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /crash (nick/id)");
  2606. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2607. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2608. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2609. else
  2610. {
  2611. #if defined GA_USE_IRC
  2612. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[crash] 3%s (%d) crashed %s's (%d) game.", pNick(playerid), playerid, pNick(id), id);
  2613. #endif
  2614. SendMSG(playerid, COLOUR_INFO, "You've crashed %s's (%d) game.", pNick(id), id);
  2615. ApplyAnimation(id, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, (5 * 1000));
  2616. SendAdminCommand(playerid, "crash");
  2617. return 1;
  2618. }
  2619. }
  2620. else return 0;
  2621. }
  2622. CMD:crashall(playerid, params[])
  2623. {
  2624. #pragma unused params
  2625. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2626. {
  2627. new count;
  2628. foreach(Player, i)
  2629. {
  2630. if(IsAdmin(i)) continue;
  2631. ApplyAnimation(i, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, (5 * 1000));
  2632. count++;
  2633. }
  2634. #if defined GA_USE_IRC
  2635. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[crash] 3%s (%d) crashed all non-administrators game.", pNick(playerid), playerid);
  2636. #endif
  2637. SendMSG(playerid, COLOUR_INFO, "You've crashed the game for all non-administrators (%d in total).", count);
  2638. SendAdminCommand(playerid, "crashall");
  2639. return 1;
  2640. }
  2641. else return 0;
  2642. }
  2643. CMD:slap(playerid, params[])
  2644. {
  2645. if(IsAdminEx(playerid, 1))
  2646. {
  2647. new id, Float:amount, reason[51];
  2648. if(sscanf(params, "uF(10.0)S(No Reason Specified)[50]", id, amount, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /slap (nick/id) (optional: amount) (optional: reason)");
  2649. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2650. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2651. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2652. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2653. else
  2654. {
  2655. SetPlayerPos(id, GX(id), GY(id), (GZ(id) + amount));
  2656. SendMSG(playerid, COLOUR_INFO, "You've slapped %s (%d). Reason: %s.", pNick(id), id, reason);
  2657. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has slapped you. Reason: %s.", pNick(playerid), playerid, reason);
  2658. SendAdminCommand(playerid, "slap");
  2659. return 1;
  2660. }
  2661. }
  2662. else return 0;
  2663. }
  2664. CMD:slapall(playerid, params[])
  2665. {
  2666. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2667. {
  2668. new Float:amount, reason[51];
  2669. if(sscanf(params, "F(10.0)S(No Reason Specified)[50]", amount, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /slapall (optional: amount) (optional: reason)");
  2670. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2671. else
  2672. {
  2673. new count;
  2674. foreach(Player, i)
  2675. {
  2676. if(IsAdmin(i)) continue;
  2677. SetPlayerPos(i, GX(i), GY(i), (GZ(i) + amount));
  2678. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has slapped you. Reason: %s.", pNick(playerid), playerid, reason);
  2679. count++;
  2680. }
  2681. SendMSG(playerid, COLOUR_INFO, "You've slapped all non-administrators (%d in total). Reason: %s.", count, reason);
  2682. SendAdminCommand(playerid, "slapall");
  2683. return 1;
  2684. }
  2685. }
  2686. else return 0;
  2687. }
  2688. CMD:akill(playerid, params[])
  2689. {
  2690. if(IsAdminEx(playerid, 3))
  2691. {
  2692. new id, reason[51];
  2693. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /akill (nick/id) (optional: reason)");
  2694. if(reason[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2695. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2696. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2697. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2698. else
  2699. {
  2700. SetPlayerHealth(id, 0.00);
  2701. SendMSG(id, COLOUR_INFO, "Administrator %s (%d) has admin-killed you. Reason: %s.", pNick(playerid), playerid, reason);
  2702. SendMSG(playerid, COLOUR_INFO, "You've admin-killed %s (%d). Reason: %s.", pNick(id), id, reason);
  2703. SendAdminCommand(playerid, "akill");
  2704. return 1;
  2705. }
  2706. }
  2707. else return 0;
  2708. }
  2709. CMD:akillall(playerid, params[])
  2710. {
  2711. if(IsAdminEx(playerid, ALL_CMDS_LVL))
  2712. {
  2713. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /akillall (reason)");
  2714. if(params[50]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 50 characters.");
  2715. else
  2716. {
  2717. new count;
  2718. foreach(Player, i)
  2719. {
  2720. if(IsAdmin(i)) continue;
  2721. SetPlayerHealth(i, 0.00);
  2722. SendMSG(i, COLOUR_INFO, "Administrator %s (%d) has admin-killed you. Reason: %s.", pNick(playerid), playerid, params);
  2723. }
  2724. SendMSG(playerid, COLOUR_INFO, "You've admin-killed all non-administrators (%d in total). Reason: %s.", count, params);
  2725. SendAdminCommand(playerid, "akillall");
  2726. return 1;
  2727. }
  2728. }
  2729. else return 0;
  2730. }
  2731. CMD:up(playerid, params[])
  2732. {
  2733. new Float:amount = floatstr(params);
  2734. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /up (float: amount)");
  2735. if(strval(params) <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /down instead.");
  2736. return SetPlayerPosEx(playerid, GX(playerid), GY(playerid), (GZ(playerid) + amount));
  2737. }
  2738. CMD:down(playerid, params[])
  2739. {
  2740. new Float:amount = floatstr(params);
  2741. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /down (float: amount)");
  2742. if(strval(params) <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /up instead.");
  2743. return SetPlayerPosEx(playerid, GX(playerid), GY(playerid), (GZ(playerid) - amount));
  2744. }
  2745. CMD:north(playerid, params[])
  2746. {
  2747. new Float:amount = floatstr(params);
  2748. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /north (float: amount)");
  2749. if(strval(params) <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /south intstead.");
  2750. return SetPlayerPosEx(playerid, GX(playerid), (GY(playerid) + amount), GZ(playerid));
  2751. }
  2752. CMD:south(playerid, params[])
  2753. {
  2754. new Float:amount = floatstr(params);
  2755. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /south (float: amount)");
  2756. if(strval(params) <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /north instead.");
  2757. return SetPlayerPosEx(playerid, GX(playerid), (GY(playerid) - amount), GZ(playerid));
  2758. }
  2759. CMD:east(playerid, params[])
  2760. {
  2761. new Float:amount = floatstr(params);
  2762. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /east (float: amount)");
  2763. if(strval(params) <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /west instead.");
  2764. return SetPlayerPosEx(playerid, (GX(playerid) + amount), GY(playerid), GZ(playerid));
  2765. }
  2766. CMD:west(playerid, params[])
  2767. {
  2768. new Float:amount = floatstr(params);
  2769. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /west (float: amount)");
  2770. if(amount <= 0.0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid amount. Use /east instead.");
  2771. return SetPlayerPosEx(playerid, (GX(playerid) - amount), GY(playerid), GZ(playerid));
  2772. }
  2773. CMD:goto(playerid, params[])
  2774. {
  2775. if(IsAdminEx(playerid, 1))
  2776. {
  2777. new id;
  2778. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /goto (nick/id)");
  2779. if(GetPVarType(playerid, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED1);
  2780. if(!IsPlayerConnected(id) || (IsPlayerNPC(id) && IsPlayerAdmin(playerid))) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2781. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2782. if(id == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2783. else
  2784. {
  2785. new interior = GetPlayerInterior(id), world = GetPlayerVirtualWorld(id), vehicleid = GetPlayerVehicleID(playerid), Float:Pos[3];
  2786. GetPlayerPos(id, Pos[0], Pos[1], Pos[2]), SetPlayerVirtualWorld(playerid, world), SetPlayerInterior(playerid, interior);
  2787. switch(IsPlayerInAnyVehicle(playerid))
  2788. {
  2789. case 0: SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  2790. case 1: SetVehiclePos(vehicleid, Pos[0], Pos[1], (Pos[2] + 2)), LinkVehicleToInterior(vehicleid, interior), SetVehicleVirtualWorld(vehicleid, world);
  2791. }
  2792. SendAdminCommand(playerid, "goto");
  2793. }
  2794. return 1;
  2795. }
  2796. else return 0;
  2797. }
  2798. CMD:gotop(playerid, params[])
  2799. {
  2800. if(IsAdminEx(playerid, 1))
  2801. {
  2802. new id;
  2803. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /getp (nick/id)");
  2804. if(GetPVarType(playerid, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED1);
  2805. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2806. if(!IsPlayerConnected(id) || (IsPlayerNPC(id) && IsPlayerAdmin(playerid))) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2807. if(id == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2808. else
  2809. {
  2810. new Float:Pos[3];
  2811. GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  2812. SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  2813. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
  2814. SetPlayerInterior(playerid, GetPlayerInterior(id));
  2815. SendAdminCommand(playerid, "gotop");
  2816. }
  2817. return 1;
  2818. }
  2819. else return 0;
  2820. }
  2821. CMD:gotopos(playerid, params[])
  2822. {
  2823. if(IsAdminEx(playerid, 1))
  2824. {
  2825. new Float:Pos[3];
  2826. if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2])) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /gotopos (X) (Y) (Z)");
  2827. if(GetPVarType(playerid, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED1);
  2828. else
  2829. {
  2830. switch(IsPlayerInAnyVehicle(playerid))
  2831. {
  2832. case 0: SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  2833. case 1: SetVehiclePos(playerid, Pos[0], Pos[1], Pos[2]);
  2834. }
  2835. SendAdminCommand(playerid, "gotopos");
  2836. }
  2837. return 1;
  2838. }
  2839. else return 0;
  2840. }
  2841. CMD:get(playerid, params[])
  2842. {
  2843. if(IsAdminEx(playerid, 1))
  2844. {
  2845. new id;
  2846. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /get (nick/id)");
  2847. if(GetPVarType(playerid, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED1);
  2848. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2849. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2850. if(!IsPlayerConnected(id) || IsPlayerNPC(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2851. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2852. if(id == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2853. else
  2854. {
  2855. new Float:Pos[3], vehicleid = GetPlayerVehicleID(id), interior = GetPlayerInterior(playerid), world = GetPlayerVirtualWorld(playerid);
  2856. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]), SetPlayerVirtualWorld(id, world), SetPlayerInterior(id, interior);
  2857. switch(IsPlayerInAnyVehicle(id))
  2858. {
  2859. case 0: SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  2860. case 1: SetVehiclePos(vehicleid, Pos[0], Pos[1], (Pos[2] + 2)), LinkVehicleToInterior(vehicleid, interior), SetVehicleVirtualWorld(vehicleid, world);
  2861. }
  2862. SendAdminCommand(playerid, "get");
  2863. return 1;
  2864. }
  2865. }
  2866. else return 0;
  2867. }
  2868. CMD:getp(playerid, params[])
  2869. {
  2870. if(IsAdminEx(playerid, 1))
  2871. {
  2872. new id;
  2873. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /getp (nick/id)");
  2874. if(GetPVarType(playerid, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED1);
  2875. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2876. if(!IsPlayerConnected(id) || IsPlayerNPC(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2877. if(id == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2878. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  2879. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2880. else
  2881. {
  2882. new Float:Pos[3];
  2883. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  2884. SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  2885. SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
  2886. SetPlayerInterior(id, GetPlayerInterior(playerid));
  2887. SendAdminCommand(playerid, "getp");
  2888. }
  2889. return 1;
  2890. }
  2891. else return 0;
  2892. }
  2893. CMD:send(playerid, params[])
  2894. {
  2895. if(IsAdminEx(playerid, 1))
  2896. {
  2897. new id, id2;
  2898. if(sscanf(params, "uu", id, id2)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /send (player 1) (player 2)");
  2899. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2900. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2901. if(!IsPlayerConnected(id) || IsPlayerNPC(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2902. if(id2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2903. if(id == playerid || id2 == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2904. else
  2905. {
  2906. new vehicleid = GetPlayerVehicleID(id), interior = GetPlayerInterior(id2), world = GetPlayerVirtualWorld(id2), Float:Pos[3];
  2907. GetPlayerPos(id2, Pos[0], Pos[1], Pos[2]), SetPlayerVirtualWorld(id, world), SetPlayerInterior(id, interior);
  2908. switch(IsPlayerInAnyVehicle(id))
  2909. {
  2910. case 0: SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  2911. case 1: SetVehiclePos(vehicleid, Pos[0], Pos[1], (Pos[2]+3)), LinkVehicleToInterior(vehicleid, interior), SetVehicleVirtualWorld(vehicleid, world);
  2912. }
  2913. SendAdminCommand(playerid, "send");
  2914. return 1;
  2915. }
  2916. }
  2917. else return 0;
  2918. }
  2919. CMD:sendp(playerid, params[])
  2920. {
  2921. if(IsAdminEx(playerid, 1))
  2922. {
  2923. new id, id2;
  2924. if(sscanf(params, "uu", id, id2)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /sendp (player 1) (player 2)");
  2925. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  2926. if(GetPVarType(id, "Spawned") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_SPAWNED2);
  2927. if(!IsPlayerConnected(id) || IsPlayerNPC(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2928. if(id2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  2929. if(id == playerid || id2 == playerid) return SendClientMessage(playerid, COLOUR_ERROR, E_CANT_USE_ON_YOURSELF);
  2930. else
  2931. {
  2932. new Float:Pos[3];
  2933. GetPlayerPos(id2, Pos[0], Pos[1], Pos[2]);
  2934. SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
  2935. SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(id2));
  2936. SetPlayerInterior(id, GetPlayerInterior(id2));
  2937. SendAdminCommand(playerid, "sendp");
  2938. }
  2939. return 1;
  2940. }
  2941. else return 0;
  2942. }
  2943. CMD:amsg(playerid, params[])
  2944. {
  2945. if(IsAdminEx(playerid, 1))
  2946. {
  2947. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /amsg (message)");
  2948. if(params[80]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 80 characters.");
  2949. else
  2950. {
  2951. foreach(Player, i)
  2952. {
  2953. if(!IsAdmin(i)) continue;
  2954. SendMSG(i, COLOUR_INFO, "(Admin Message: %s): %s", pNick(playerid), params);
  2955. }
  2956. #if defined GA_USE_IRC
  2957. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "5(Admin Message: %s): %s", pNick(playerid), params);
  2958. #endif
  2959. return 1;
  2960. }
  2961. }
  2962. else return 0;
  2963. }
  2964. CMD:text(playerid, params[])
  2965. {
  2966. if(IsAdminEx(playerid, 1))
  2967. {
  2968. new seconds, msg[350];
  2969. if(sscanf(params, "ds[250]", seconds, msg)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /text (seconds) (message) - Use /texthelp for more help and information.");
  2970. if(msg[250]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 250 characters.");
  2971. if(seconds < 1) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be below 1.");
  2972. if(strfind(msg, "~") != -1) return SendClientMessage(playerid, COLOUR_ERROR, "Illegal character (~) found in the announcement message. Use /texthelp for more help.");
  2973. else
  2974. {
  2975. new GiantString[301], tcount = GetTickCount();
  2976. format(GiantString, sizeof(GiantString), "%s", CheckForTextdrawColours(msg));
  2977. if(strlen(params) < 300)
  2978. {
  2979. foreach(Player, i)
  2980. {
  2981. TDTime[i][0] = tcount, TDTime[i][1] = seconds;
  2982. TextDrawSetString(AnnouncementTextdraw[i], GiantString);
  2983. ShowAnnouncementTDForPlayer(i);
  2984. }
  2985. }
  2986. #if defined GA_USE_IRC
  2987. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "7>> Admin Announce for %d seconds: %s", seconds, DeleteTextdrawColours(msg));
  2988. #endif
  2989. SendAdminCommand(playerid, "text");
  2990. }
  2991. return 1;
  2992. }
  2993. else return 0;
  2994. }
  2995. CMD:textp(playerid, params[])
  2996. {
  2997. if(IsAdminEx(playerid, 1))
  2998. {
  2999. new id, seconds, msg[350];
  3000. if(sscanf(params, "uds[250]", id, seconds, msg)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /text (nick/id) (seconds) (message) - Use /texthelp for more help and information.");
  3001. if(msg[250]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 250 characters.");
  3002. if(seconds < 1) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid time input. The time can not be below 1.");
  3003. if(strfind(msg, "~") != -1) return SendClientMessage(playerid, COLOUR_ERROR, "Illegal character (~) found in the announcement message. Use /texthelp for more help.");
  3004. else
  3005. {
  3006. format(msg, sizeof(msg), "%s", CheckForTextdrawColours(msg));
  3007. if(!msg[349])
  3008. {
  3009. TDTime[id][0] = GetTickCount(), TDTime[id][1] = seconds;
  3010. TextDrawSetString(AnnouncementTextdraw[id], msg);
  3011. ShowAnnouncementTDForPlayer(id);
  3012. }
  3013. #if defined GA_USE_IRC
  3014. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[player announce] 3%s (%d) for user %s (%d) for %d seconds: %s", pNick(playerid), playerid, pNick(id), id, seconds, DeleteTextdrawColours(msg));
  3015. #endif
  3016. SendAdminCommand(playerid, "textp");
  3017. }
  3018. return 1;
  3019. }
  3020. else return 0;
  3021. }
  3022. CMD:texthelp(playerid, params[])
  3023. {
  3024. #pragma unused params
  3025. if(IsAdminEx(playerid, 1))
  3026. {
  3027. CMDSString = "";
  3028. strcat(CMDSString, ""DC_TD_BLUE"$cb - blue\n"DC_TD_PURPLE"$cp - purple\n"DC_TD_RED"$cr - red\n"DC_TD_GREEN"$cg - green\n"DC_TD_WHITE"$cw - white\n"DC_TD_YELLOW"$cy - yellow\n"DC_DIALOG"$cl - black\n");
  3029. strcat(CMDSString, "$cn (new Line)\n$ch (make colour lighter)\n");
  3030. strcat(CMDSString, ""DC_TD_ARROW"$cu (arrow up)\n$cd (arrow down)\n$< (arrow left)\n$> (arrow right)");
  3031. ShowPlayerDialog(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, CMDSString, "Close", "");
  3032. return 1;
  3033. }
  3034. else return 0;
  3035. }
  3036. #define DC_TD_BLUE "{2B346E}"
  3037. #define DC_TD_PURPLE "{925FDA}"
  3038. #define DC_TD_GREEN "{2F5A26}"
  3039. #define DC_TD_BLACK "{000000}"
  3040. #define DC_TD_RED "{9C1619}"
  3041. #define DC_TD_YELLOW "{C4A656}"
  3042. #define DC_TD_WHITE "{C3C3C3}"
  3043. #define DC_TD_ARROW "{6B696B}"
  3044. CMD:vehicle(playerid, params[])
  3045. {
  3046. if(IsAdminEx(playerid, 1))
  3047. {
  3048. new tmp[50], colour[2], Float:Angle;
  3049. if(sscanf(params, "s[50]D(-1)D(-1)", tmp, colour[0], colour[1])) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /vehicle (modelid/name) (optional: colour 1) (optional: colour 2)");
  3050. else
  3051. {
  3052. new modelid = GetVehicleModelIDFromName(tmp);
  3053. GetPlayerFacingAngle(playerid, Angle);
  3054. new veh = CreateVehicle(modelid, (GX(playerid) + 2), GY(playerid), GZ(playerid), Angle, colour[0], colour[1], -1);
  3055. LinkVehicleToInterior(veh, GetPlayerInterior(playerid)), SetVehicleVirtualWorld(veh, GetPlayerVirtualWorld(playerid));
  3056. SendMSG(playerid, COLOUR_INFO, "You've spawned a %s (ID: %d. Colours: %d and %d). Use /destroyvehicle to destroy a vehicle.", GetModelIDName(modelid), modelid, colour[0], colour[1]);
  3057. SendAdminCommand(playerid, "vehicle");
  3058. }
  3059. return 1;
  3060. }
  3061. else return 0;
  3062. }
  3063. CMD:destroyvehicle(playerid, params[])
  3064. {
  3065. if(IsAdminEx(playerid, 1))
  3066. {
  3067. new vehicleid = strval(params);
  3068. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /destroyvehicle (vehicle ID)");
  3069. if(vehicleid < 1 || vehicleid >= MAX_VEHICLES || GetVehicleModel(vehicleid) == 0) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid vehicle ID.");
  3070. else
  3071. {
  3072. DestroyVehicle(vehicleid);
  3073. SendMSG(playerid, COLOUR_INFO, "You've destroyed vehicle ID %d.", vehicleid);
  3074. SendAdminCommand(playerid, "destroyvehicle");
  3075. }
  3076. return 1;
  3077. }
  3078. else return 0;
  3079. }
  3080. CMD:removecar(playerid, params[])
  3081. {
  3082. if(IsAdminEx(playerid, 1))
  3083. {
  3084. new id;
  3085. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /removecar (nick/id)");
  3086. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  3087. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  3088. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  3089. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOUR_ERROR, "This player is not in a vehicle.");
  3090. else
  3091. {
  3092. SetPlayerPos(id, GX(id), GY(id), (GZ(id) + 5));
  3093. SendMSG(playerid, COLOUR_INFO, "You've ejected %s (%d) from his vehicle.", pNick(id), id);
  3094. SendAdminCommand(playerid, "removecar");
  3095. }
  3096. return 1;
  3097. }
  3098. else return 0;
  3099. }
  3100. CMD:asay(playerid, params[])
  3101. {
  3102. if(IsAdminEx(playerid, 1))
  3103. {
  3104. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /amsg (message)");
  3105. if(params[80]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 80 characters.");
  3106. else
  3107. {
  3108. #if defined GA_USE_IRC
  3109. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13Administrator %s: %s", pNick(playerid), params);
  3110. #endif
  3111. SendMSGToAll(COLOUR_INFO, "Administrator %s: %s", pNick(playerid), params);
  3112. return 1;
  3113. }
  3114. }
  3115. else return 0;
  3116. }
  3117. CMD:report(playerid, params[])
  3118. {
  3119. new id, reason[61];
  3120. if(sscanf(params, "us[60]", id, reason)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /report (nick/id) (reason)");
  3121. if(reason[60]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 60 characters.");
  3122. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  3123. else
  3124. {
  3125. new log[128];
  3126. format(log, sizeof(log), "Player complaint recieved from %s (%d) about %s (%d): %s.", pNick(playerid), playerid, pNick(id), id, reason);
  3127. SaveLog("/MAdmin/Logs/Reports.txt", log);
  3128. foreach(Player, i)
  3129. {
  3130. if(!IsAdmin(i)) continue;
  3131. SendClientMessage(i, COLOUR_ADMIN, log);
  3132. }
  3133. #if defined GA_USE_IRC
  3134. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13Player complaint recieved from %s (%d) about %s (%d): %s.", pNick(playerid), playerid, pNick(id), id, reason);
  3135. SendMSG(playerid, COLOUR_INFO, "Your report about %s (%d) has been sent to all online administrators, echoed to IRC and saved to a log file.", pNick(id), id);
  3136. #else
  3137. SendMSG(playerid, COLOUR_INFO, "Your report about %s (%d) has been sent to all online administrators and saved to a log file.", pNick(id), id);
  3138. #endif
  3139. }
  3140. return 1;
  3141. }
  3142. #if defined GA_USE_IRC
  3143. CMD:irc(playerid, params[])
  3144. {
  3145. if(isnull(params)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /irc (message)");
  3146. if(strlen(params) > 80) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 80 characters.");
  3147. else
  3148. {
  3149. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "5Message from %s (%d) in-game: %s", pNick(playerid), playerid, params);
  3150. SendClientMessage(playerid, COLOUR_INFO, "Your message has been sent to IRC (channel: "IRC_ECHO_CHANNEL").");
  3151. }
  3152. return 1;
  3153. }
  3154. CMD:ircpm(playerid, params[])
  3155. {
  3156. new user[31], msg[61];
  3157. if(sscanf(params, "s[30]s[60]", user, msg)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /ircpm (user) (message)");
  3158. if(user[30] || (!IRC_IsUserOnChannel(ReturnRandomBotID(), IRC_ECHO_CHANNEL, user) && !IRC_IsUserOnChannel(ReturnRandomBotID(), IRC_CHANNEL, user) && !IRC_IsUserOnChannel(ReturnRandomBotID(), IRC_ADMIN_ECHO_CHANNEL, user))) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid user. There is no user connected to IRC with that name.");
  3159. if(msg[60]) return SendClientMessage(playerid, COLOUR_ERROR, "Invalid length. The length must be between 1 and 60 characters.");
  3160. else
  3161. {
  3162. IRC_GroupNoticeEx(gGroupID, user, "5PM from %s (%d) in-game: %s", pNick(playerid), playerid, msg);
  3163. SendMSG(playerid, COLOUR_INFO, "Your message has been sent to %s on IRC.", user);
  3164. }
  3165. return 1;
  3166. }
  3167. #endif
  3168. CMD:jetpack(playerid, params[])
  3169. {
  3170. #pragma unused params
  3171. if(IsAdminEx(playerid, 1))
  3172. {
  3173. switch(GetPlayerSpecialAction(playerid))
  3174. {
  3175. case 0, 1, 3..23: SetPlayerSpecialAction(playerid, 2), SendClientMessage(playerid, COLOUR_INFO, "Jetpack enabled. Type /jetpack to take it off.");
  3176. case 2: SetPlayerSpecialAction(playerid, 0), SendClientMessage(playerid, COLOUR_INFO, "Jetpack disabled.");
  3177. }
  3178. return 1;
  3179. }
  3180. else return 0;
  3181. }
  3182. CMD:clearchat(playerid, params[])
  3183. {
  3184. #pragma unused params
  3185. if(IsAdminEx(playerid, 2))
  3186. {
  3187. ClearChat();
  3188. SendAdminCommand(playerid, "clearchat");
  3189. return 1;
  3190. }
  3191. else return 0;
  3192. }
  3193. CMD:listweapons(playerid, params[])
  3194. {
  3195. if(IsAdminEx(playerid, 1))
  3196. {
  3197. new id, slot, ammo, weap, Count, WeapName[30], WeapSTR[256], weapons[50], string[60];
  3198. WeapSTR = ""DC_ADMIN"Weapon\t\tAmmo\n\n";
  3199. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /listweapons (nick/id)");
  3200. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  3201. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  3202. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  3203. else
  3204. {
  3205. for(slot = 1; slot < 13; slot++)
  3206. {
  3207. GetPlayerWeaponData(id, slot, weap, ammo);
  3208. {
  3209. if(ammo != 0)
  3210. {
  3211. Count++;
  3212. }
  3213. }
  3214. }
  3215. if(Count == 0) return SendClientMessage(playerid, COLOUR_ERROR, "This player has no weapons.");
  3216. if(Count >= 1)
  3217. {
  3218. for(slot = 1; slot < 13; slot++)
  3219. {
  3220. GetPlayerWeaponData(id, slot, weap, ammo);
  3221. if(ammo > 0)
  3222. {
  3223. GetWeaponName(weap, WeapName, sizeof(WeapName));
  3224. if(ammo == 65535 || ammo == 1)
  3225. {
  3226. format(weapons, sizeof(weapons), ""DC_INFO"%s"DC_DIALOG"\t\t(1)\n", WeapName);
  3227. strcat(WeapSTR, weapons);
  3228. }
  3229. else
  3230. { if(slot != 4 && slot != 5 && slot != 3)
  3231. {
  3232. format(weapons, sizeof(weapons), ""DC_INFO"%s"DC_DIALOG"\t\t(%d)\n", WeapName, ammo);
  3233. strcat(WeapSTR, weapons);
  3234. }
  3235. if(slot == 4 && slot == 5 && slot != 3)
  3236. {
  3237. format(weapons, sizeof(weapons), ""DC_INFO"%s"DC_DIALOG"\t\t\t(%d)\n", WeapName, ammo);
  3238. strcat(WeapSTR, weapons);
  3239. }
  3240. if(slot == 3)
  3241. {
  3242. format(weapons, sizeof(weapons), ""DC_INFO"%s"DC_DIALOG"\t(%d)\n", WeapName, ammo);
  3243. strcat(WeapSTR, weapons);
  3244. }
  3245. }
  3246. }
  3247. format(string, sizeof(string), ""DC_INFO"%s"DC_DIALOG" (%d)'s Weapons:", pNick(id), id);
  3248. ShowPlayerDialog(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, string, WeapSTR, "Close", "");
  3249. }
  3250. }
  3251. }
  3252. return 1;
  3253. }
  3254. else return 0;
  3255. }
  3256. CMD:getinfo(playerid, params[])
  3257. {
  3258. if(IsAdminEx(playerid, 1))
  3259. {
  3260. new id, filename[ACCOUNTPATH_LENGTH], Float:health[3], string[256];
  3261. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /getinfo (nick/id)");
  3262. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  3263. if(IsHigherAdminLevel(playerid, id)) return SendClientMessage(playerid, COLOUR_ERROR, E_HIGHER_LEVEL);
  3264. if(IsPlayerNPC(id) && GetPVarInt(playerid, "Level") < NPC_LEVEL_LIMIT) return SendClientMessage(playerid, COLOUR_ERROR, E_NPC);
  3265. else
  3266. {
  3267. CMDSString = "";
  3268. GetPlayerHealth(id, health[0]), GetPlayerArmour(id, health[1]), GetVehicleHealth(GetPlayerVehicleID(id), health[2]);
  3269. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  3270. format(string, sizeof(string), ""DC_INFO"User:"DC_DIALOG" %s (%d)\n"DC_INFO"Admin Level:"DC_DIALOG" %d\n"DC_INFO"VIP Level:"DC_DIALOG" %d\n"DC_INFO"IP:"DC_DIALOG" %s\n"DC_INFO"Health:"DC_DIALOG" %0.2f\n"DC_INFO"Armour:"DC_DIALOG" %0.2f\n"DC_INFO"Vehicle Health:"DC_DIALOG" %0.2f\n", pNick(id), id, GetPVarInt(id, "Level"), GetPVarInt(id, "VIP"), GetPlayerIpEx(id), health[0], health[1], health[2]);
  3271. strcat(CMDSString, string);
  3272. format(string, sizeof(string), ""DC_INFO"Registered:"DC_DIALOG" %s\n"DC_INFO"Logged In:"DC_DIALOG" %s\n"DC_INFO"Money:"DC_DIALOG" $%d\n"DC_INFO"Score:"DC_DIALOG" %d\n"DC_INFO"Kills:"DC_DIALOG" %d\n"DC_INFO"Deaths:"DC_DIALOG" %d\n\nType "DC_INFO"/listweapons"DC_DIALOG" to list this players current weapons.",
  3273. YesNo(fexist(filename)), YesNo(GetPVarInt(id, "LoggedIn")), GetPlayerMoney(id), GetPlayerScore(id), GetPVarInt(id, "Kills"), GetPVarInt(id, "Deaths"));
  3274. strcat(CMDSString, string);
  3275. ShowPlayerDialog(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, CMDSString, "Close", "");
  3276. return 1;
  3277. }
  3278. }
  3279. else return 0;
  3280. }
  3281. CMD:stats(playerid, params[])
  3282. {
  3283. new id, time[3], string[256], kills, deaths, Float:kdr;
  3284. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOUR_ERROR, "Usage: /stats (nick/id)");
  3285. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_ERROR, E_NOT_CONNECTED);
  3286. else
  3287. {
  3288.  
  3289. CMDSString = "";
  3290. kills = GetPVarInt(id, "Kills"), deaths = GetPVarInt(id, "Deaths");
  3291. switch(kills)
  3292. {
  3293. case 0: kdr = 0.00;
  3294. default:
  3295. {
  3296. switch(deaths)
  3297. {
  3298. case 0: kdr = kills;
  3299. default: kdr = kills / deaths;
  3300. }
  3301. }
  3302. }
  3303. time[2] = GetPVarInt(id, "DaysConnected"), time[1] = GetPVarInt(id, "HoursConnected"), time[0] = GetPVarInt(id, "MinutesConnected");
  3304. format(string, sizeof(string), ""DC_INFO"User:"DC_DIALOG" %s (%d)\n"DC_INFO"Score:"DC_DIALOG" %d\n"DC_INFO"Money:"DC_DIALOG" $%d\n"DC_INFO"Kills:"DC_DIALOG" %d\n"DC_INFO"Deaths:"DC_DIALOG" %d\n", pNick(id), id, GetPlayerScore(id), GetPlayerMoney(id), GetPVarInt(id, "Kills"), GetPVarInt(id, "Deaths"));
  3305. strcat(CMDSString, string);
  3306. format(string, sizeof(string), ""DC_INFO"Kill/Death Ratio:"DC_DIALOG" %0.2f\n"DC_INFO"Time connected:"DC_DIALOG" %d day%s, %d hour%s and %d minute%s", kdr, time[2], AddS(time[2]), time[1], AddS(time[1]), time[0], AddS(time[0]));
  3307. strcat(CMDSString, string);
  3308. ShowPlayerDialog(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, CMDSString, "Close", "");
  3309. }
  3310. return 1;
  3311. }
  3312. CMD:register(playerid, params[])
  3313. {
  3314. #pragma unused params
  3315. if(GetPVarInt(playerid, "LoggedIn") == 1) return SendClientMessage(playerid, COLOUR_ERROR, "You're already registered and logged in.");
  3316. if(IsRegistered(playerid))
  3317. {
  3318. ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "This account ("DC_INFO"%s"DC_DIALOG") is registered.\nEnter the password for this account to login:", pNick(playerid));
  3319. return 0;
  3320. }
  3321. else ShowPlayerDialogEx(playerid, GA_REGISTERMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Register", "Cancel", "You're about to create an account on "DC_INFO"%s"DC_DIALOG".\n\nEnter the password for your new account below:", SERVER_NAME);
  3322. return 1;
  3323. }
  3324. CMD:login(playerid, params[])
  3325. {
  3326. #pragma unused params
  3327. if(GetPVarInt(playerid, "LoggedIn") == 1) return SendClientMessage(playerid, COLOUR_ERROR, "You're already logged in.");
  3328. if(!IsRegistered(playerid))
  3329. {
  3330. ShowPlayerDialogEx(playerid, GA_REGISTERMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Register", "Cancel", "You're about to create an account on "DC_INFO"%s"DC_DIALOG".\n\nEnter the password for your new account below:", SERVER_NAME);
  3331. return 0;
  3332. }
  3333. else ShowPlayerDialogEx(playerid, GA_LOGINMENU, DIALOG_STYLE_INPUT, GA_DC_HEADER, "Login", "Cancel", "This account ("DC_INFO"%s"DC_DIALOG") is registered.\nEnter the password for this account to login:", pNick(playerid));
  3334. return 1;
  3335. }
  3336. CMD:changepass(playerid, params[])
  3337. {
  3338. new buf[129], INI:file, filename[ACCOUNTPATH_LENGTH];
  3339. if(GetPVarType(playerid, "LoggedIn") == PLAYER_VARTYPE_NONE) return SendClientMessage(playerid, COLOUR_ERROR, "You need to be logged in to use this command.");
  3340. if(strlen(params) < GA_MIN_PASSWORD || strlen(params) > GA_MAX_PASSWORD) return SendClientMessage(playerid, COLOUR_ERROR, E_INVALID_PASSWORD_LENGTH);
  3341. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  3342. WP_Hash(buf, sizeof(buf), params);
  3343. file = INI_Open(filename);
  3344. INI_WriteString(file, "PasswordHash", buf);
  3345. INI_Close(file);
  3346. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  3347. SendMSG(playerid, COLOUR_INFO, "The password for your account (%s) has been successfully changed to \"%s\". Remember it for later use.", pNick(playerid), params);
  3348.  
  3349. return 1;
  3350. }
  3351. //==============================================================================
  3352. // Updating
  3353. //==============================================================================
  3354. function GA_Update()
  3355. {
  3356. //new connect;
  3357. GA_Seconds++;
  3358. if(GA_Seconds == 60)
  3359. {
  3360. GA_Seconds = 0;
  3361. GA_Minutes++;
  3362. if(GA_Minutes == 60)
  3363. {
  3364. GA_Minutes = 0;
  3365. }
  3366. }
  3367. foreach(Player, i)
  3368. {
  3369. //connect = GetSecondsBetweenAction(GetPVarInt(i, "ConnectTime"));
  3370. if(GA_Minutes == GA_MINUTES_BETWEEN_AUTOSAVE)
  3371. {
  3372. SavePlayerStats(i);
  3373. }
  3374. if(GetSecondsBetweenAction(FreezeTime[i][0]) >= FreezeTime[i][1] && FreezeTime[i][1] != 0)
  3375. {
  3376. SendClientMessage(i, COLOUR_INFO, "You've been automaticly unfrozen by the server.");
  3377. TogglePlayerControllable(i, 1);
  3378. FreezeTime[i][1] = 0;
  3379. DeletePVar(i, "Frozen");
  3380. }
  3381. if(GetSecondsBetweenAction(CageTime[i][0]) >= CageTime[i][1] && CageTime[i][1] != 0)
  3382. {
  3383. SendClientMessage(i, COLOUR_INFO, "You've been automaticly uncaged by the server.");
  3384. UncagePlayer(i);
  3385. CageTime[i][1] = 0;
  3386. DeletePVar(i, "Caged");
  3387. }
  3388. if(GetSecondsBetweenAction(DisarmTime[i][0]) >= DisarmTime[i][1] && DisarmTime[i][1] != 0)
  3389. {
  3390. SendClientMessage(i, COLOUR_INFO, "You've been automaticly dedisarmed by the server.");
  3391. DisarmTime[i][1] = 0;
  3392. IsDisarmed{i} = 0;
  3393. DeletePVar(i, "Disarmed");
  3394. }
  3395. if(GetSecondsBetweenAction(MuteTime[i][0]) >= MuteTime[i][1] && MuteTime[i][1] != 0)
  3396. {
  3397. SendClientMessage(i, COLOUR_INFO, "You've been automaticly unmuted by the server.");
  3398. MuteTime[i][1] = 0;
  3399. DeletePVar(i, "Muted");
  3400. }
  3401. if(GetSecondsBetweenAction(TDTime[i][0]) >= TDTime[i][1] && TDTime[i][1] != 0)
  3402. {
  3403. if(GetPVarType(i, "AnnouncementTextdrawShown") == 1)
  3404. {
  3405. TDTime[i][1] = 0;
  3406. TextDrawHideForPlayer(i, AnnouncementTextdraw[i]);
  3407. DeletePVar(i, "AnnouncementTextdrawShown");
  3408. }
  3409. }
  3410. if(GodMode{i} == 1)
  3411. {
  3412. SetPlayerHealth(i, 10000.00), SetPlayerArmour(i, 10000.00);
  3413. if(IsPlayerInAnyVehicle(i))
  3414. {
  3415. new vehicleid = GetPlayerVehicleID(i);
  3416. SetVehicleHealth(i, 100000.00), RepairVehicle(vehicleid);
  3417. }
  3418. }
  3419. /*
  3420. #if defined GA_MUST_LOGIN
  3421. if(GetPVarType(i, "LoggedIn") == PLAYER_VARTYPE_NONE)
  3422. {
  3423. if(connect >= ((GA_TIME_FOR_MUST_LOGIN - 30) * 1000)) && MessageSent[i]{0} == 0)
  3424. {
  3425. new amount = (GA_TIME_FOR_MUST_LOGIN - 30);
  3426. SendMSG(i, , "You must login within %d second%s or you will be kicked.", amount, AddS(amount));
  3427. MessageSent[i]{0} = 1;
  3428. }
  3429. if(connect >= (GA_TIME_FOR_MUST_LOGIN * 1000))
  3430. {
  3431. KickEx(i, SERVER, "Failed To Login Within The Time Limit");
  3432. continue;
  3433. }
  3434. }
  3435. #endif
  3436. #if defined GA_MUST_REGISTER
  3437. if(!IsRegistered(i))
  3438. {
  3439. if(connect >= ((GA_TIME_FOR_MUST_REGISTER - 30) * 1000) && MessageSent[i]{1} == 0)
  3440. {
  3441. new amount = (GA_TIME_FOR_MUST_REGISTER - 30);
  3442. SendMSG(i, COLOUR_INFO, "You must register within %d second%s or you will be kicked.", amount, AddS(amount));
  3443. MessageSent[i]{1} = 1;
  3444. }
  3445. if(connect >= (GA_TIME_FOR_MUST_REGISTER * 1000))
  3446. {
  3447. KickEx(i, SERVER, "Failed To Register Within The Time Limit");
  3448. continue;
  3449. }
  3450. }
  3451. #endif
  3452. */
  3453. #if defined GA_HIGH_PING_KICK
  3454. if(GetPlayerPing(i) > GA_MAX_PING && GetPlayerPing(i) != 65535)
  3455. {
  3456. KickEx(i, SERVER, "Ping Exceeding "#GA_MAX_PING"");
  3457. continue;
  3458. }
  3459. #endif
  3460. }
  3461. return 1;
  3462. }
  3463. //==============================================================================
  3464. // Internet Relay Chat (IRC)
  3465. //==============================================================================
  3466. #if defined GA_USE_IRC
  3467. //==============================================================================
  3468. //------------------------------------------------------------------------------
  3469. // IRC Callbacks
  3470. //------------------------------------------------------------------------------
  3471. function IRC_RegisterDelay(botid)
  3472. {
  3473. new string[50];
  3474. format(string, sizeof(string), "ns register %s %s", IRC_BOT_PASSWORD, IRC_BOT_EMAIL);
  3475. IRC_SendRaw(botid, string);
  3476. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[bot register] 3attempting to register bot ID %d with the password \"%s\" and the e-mail \"%s\".", botid, IRC_BOT_PASSWORD, IRC_BOT_EMAIL);
  3477. return 1;
  3478. }
  3479. public IRC_OnJoinChannel(botid, channel[])
  3480. {
  3481. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[bot join] 3bot ID %d joined the channel %s.", botid, channel);
  3482. return 1;
  3483. }
  3484. public IRC_OnLeaveChannel(botid, channel[], message[])
  3485. {
  3486. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[bot leave] 3bot ID %d left the channel %s (%s).", botid, channel, message);
  3487. return 1;
  3488. }
  3489. public IRC_OnConnect(botid, ip[], port)
  3490. {
  3491. new string[50];
  3492. printf("[MAdmin - IRC] Bot ID %d connected (%d/"#IRC_MAX_BOTS") to %s (%d).", botid, botid, ip, port);
  3493. IRC_JoinChannel(botid, IRC_CHANNEL);
  3494. IRC_JoinChannel(botid, IRC_ECHO_CHANNEL);
  3495. IRC_JoinChannel(botid, IRC_ADMIN_ECHO_CHANNEL);
  3496. IRC_AddToGroup(gGroupID, botid);
  3497. format(string, sizeof(string), "identify %s", IRC_BOT_PASSWORD);
  3498. IRC_SendRaw(botid, string);
  3499. return 1;
  3500. }
  3501. public IRC_OnDisconnect(botid, ip[], port, reason[])
  3502. {
  3503. printf("[MAdmin - IRC] Bot ID %d disconnected. Reason: %s.\nAttempting to reconnect to %s (%d)...", botid, reason, ip, port);
  3504. gBotID{(botid-1)} = 0;
  3505. IRC_RemoveFromGroup(gGroupID, botid);
  3506. return 1;
  3507. }
  3508. public IRC_OnKickedFromChannel(botid, channel[], oppeduser[], oppedhost[], message[])
  3509. {
  3510. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[bot kicked] 3bot ID %d was kicked from the channel %s by %s (%s). Reason: %s.", botid, channel, oppeduser, oppedhost, message);
  3511. return 1;
  3512. }
  3513. public IRC_OnConnectAttemptFail(botid, ip[], port, reason[])
  3514. {
  3515. printf("[MAdmin - IRC] Bot ID %d failed to connect to %s (%d). Reason: %s.", botid, ip, port, reason);
  3516. return 1;
  3517. }
  3518. #if defined GA_SAVE_LOGS
  3519. public IRC_OnReceiveRaw(botid, message[])
  3520. {
  3521. strcat(message, "\n\r");
  3522. SaveLog("/MAdmin/Logs/IRC Log.txt", message);
  3523. return 1;
  3524. }
  3525. #endif
  3526. //------------------------------------------------------------------------------
  3527. // IRC Functions
  3528. //------------------------------------------------------------------------------
  3529. stock ReturnRandomBotID()
  3530. {
  3531. random_bot:
  3532. new rand = random(IRC_MAX_BOTS);
  3533. switch(gBotID{rand})
  3534. {
  3535. case 0: goto random_bot;
  3536. default: return gBotID{rand};
  3537. }
  3538. return 0;
  3539. }
  3540. //------------------------------------------------------------------------------
  3541. // IRC Commands
  3542. //------------------------------------------------------------------------------
  3543. IRCCMD:irccmds(botid, channel[], user[], host[], params[])
  3544. {
  3545. if(!strcmp(channel, IRC_ECHO_CHANNEL, true) || !strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) || !strcmp(channel, IRC_CHANNEL, true))
  3546. {
  3547. switch(IRC_IsVoice(botid, channel, user))
  3548. {
  3549. case 0: IRC_GroupNotice(gGroupID, user, "IRC commands: !stats !getname !getid !pm !players");
  3550. case 1: IRC_GroupNotice(gGroupID, user, "IRC voice (+v) commands: !say !stats !getname !getid !pm !players");
  3551. }
  3552. if(IRC_IsHalfop(botid, channel, user))
  3553. {
  3554. IRC_GroupNotice(gGroupID, user, "IRC halfop (+h) commands: !vip !admins");
  3555. }
  3556. if(IRC_IsOp(botid, channel, user))
  3557. {
  3558. IRC_GroupNotice(gGroupID, user, "IRC op (+o) commands: !asay !amsg !getinfo !akill !slap !iban !tempban !ikick !(un)cage !(un)freeze !(un)mute !(de)disarm !warn !clearwarnings !giveweapon");
  3559. }
  3560. if(IRC_IsAdmin(botid, channel, user))
  3561. {
  3562. IRC_GroupNotice(gGroupID, user, "IRC admin (+a) commands: !ssay !crash");
  3563. }
  3564. if(IRC_IsOwner(botid, channel, user))
  3565. {
  3566. IRC_GroupNotice(gGroupID, user, "IRC owner (+q) commands: !rangeban !banall !kickall !(un)cageall !(un)freezeall !warnall !(un)muteall !clearallwarnings !(de)disarmall");
  3567. IRC_GroupNotice(gGroupID, user, "IRC owner (+q) commands: !giveallweapon !crashall !botjoin !botleave !botregister !botidentify !toggle(all)cmd");
  3568. }
  3569. }
  3570. return 1;
  3571. }
  3572. IRCCMD:getid(botid, channel[], user[], host[], params[])
  3573. {
  3574. new pName[MAX_PLAYER_NAME];
  3575. if(isnull(params) || strlen(params) > MAX_PLAYER_NAME) return IRC_GroupNotice(gGroupID, user, "4Usage: !getid (name: 0-"#MAX_PLAYER_NAME" characters)");
  3576. else
  3577. {
  3578. new count;
  3579. CMDSString = "";
  3580. foreach(Player, i)
  3581. {
  3582. GetPlayerName(i, pName, MAX_PLAYER_NAME);
  3583. for(new j, k = (strlen(pName)-strlen(params)); j <= k; j++)
  3584. {
  3585. if(!strcmp(params, pName[j], true, strlen(params)))
  3586. {
  3587. format(CMDSString, sizeof(CMDSString), "%s%s (%d), ", CMDSString, pName, i);
  3588. count++;
  3589. break;
  3590. }
  3591. }
  3592. }
  3593. switch(strlen(CMDSString))
  3594. {
  3595. case 0: IRC_GroupSayEx(gGroupID, channel, "No matches for \"%s\".", params);
  3596. default: IRC_GroupSayEx(gGroupID, channel, "Matches for \"%s\": %s", params, CMDSString);
  3597. }
  3598. }
  3599. return 1;
  3600. }
  3601. IRCCMD:getname(botid, channel[], user[], host[], params[])
  3602. {
  3603. new id;
  3604. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3605. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !getname (nick/id)");
  3606. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3607. IRC_GroupSayEx(gGroupID, channel, "02ID %d's name is %s", id, pNick(id));
  3608. return 1;
  3609. }
  3610. IRCCMD:say(botid, channel[], user[], host[], params[])
  3611. {
  3612. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3613. if(isnull(params) || strlen(params) > 60) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3614. if(!IRC_IsVoice(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need voice (+v) or above to use this command.");
  3615. IRC_GroupSayEx(gGroupID, channel, "02*** %s on IRC (%s): %s", user, channel, params);
  3616. SendMSGToAll(COLOUR_IRC, "*** %s on IRC (%s): %s", user, channel, params);
  3617. return 1;
  3618. }
  3619. IRCCMD:pm(botid, channel[], user[], host[], params[])
  3620. {
  3621. new id, msg[61];
  3622. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3623. if(sscanf(params, "us[60]", id, msg)) return IRC_GroupNotice(gGroupID, user, "4Usage: !pm (nick/id) (message: 0-60 characters)");
  3624. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3625. if(GetPVarInt(id, "NoPM") == 1) return IRC_GroupNotice(gGroupID, user, "4This player is currently not accepting PMs at the moment.");
  3626. if(isnull(msg) || msg[60]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3627. else
  3628. {
  3629. IRC_GroupSayEx(gGroupID, channel, "5PM sent to %s (%d): %s", pNick(id), id, msg);
  3630. SendMSG(id, COLOUR_PM, "PM from %s on IRC (%s): %s", user, channel, msg);
  3631. }
  3632. return 1;
  3633. }
  3634. IRCCMD:ssay(botid, channel[], user[], host[], params[])
  3635. {
  3636. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3637. if(isnull(params) || strlen(params) > 60) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3638. if(!IRC_IsAdmin(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need admin (+a) or above to use this command.");
  3639. IRC_GroupSayEx(gGroupID, channel, "02*** Anonymous user on IRC (%s): %s", channel, params);
  3640. SendMSGToAll(COLOUR_IRC, "*** Anonymous user on IRC (%s): %s", channel, params);
  3641. return 1;
  3642. }
  3643. IRCCMD:asay(botid, channel[], user[], host[], params[])
  3644. {
  3645. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3646. if(isnull(params) || strlen(params) > 60) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3647. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3648. IRC_GroupSayEx(gGroupID, channel, "02*** Administrator %s on IRC (%s): %s", user, channel, params);
  3649. SendMSGToAll(COLOUR_ADMIN, "*** Administrator %s on IRC (%s): %s", user, channel, params);
  3650. return 1;
  3651. }
  3652. IRCCMD:vip(botid, channel[], user[], host[], params[])
  3653. {
  3654. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3655. if(isnull(params) || strlen(params) > 60) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3656. if(!IRC_IsHalfop(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need halfop (+h) or above to use this command.");
  3657. IRC_GroupSayEx(gGroupID, channel, "02*** VIP %s on IRC (%s): %s", user, channel, params);
  3658. SendMSGToAll(COLOUR_IRC, "*** VIP %s on IRC (%s): %s", user, channel, params);
  3659. return 1;
  3660. }
  3661. IRCCMD:amsg(botid, channel[], user[], host[], params[])
  3662. {
  3663. if(strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ADMIN_ECHO_CHANNEL".");
  3664. if(isnull(params) || strlen(params) > 60) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 60 characters.");
  3665. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3666. foreach(Player, i)
  3667. {
  3668. if(!IsAdmin(i)) continue;
  3669. SendMSG(i, COLOUR_INFO, "(Admin Message: %s): %s", user, params);
  3670. }
  3671. IRC_GroupSayEx(gGroupID, channel, "5(Admin Message: %s): %s", user, params);
  3672. return 1;
  3673. }
  3674. IRCCMD:admins(botid, channel[], user[], host[], params[])
  3675. {
  3676. new count = 1;
  3677. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3678. if(!IRC_IsHalfop(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need halfop (+h) or above to use this command.");
  3679. foreach(Player, i)
  3680. {
  3681. if(!IsAdmin(i)) continue;
  3682. IRC_GroupNoticeEx(gGroupID, user, "9%d. 7%s 5(%d)", count, pNick(i), i);
  3683. count++;
  3684. }
  3685. return 1;
  3686. }
  3687. IRCCMD:vips(botid, channel[], user[], host[], params[])
  3688. {
  3689. new count = 1;
  3690. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3691. if(!IRC_IsHalfop(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need halfop (+h) or above to use this command.");
  3692. foreach(Player, i)
  3693. {
  3694. if(GetPVarType(i, "VIP") == PLAYER_VARTYPE_NONE) continue;
  3695. IRC_GroupNoticeEx(gGroupID, user, "9%d. 7%s 5(%d)", count, pNick(i), i);
  3696. count++;
  3697. }
  3698. return 1;
  3699. }
  3700. IRCCMD:players(botid, channel[], user[], host[], params[])
  3701. {
  3702. new count[3];
  3703. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3704. foreach(Player, i)
  3705. {
  3706. count[0]++;
  3707. if(IsAdmin(i))
  3708. {
  3709. count[1]++;
  3710. }
  3711. if(GetPVarType(i, "VIP") >= 1)
  3712. {
  3713. count[2]++;
  3714. }
  3715. }
  3716. IRC_GroupNoticeEx(gGroupID, user, "Total players online: %d (%d admin%s and %d VIP%s).", count[0], count[1], AddS(count[1]), count[2], AddS(count[2]));
  3717. return 1;
  3718. }
  3719. IRCCMD:getinfo(botid, channel[], user[], host[], params[])
  3720. {
  3721. new id, filename[ACCOUNTPATH_LENGTH], Float:health[3];
  3722. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3723. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !getinfo (nick/id)");
  3724. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3725. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3726. else
  3727. {
  3728. GetPlayerHealth(id, health[0]), GetPlayerArmour(id, health[1]), GetVehicleHealth(GetPlayerVehicleID(id), health[2]);
  3729. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  3730. IRC_GroupNoticeEx(gGroupID, user, "*** Player info for %s (%d) [IP: %s] ***", pNick(id), id, GetPlayerIpEx(id));
  3731. IRC_GroupNoticeEx(gGroupID, user, "* Admin Level: %d. VIP Level: %d. Registered: %s. Logged In: %s. Money: $%d. Score: %d. Kills: %d. Deaths: %d.", GetPVarInt(id, "Level"), GetPVarInt(id, "VIP"), YesNo(fexist(filename)), YesNo(GetPVarInt(id, "LoggedIn")), GetPlayerMoney(id), GetPlayerScore(id), GetPVarInt(id, "Kills"), GetPVarInt(id, "Deaths"));
  3732. IRC_GroupNoticeEx(gGroupID, user, "* Health: %0.2f. Armour: %0.2f. Vehicle Health: %0.2f.", health[0], health[1], health[2]);
  3733. IRC_GroupSay(gGroupID, user, "* Use !listweapons to list this players current weapons.");
  3734. }
  3735. return 1;
  3736. }
  3737. IRCCMD:akill(botid, channel[], user[], host[], params[])
  3738. {
  3739. new id, reason[51];
  3740. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3741. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !akill (nick/id) (optional: reason)");
  3742. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3743. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3744. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3745. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3746. else
  3747. {
  3748. SetPlayerHealth(id, 0.00);
  3749. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC (%s) has admin-killed you. Reason: %s.", user, channel, reason);
  3750. IRC_GroupNoticeEx(gGroupID, user, "You've admin-killed %s (%d). Reason: %s.", pNick(id), id, reason);
  3751. }
  3752. return 1;
  3753. }
  3754. IRCCMD:slap(botid, channel[], user[], host[], params[])
  3755. {
  3756. new id, Float:amount, reason[51];
  3757. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3758. if(sscanf(params, "uF(10.0)S(No Reason Specified)[50]", id, amount, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !akill (nick/id) (optional: reason)");
  3759. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3760. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3761. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3762. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3763. else
  3764. {
  3765. SetPlayerPos(id, GX(id), GY(id), (GZ(id) + amount));
  3766. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC (%s) has slapped you. Reason: %s.", user, channel, reason);
  3767. IRC_GroupNoticeEx(gGroupID, user, "You've slapped %s (%d). Reason: %s.", pNick(id), id, reason);
  3768. }
  3769. return 1;
  3770. }
  3771. IRCCMD:iban(botid, channel[], user[], host[], params[])
  3772. {
  3773. new id, reason[51], INI:file, filename[ACCOUNTPATH_LENGTH];
  3774. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3775. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3776. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !iban (nick/id) (optional: reason)");
  3777. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3778. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3779. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3780. else
  3781. {
  3782. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  3783. if(fexist(filename))
  3784. {
  3785. file = INI_Open(filename);
  3786. INI_WriteInt(file, "Banned", 1);
  3787. INI_Close(file);
  3788. }
  3789. IRC_GroupNoticeEx(gGroupID, user, "You've banned %s (%d). Reason: %s.", pNick(id), id, reason);
  3790. BanEx2(id, ADMIN, reason);
  3791. }
  3792. return 1;
  3793. }
  3794. IRCCMD:tempban(botid, channel[], user[], host[], params[])
  3795. {
  3796. new id, days, reason[51], year, month, day;
  3797. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3798. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3799. if(sscanf(params, "udS(No Reason Specified)[50]", id, days, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !tempban (nick/id) (days) (optional: reason)");
  3800. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3801. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3802. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3803. else
  3804. {
  3805. new File:tmpban = fopen(TEMPBAN, io_append);
  3806. if(tmpban)
  3807. {
  3808. getdate(year, month, day);
  3809. day += days;
  3810. switch(IsMonth31(month))
  3811. {
  3812. case 1:
  3813. {
  3814. if(day > 31)
  3815. {
  3816. month += 1;
  3817. if(month > 12)
  3818. {
  3819. year += 1;
  3820. while(day > 31) day -=31;
  3821. }
  3822. else while(day > 31) day -= 31;
  3823. }
  3824. }
  3825. case 0:
  3826. {
  3827. if(day > 30)
  3828. {
  3829. month += 1;
  3830. if(month > 12)
  3831. {
  3832. year += 1;
  3833. while(day > 30) day -= 30;
  3834. }
  3835. else while(day > 30) day -= 30;
  3836. }
  3837. if(IsMonth29(year) && month == 2 && day > 29)
  3838. {
  3839. month += 1;
  3840. if(month > 12)
  3841. {
  3842. year += 1;
  3843. while(day > 29) day -= 29;
  3844. }
  3845. else while(day > 29) day -= 29;
  3846. }
  3847. if(!IsMonth29(year) && month == 2 && day > 28)
  3848. {
  3849. month += 1;
  3850. if(month > 12)
  3851. {
  3852. year += 1;
  3853. while(day > 28) day -= 28;
  3854. }
  3855. else while(day > 28) day -= 28;
  3856. }
  3857. }
  3858. }
  3859. CMDSString = "";
  3860. new date[3], time[3];
  3861. getdate(date[2], date[1], date[0]), gettime(time[0], time[1], time[2]);
  3862. format(CMDSString, sizeof(CMDSString), "%d|%d|%d|%s|%s|%02d/%02d/%02d - %02d:%02d:%02d\n\r", day, month, year, GetPlayerIpEx(id), pNick(id), date[0], date[1], date[2], time[0], time[1], time[2]);
  3863. fwrite(tmpban, CMDSString);
  3864. fclose(tmpban);
  3865. }
  3866. IRC_GroupNoticeEx(gGroupID, user, "You've banned %s (%d) for %d day%s - Expires at %d/%d/%d. Reason: %s.", pNick(id), id, days, AddS(days), day, month, year, reason);
  3867. SendMSGToAll(COLOUR_ADMIN, "*** %d DAY%s BAN: %s (%d) - Reason: %s.", days, AddS(days), pNick(id), id, reason);
  3868. #if defined GA_SAVE_LOGS
  3869. format(CMDSString, sizeof(CMDSString), "%s (%d) has been temporaly banned by %s for %d day%s. Expires at %d/%d/%d. Ban reason: %s.\n\r", pNick(id), id, user, days, AddS(days), day, month, year, reason);
  3870. SaveLog("/MAdmin/Logs/TempBans.txt", CMDSString);
  3871. #endif
  3872. ClearChat(0, id);
  3873. SendMSG(id, COLOUR_INFO, "You've been temporaly banned from the server for %d day%s. Expires at: %d/%d/%d. Reason: %s", days, AddS(days), day, month, year, reason);
  3874. GameTextForPlayer(id, KICK_GAMETEXT, (999999 * 999999), 3);
  3875. Kick(id);
  3876. }
  3877. return 1;
  3878. }
  3879. IRCCMD:rangeban(botid, channel[], user[], host[], params[])
  3880. {
  3881. new id, ranges, INI:file, filename[ACCOUNTPATH_LENGTH];
  3882. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  3883. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3884. if(sscanf(params, "uD(1)", id, ranges)) return IRC_GroupNotice(gGroupID, user, "4Usage: !rangeban (nick/id) (optional: IP ranges)");
  3885. if(ranges < 0 || ranges > 3) return IRC_GroupNotice(gGroupID, user, "4Invalid IP range amount. The IP range must be between 1 and 3.");
  3886. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3887. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3888. else
  3889. {
  3890. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(id)));
  3891. if(fexist(filename))
  3892. {
  3893. file = INI_Open(filename);
  3894. INI_WriteInt(file, "Banned", 1);
  3895. INI_Close(file);
  3896. }
  3897. IRC_GroupNoticeEx(gGroupID, user, "You've rangebanned %s (%d) [IP: %s]. Total ranges banned: %d.", pNick(id), id, GetPlayerIpEx(id), ranges);
  3898. RangeBan(id, ranges);
  3899. }
  3900. return 1;
  3901. }
  3902. /*
  3903. IRCCMD:togglecmd(botid, channel[], user[], host[], params[])
  3904. {
  3905. new id, cmd[51], toggle;
  3906. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  3907. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3908. if(sscanf(params, "us[50]d", id, cmd, toggle)) return IRC_GroupNotice(gGroupID, user, "4Usage: !togglecmd (nick/id) (command) (toggle: 0/1)");
  3909. if(cmd[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid command length. The command must be between 1 and 50 characters.");
  3910. if(toggle != 0 && toggle != 1) return IRC_GroupNotice(gGroupID, user, "4Usage: !togglecmd (nick/id) (command) (toggle: 0/1)");
  3911. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3912. else
  3913. {
  3914. new bool:mode = !!toggle;
  3915. Command_SetPlayerNamed(cmd, id, mode);
  3916. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[togglecmd] 3%s %s the command %s for %s (%d).", user, Answer(toggle, "Enabled", "Disabled"), cmd, pNick(id), id);
  3917. IRC_GroupNoticeEx(gGroupID, user, "You've %s the command %s for %s (%d).", Answer(toggle, "Enabled", "Disabled"), cmd, pNick(id), id);
  3918. }
  3919. return 1;
  3920. }
  3921. IRCCMD:toggleallcmd(botid, channel[], user[], host[], params[])
  3922. {
  3923. new cmd[51], toggle;
  3924. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  3925. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3926. if(sscanf(params, "s[50]d", cmd, toggle)) return IRC_GroupNotice(gGroupID, user, "4Usage: !toggleallcmd (command) (toggle: 0/1)");
  3927. if(cmd[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid command length. The command must be between 1 and 50 characters.");
  3928. if(toggle != 0 && toggle != 1) return IRC_GroupNotice(gGroupID, user, "4Usage: !toggleallcmd (command) (toggle: 0/1)");
  3929. else
  3930. {
  3931. new count, bool:mode = !!toggle;
  3932. foreach(Player, i)
  3933. {
  3934. if(IsAdmin(i)) continue;
  3935. Command_SetPlayerNamed(cmd, i, mode);
  3936. count++;
  3937. }
  3938. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[toggleallcmd] 3%s %s the command %s for all non-administrators (%d in total).", user, Answer(toggle, "Enabled", "Disabled"), cmd, count);
  3939. IRC_GroupNoticeEx(gGroupID, user, "You've %s the command %s for all non-administrators (%d in total).", Answer(toggle, "Enabled", "Disabled"), cmd, count);
  3940. }
  3941. return 1;
  3942. }*/
  3943. IRCCMD:banall(botid, channel[], user[], host[], params[])
  3944. {
  3945. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  3946. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3947. if(isnull(params)) return IRC_GroupNotice(gGroupID, user, "4Usage: !banall (reason)");
  3948. if(params[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3949. else
  3950. {
  3951. new count;
  3952. foreach(Player, i)
  3953. {
  3954. if(IsAdmin(i)) continue;
  3955. SendMSG(i, COLOUR_INFO, "You've been banned from the server. Reason: %s", params);
  3956. GameTextForPlayer(i, KICK_GAMETEXT, (999999 * 999999), 3);
  3957. BanEx(i, params);
  3958. count++;
  3959. }
  3960. IRC_GroupNoticeEx(gGroupID, user, "You've banned all non-administrators (%d in total). Reason: %s.", count, params);
  3961. }
  3962. return 1;
  3963. }
  3964. IRCCMD:ikick(botid, channel[], user[], host[], params[])
  3965. {
  3966. new id, reason[51];
  3967. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  3968. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3969. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !ikick (nick/id) (optional: reason)");
  3970. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3971. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  3972. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  3973. else
  3974. {
  3975. IRC_GroupNoticeEx(gGroupID, user, "You've kicked %s (%d). Reason: %s.", pNick(id), id, reason);
  3976. KickEx(id, ADMIN, reason);
  3977. }
  3978. return 1;
  3979. }
  3980. IRCCMD:kickall(botid, channel[], user[], host[], params[])
  3981. {
  3982. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  3983. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  3984. if(isnull(params)) return IRC_GroupNotice(gGroupID, user, "4Usage: !kickall (reason)");
  3985. if(params[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  3986. else
  3987. {
  3988. new count;
  3989. foreach(Player, i)
  3990. {
  3991. if(IsAdmin(i)) continue;
  3992. SendMSG(i, COLOUR_INFO, "You've been kicked from the server. Reason: %s", params);
  3993. GameTextForPlayer(i, KICK_GAMETEXT, (999999 * 999999), 3);
  3994. Kick(i);
  3995. count++;
  3996. }
  3997. IRC_GroupNoticeEx(gGroupID, user, "You've kicked all non-administrators (%d in total). Reason: %s.", count, params);
  3998. }
  3999. return 1;
  4000. }
  4001. IRCCMD:cage(botid, channel[], user[], host[], params[])
  4002. {
  4003. new id, reason[51], seconds;
  4004. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4005. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4006. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !cage (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4007. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4008. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  4009. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4010. if(seconds < 0) return IRC_GroupNotice(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4011. else
  4012. {
  4013. CageTime[id][0] = GetTickCount(), CageTime[id][1] = seconds;
  4014. CagePlayer(id);
  4015. SetPVarInt(id, "Caged", 1);
  4016. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has caged you. Reason: %s.", user, reason);
  4017. IRC_GroupNoticeEx(gGroupID, user, "You've caged %s (%d). Reason: %s.", pNick(id), id, reason);
  4018. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_CAGE"", pNick(id), id, reason);
  4019. SendMSGToAll(COLOUR_ADMIN, ADMIN_CAGE, pNick(id), id, reason);
  4020. }
  4021. return 1;
  4022. }
  4023. IRCCMD:cageall(botid, channel[], user[], host[], params[])
  4024. {
  4025. new reason[51], seconds;
  4026. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4027. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4028. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !cageall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4029. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4030. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4031. if(seconds < 0) return IRC_GroupNotice(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4032. else
  4033. {
  4034. new count;
  4035. foreach(Player, i)
  4036. {
  4037. if(IsAdmin(i)) continue;
  4038. CageTime[i][0] = GetTickCount(), CageTime[i][1] = seconds;
  4039. CagePlayer(i);
  4040. SetPVarInt(i, "Caged", 1);
  4041. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has caged you. Reason: %s.", user, reason);
  4042. count++;
  4043. }
  4044. IRC_GroupNoticeEx(gGroupID, user, "You've caged all non-administrators (%d in total). Reason: %s.", count, reason);
  4045. }
  4046. return 1;
  4047. }
  4048. IRCCMD:uncage(botid, channel[], user[], host[], params[])
  4049. {
  4050. new id;
  4051. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4052. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4053. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !uncage (nick/id)");
  4054. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  4055. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4056. else
  4057. {
  4058. CageTime[id][1] = 0;
  4059. UncagePlayer(id);
  4060. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has uncaged you.", user);
  4061. IRC_GroupNoticeEx(gGroupID, user, "You've uncaged %s (%d).", pNick(id), id);
  4062. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNCAGE"", pNick(id), id);
  4063. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNCAGE, pNick(id), id);
  4064. DeletePVar(id, "Caged");
  4065. }
  4066. return 1;
  4067. }
  4068. IRCCMD:uncageall(botid, channel[], user[], host[], params[])
  4069. {
  4070. new count;
  4071. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4072. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4073. foreach(Player, i)
  4074. {
  4075. if(IsAdmin(i) || GetPVarInt(i, "Caged") == PLAYER_VARTYPE_NONE) continue;
  4076. CageTime[i][1] = 0;
  4077. UncagePlayer(i);
  4078. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has uncaged you.", user);
  4079. DeletePVar(i, "Caged");
  4080. count++;
  4081. }
  4082. IRC_GroupNoticeEx(gGroupID, user, "You've uncaged all non-administrators (%d in total).", count);
  4083. return 1;
  4084. }
  4085. IRCCMD:freeze(botid, channel[], user[], host[], params[])
  4086. {
  4087. new id, reason[51], seconds;
  4088. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4089. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4090. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !freeze (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4091. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4092. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  4093. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4094. if(seconds < 0) return IRC_GroupNotice(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4095. else
  4096. {
  4097. FreezeTime[id][0] = GetTickCount(), FreezeTime[id][1] = seconds;
  4098. TogglePlayerControllable(id, 0);
  4099. SetPVarInt(id, "Frozen", 1);
  4100. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has frozen you. Reason: %s.", user, reason);
  4101. IRC_GroupNoticeEx(gGroupID, user, "You've frozen %s (%d). Reason: %s.", pNick(id), id, reason);
  4102. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_FREEZE"", pNick(id), id, reason);
  4103. SendMSGToAll(COLOUR_ADMIN, ADMIN_FREEZE, pNick(id), id, reason);
  4104. }
  4105. return 1;
  4106. }
  4107. IRCCMD:freezeall(botid, channel[], user[], host[], params[])
  4108. {
  4109. new reason[51], seconds;
  4110. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4111. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4112. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !freezeall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4113. if(reason[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4114. if(seconds < 0) return IRC_GroupNotice(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4115. else
  4116. {
  4117. new count;
  4118. foreach(Player, i)
  4119. {
  4120. FreezeTime[i][0] = GetTickCount(), FreezeTime[i][1] = seconds;
  4121. TogglePlayerControllable(i, 0);
  4122. SetPVarInt(i, "Frozen", 1);
  4123. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has frozen you. Reason: %s.", user, reason);
  4124. count++;
  4125. }
  4126. IRC_GroupNoticeEx(gGroupID, user, "You've frozen all non-administrators (%d in total). Reason: %s.", count, reason);
  4127. }
  4128. return 1;
  4129. }
  4130. IRCCMD:unfreeze(botid, channel[], user[], host[], params[])
  4131. {
  4132. new id;
  4133. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4134. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4135. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !unfreeze (nick/id)");
  4136. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid Player!");
  4137. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4138. else
  4139. {
  4140. FreezeTime[id][1] = 0;
  4141. TogglePlayerControllable(id, 1);
  4142. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has unfrozen you.", user);
  4143. IRC_GroupNoticeEx(gGroupID, user, "You've unfrozen %s (%d).", pNick(id), id);
  4144. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNFREEZE"", pNick(id), id);
  4145. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNFREEZE, pNick(id), id);
  4146. DeletePVar(id, "Frozen");
  4147. }
  4148. return 1;
  4149. }
  4150. IRCCMD:unfreezeall(botid, channel[], user[], host[], params[])
  4151. {
  4152. new count;
  4153. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4154. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4155. foreach(Player, i)
  4156. {
  4157. if(IsAdmin(i) || GetPVarInt(i, "Frozen") == PLAYER_VARTYPE_NONE) continue;
  4158. FreezeTime[i][1] = 0;
  4159. TogglePlayerControllable(i, 1);
  4160. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has unfrozen you.", user);
  4161. DeletePVar(i, "Frozen");
  4162. count++;
  4163. }
  4164. IRC_GroupNoticeEx(gGroupID, user, "You've unfrozen all non-administrators (%d in total).", count);
  4165. return 1;
  4166. }
  4167. IRCCMD:warn(botid, channel[], user[], host[], params[])
  4168. {
  4169. new id, reason[51];
  4170. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4171. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4172. if(sscanf(params, "uS(No Reason Specified)[50]", id, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !warn (nick/id) (optional: reason)");
  4173. if(reason[50]) return IRC_GroupSay(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4174. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4175. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4176. else
  4177. {
  4178. UpdatePVarInt(id, "Warnings", 1);
  4179. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has given you a warning. Total warnings: %d/"#MAX_WARNINGS". Reason: %s.", user, GetPVarInt(id, "Warnings"), reason);
  4180. IRC_GroupNoticeEx(gGroupID, user, "You've given %s (%d) a warning. Reason: %s.", pNick(id), id, reason);
  4181. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_WARN"", pNick(id), id, reason);
  4182. SendMSGToAll(COLOUR_ADMIN, ADMIN_WARN, pNick(id), id, reason);
  4183. if(GetPVarInt(id, "Warnings") == MAX_WARNINGS)
  4184. {
  4185. switch(WARN_ACTION)
  4186. {
  4187. case 0: KickEx(id, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  4188. case 1: BanEx2(id, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  4189. }
  4190. }
  4191. }
  4192. return 1;
  4193. }
  4194. IRCCMD:warnall(botid, channel[], user[], host[], params[])
  4195. {
  4196. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4197. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4198. if(isnull(params)) return IRC_GroupNotice(gGroupID, user, "4Usage: !warnall (reason)");
  4199. if(params[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4200. else
  4201. {
  4202. new count;
  4203. foreach(Player, i)
  4204. {
  4205. if(IsAdmin(i)) continue;
  4206. UpdatePVarInt(i, "Warnings", 1);
  4207. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has given you a warning. Total warnings: %d/"#MAX_WARNINGS". Reason: %s.", user, GetPVarInt(i, "Warnings"), params);
  4208. if(GetPVarInt(i, "Warnings") == MAX_WARNINGS)
  4209. {
  4210. switch(WARN_ACTION)
  4211. {
  4212. case 0: KickEx(i, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  4213. case 1: BanEx2(i, SERVER, "Max Warnings Reached ("#MAX_WARNINGS"/"#MAX_WARNINGS")");
  4214. }
  4215. }
  4216. count++;
  4217. }
  4218. IRC_GroupNoticeEx(gGroupID, user, "You've given all non-administrators on the server a warning (%d players). Reason: %s.", count, params);
  4219. }
  4220. return 1;
  4221. }
  4222. IRCCMD:clearallwarnings(botid, channel[], user[], host[], params[])
  4223. {
  4224. new count;
  4225. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4226. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4227. foreach(Player, i)
  4228. {
  4229. if(GetPVarType(i, "Warnings") == PLAYER_VARTYPE_NONE || IsAdmin(i)) continue;
  4230. DeletePVar(i, "Warnings");
  4231. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has removed all your warnings.", user);
  4232. count++;
  4233. }
  4234. IRC_GroupNoticeEx(gGroupID, user, "You've removed the warnings for all non-administrators (%d in total).", count);
  4235. return 1;
  4236. }
  4237. IRCCMD:clearwarnings(botid, channel[], user[], host[], params[])
  4238. {
  4239. new id;
  4240. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4241. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4242. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !clearwarnings (nick/id)");
  4243. if(GetPVarType(id, "Warnings") == PLAYER_VARTYPE_NONE) return IRC_GroupNotice(gGroupID, user, "4This player do not have any warnings to clear.");
  4244. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4245. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4246. else
  4247. {
  4248. DeletePVar(id, "Warnings");
  4249. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has removed all your warnings.", user);
  4250. IRC_GroupNoticeEx(gGroupID, user, "You've removed %s's (%d) warnings.", pNick(id), id);
  4251. }
  4252. return 1;
  4253. }
  4254. IRCCMD:mute(botid, channel[], user[], host[], params[])
  4255. {
  4256. new id, reason[51], seconds;
  4257. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4258. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4259. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !mute (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4260. if(reason[50]) return IRC_GroupSay(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4261. if(seconds < 0) return IRC_GroupSay(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4262. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4263. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4264. else
  4265. {
  4266. MuteTime[id][0] = GetTickCount(), MuteTime[id][1] = seconds;
  4267. SetPVarInt(id, "Muted", 1);
  4268. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has muted you. Reason: %s.", user, reason);
  4269. IRC_GroupNoticeEx(gGroupID, user, "You've muted %s (%d). Reason: %s.", pNick(id), id, reason);
  4270. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_MUTE"", pNick(id), id, reason);
  4271. SendMSGToAll(COLOUR_ADMIN, ADMIN_MUTE, pNick(id), id, reason);
  4272. }
  4273. return 1;
  4274. }
  4275. IRCCMD:unmute(botid, channel[], user[], host[], params[])
  4276. {
  4277. new id;
  4278. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4279. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4280. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !unmute (nick/id)");
  4281. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4282. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4283. else
  4284. {
  4285. MuteTime[id][1] = 0;
  4286. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has unmuted you.", user);
  4287. IRC_GroupNoticeEx(gGroupID, user, "You've unmuted %s (%d).", pNick(id), id);
  4288. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_UNMUTE"", pNick(id), id);
  4289. SendMSGToAll(COLOUR_ADMIN, ADMIN_UNMUTE, pNick(id), id);
  4290. DeletePVar(id, "Muted");
  4291. }
  4292. return 1;
  4293. }
  4294. IRCCMD:muteall(botid, channel[], user[], host[], params[])
  4295. {
  4296. new reason[51], seconds;
  4297. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4298. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4299. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !muteall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4300. if(reason[50]) return IRC_GroupSay(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4301. if(seconds < 0) return IRC_GroupSay(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4302. else
  4303. {
  4304. new count;
  4305. foreach(Player, i)
  4306. {
  4307. if(IsAdmin(i)) continue;
  4308. MuteTime[i][0] = GetTickCount(), MuteTime[i][1] = seconds;
  4309. SetPVarInt(i, "Muted", 1);
  4310. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has muted you. Reason: %s.", user, reason);
  4311. count++;
  4312. }
  4313. IRC_GroupNoticeEx(gGroupID, user, "You've muted all non-administrators (%d in total). Reason: %s.", count, reason);
  4314. }
  4315. return 1;
  4316. }
  4317. IRCCMD:unmuteall(botid, channel[], user[], host[], params[])
  4318. {
  4319. new count;
  4320. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4321. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4322. foreach(Player, i)
  4323. {
  4324. if(IsAdmin(i) || GetPVarInt(i, "Muted") == PLAYER_VARTYPE_NONE) continue;
  4325. MuteTime[i][1] = 0;
  4326. SetPVarInt(i, "Muted", 1);
  4327. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has unmuted you.", user);
  4328. }
  4329. IRC_GroupNoticeEx(gGroupID, user, "You've unmuted all non-administrators (%d in total).", count);
  4330. return 1;
  4331. }
  4332. IRCCMD:disarm(botid, channel[], user[], host[], params[])
  4333. {
  4334. new id, reason[51], seconds;
  4335. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4336. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4337. if(sscanf(params, "uD(0)S(No Reason Specified)[50]", id, seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !disarm (nick/id) (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4338. if(reason[50]) return IRC_GroupSay(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4339. if(seconds < 0) return IRC_GroupSay(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4340. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4341. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4342. else
  4343. {
  4344. DisarmTime[id][0] = GetTickCount(), DisarmTime[id][1] = seconds;
  4345. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has disarmed you. Reason: %s.", user, reason);
  4346. IRC_GroupNoticeEx(gGroupID, user, "You've disarmed %s (%d). Reason: %s.", pNick(id), id, reason);
  4347. IsDisarmed{id} = 1;
  4348. }
  4349. return 1;
  4350. }
  4351. IRCCMD:disarmall(botid, channel[], user[], host[], params[])
  4352. {
  4353. new reason[51], seconds;
  4354. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4355. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4356. if(sscanf(params, "D(0)S(No Reason Specified)[50]", seconds, reason)) return IRC_GroupNotice(gGroupID, user, "4Usage: !disarmall (optional: seconds - enter 0 for unlimited) (optional: reason)");
  4357. if(reason[50]) return IRC_GroupSay(gGroupID, user, "4Invalid length. The length must be between 1 and 50 characters.");
  4358. if(seconds < 0) return IRC_GroupSay(gGroupID, user, "4Invalid time input. The time can not be negative. Enter 0 for unlimited time.");
  4359. else
  4360. {
  4361. new count;
  4362. foreach(Player, i)
  4363. {
  4364. if(IsAdmin(i)) continue;
  4365. DisarmTime[i][0] = GetTickCount(), DisarmTime[i][1] = seconds;
  4366. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC has disarmed you. Reason: %s.", user, reason);
  4367. IsDisarmed{i} = 1;
  4368. count++;
  4369. }
  4370. IRC_GroupNoticeEx(gGroupID, user, "You've disarmed all non-administrators (%d in total). Reason: %s.", count, reason);
  4371. }
  4372. return 1;
  4373. }
  4374. IRCCMD:dedisarmall(botid, channel[], user[], host[], params[])
  4375. {
  4376. new count;
  4377. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4378. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4379. foreach(Player, i)
  4380. {
  4381. if(IsAdmin(i) || !IsDisarmed{i}) continue;
  4382. DisarmTime[i][1] = 0;
  4383. SendMSG(i, COLOUR_INFO, "Administrator %s on IRC have de-disarmed you.", user);
  4384. IsDisarmed{i} = 0;
  4385. count++;
  4386. }
  4387. IRC_GroupNoticeEx(gGroupID, user, "You've de-disarmed all non-administrators (%d in total).", count);
  4388. return 1;
  4389. }
  4390. IRCCMD:dedisarm(botid, channel[], user[], host[], params[])
  4391. {
  4392. new id;
  4393. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4394. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4395. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !dedisarm (nick/id)");
  4396. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4397. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4398. else
  4399. {
  4400. DisarmTime[id][1] = 0;
  4401. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC have de-disarmed you.", user);
  4402. IRC_GroupNoticeEx(gGroupID, user, "You've de-disarmed %s (%d).", pNick(id), id);
  4403. IsDisarmed{id} = 0;
  4404. }
  4405. return 1;
  4406. }
  4407. IRCCMD:giveweapon(botid, channel[], user[], host[], params[])
  4408. {
  4409. new id, weapon[21], ammo;
  4410. if(!IRC_IsOp(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need op (+o) or above to use this command.");
  4411. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4412. if(sscanf(params, "us[20]d", id, weapon, ammo)) return IRC_GroupNotice(gGroupID, user, "4Usage: !giveweapon (nick/id) (weapon name) (ammo)");
  4413. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4414. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4415. if(GetWeaponIDFromName(weapon) == -1) return IRC_GroupNotice(gGroupID, user, "4Multiple weapon mames found. Please be more specific.");
  4416. if(GetWeaponIDFromName(weapon) == -2 || weapon[20]) return IRC_GroupNotice(gGroupID, user, "4Invalid weapon name.");
  4417. else
  4418. {
  4419. switch(GetWeaponIDFromName(weapon))
  4420. {
  4421. case 1, 10..13, 17..18, 35..39, 42..45:
  4422. {
  4423. switch(IsAdmin(id))
  4424. {
  4425. case 0: return IRC_GroupNotice(gGroupID, user, "4You can not give this weapon to this player.");
  4426. case 1: GivePlayerWeapon(id, GetWeaponIDFromName(weapon), ammo);
  4427. }
  4428. }
  4429. default:
  4430. {
  4431. GivePlayerWeapon(id, GetWeaponIDFromName(weapon), ammo);
  4432. }
  4433. }
  4434. new weapname[32];
  4435. GetWeaponName(GetWeaponIDFromName(weapon), weapname, sizeof(weapname));
  4436. SendMSG(id, COLOUR_INFO, "Administrator %s on IRC has given you a %s (ID: %d) with %d ammo.", user, weapname, GetWeaponIDFromName(weapname), ammo);
  4437. IRC_GroupNoticeEx(gGroupID, user, "You've given %s (%d) a %s (ID: %d) with %d ammo.", pNick(id), id, weapname, GetWeaponIDFromName(weapname), ammo);
  4438. }
  4439. return 1;
  4440. }
  4441. IRCCMD:giveallweapon(botid, channel[], user[], host[], params[])
  4442. {
  4443. new weapon[21], ammo;
  4444. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4445. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4446. if(sscanf(params, "s[20]d", weapon, ammo)) return IRC_GroupNotice(gGroupID, user, "4Usage: !giveweapon (weapon name) (ammo)");
  4447. if(GetWeaponIDFromName(weapon) == -1) return IRC_GroupNotice(gGroupID, user, "4Multiple weapon mames found. Please be more specific.");
  4448. if(GetWeaponIDFromName(weapon) == -2 || weapon[20]) return IRC_GroupNotice(gGroupID, user, "4Invalid weapon name.");
  4449. else
  4450. {
  4451. switch(GetWeaponIDFromName(weapon))
  4452. {
  4453. case 1, 10..13, 17..18, 35..39, 42..45:
  4454. {
  4455. foreach(Player, i)
  4456. {
  4457. switch(IsAdmin(i))
  4458. {
  4459. case 1: GivePlayerWeapon(i, GetWeaponIDFromName(weapon), ammo);
  4460. }
  4461. }
  4462. }
  4463. default:
  4464. {
  4465. foreach(Player, i)
  4466. {
  4467. GivePlayerWeapon(i, GetWeaponIDFromName(weapon), ammo);
  4468. }
  4469. }
  4470. }
  4471. new weapname[32];
  4472. GetWeaponName(GetWeaponIDFromName(weapon), weapname, sizeof(weapname));
  4473. SendMSGToAll(COLOUR_INFO, "Administrator %s on IRC has given everyone on the server a %s (ID: %d) with %d ammo.", user, weapname, GetWeaponIDFromName(weapname), ammo);
  4474. }
  4475. return 1;
  4476. }
  4477. IRCCMD:crash(botid, channel[], user[], host[], params[])
  4478. {
  4479. new id;
  4480. if(!IRC_IsAdmin(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need admin (+a) or above to use this command.");
  4481. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4482. if(sscanf(params, "u", id)) return IRC_GroupNotice(gGroupID, user, "4Usage: !crash (nick/id)");
  4483. if(!IsPlayerConnected(id)) return IRC_GroupNotice(gGroupID, user, "4Invalid player.");
  4484. if(IsPlayerNPC(id) && !IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command on NPCs.");
  4485. else
  4486. {
  4487. IRC_GroupNoticeEx(gGroupID, user, "You've crashed %s's (%d) game.", pNick(id), id);
  4488. ApplyAnimation(id, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, (5 * 1000));
  4489. }
  4490. return 1;
  4491. }
  4492. IRCCMD:crashall(botid, channel[], user[], host[], params[])
  4493. {
  4494. new count;
  4495. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4496. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4497. foreach(Player, i)
  4498. {
  4499. if(IsAdmin(i)) continue;
  4500. ApplyAnimation(i, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, (5 * 1000));
  4501. count++;
  4502. }
  4503. IRC_GroupNoticeEx(gGroupID, user, "You've crashed the game for all non-administrators (%d in total).", count);
  4504. return 1;
  4505. }
  4506. IRCCMD:botjoin(botid, channel[], user[], host[], params[])
  4507. {
  4508. new chan[51], key[51];
  4509. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4510. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4511. if(sscanf(params, "s[50]S()[50]", chan, key)) return IRC_GroupNotice(gGroupID, user, "4Usage: !botjoin (#channel) (optional: channel key)");
  4512. if(strfind(chan, "#", true) == -1 || chan[50]) return IRC_GroupNotice(gGroupID, user, "4Usage: !botjoin (#channel) (optional: channel key)");
  4513. if(key[50]) return IRC_GroupNotice(gGroupID, user, "4Invalid channel key length. The length must be between 0 (no channel key) and 50 characters.");
  4514. switch(strlen(key))
  4515. {
  4516. case 0: IRC_GroupNoticeEx(gGroupID, user, "Attempting to join the channel %s...", chan);
  4517. default: IRC_GroupNoticeEx(gGroupID, user, "Attempting to join the channel %s with the key \"%s\"...", chan, key);
  4518. }
  4519. for(new bot = 1; bot <= IRC_MAX_BOTS; bot++)
  4520. {
  4521. IRC_JoinChannel(bot, chan, key);
  4522. }
  4523. return 1;
  4524. }
  4525. IRCCMD:botleave(botid, channel[], user[], host[], params[])
  4526. {
  4527. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4528. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4529. if(strfind(params, "#", true) == -1 || isnull(params)) return IRC_GroupNotice(gGroupID, user, "4Usage: !botleave (#channel)");
  4530. IRC_GroupNoticeEx(gGroupID, user, "Leaving channel %s...", params);
  4531. for(new bot = 1; bot <= IRC_MAX_BOTS; bot++)
  4532. {
  4533. IRC_PartChannel(bot, params);
  4534. }
  4535. return 1;
  4536. }
  4537. IRCCMD:botregister(botid, channel[], user[], host[], params[])
  4538. {
  4539. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4540. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4541. for(new bot = 1; bot <= IRC_MAX_BOTS; bot++)
  4542. {
  4543. switch(bot)
  4544. {
  4545. case 1:
  4546. {
  4547. new string[50];
  4548. format(string, sizeof(string), "ns register %s %s", IRC_BOT_PASSWORD, IRC_BOT_EMAIL);
  4549. IRC_SendRaw(bot, string);
  4550. }
  4551. default: SetTimerEx("IRC_RegisterDelay", (IRC_REGISTER_DELAY * bot), false, "d", bot);
  4552. }
  4553. }
  4554. IRC_GroupNoticeEx(gGroupID, user, "Attempting to register the bots nicknames with password \"%s\" and e-mail \"%s\".", IRC_BOT_PASSWORD, IRC_BOT_EMAIL);
  4555. return 1;
  4556. }
  4557. IRCCMD:botidentify(botid, channel[], user[], host[], params[])
  4558. {
  4559. if(!IRC_IsOwner(botid, channel, user)) return IRC_GroupNotice(gGroupID, user, "4You need owner (+q) to use this command.");
  4560. if(strcmp(channel, IRC_ECHO_CHANNEL, true) && strcmp(channel, IRC_ADMIN_ECHO_CHANNEL, true) && strcmp(channel, IRC_CHANNEL, true)) return IRC_GroupNotice(gGroupID, user, "4This command can only be used on "IRC_ECHO_CHANNEL", "IRC_ADMIN_ECHO_CHANNEL" and "IRC_CHANNEL".");
  4561. new string[50];
  4562. for(new bot = 1; bot <= IRC_MAX_BOTS; bot++)
  4563. {
  4564. format(string, sizeof(string), "ns register %s %s", IRC_BOT_PASSWORD, IRC_BOT_EMAIL);
  4565. IRC_SendRaw(botid, string);
  4566. }
  4567. IRC_GroupNoticeEx(gGroupID, user, "Attempting to identify with nickserv using the password \"%s\".", IRC_BOT_PASSWORD);
  4568. return 1;
  4569. }
  4570. //==============================================================================
  4571. #endif
  4572. //==============================================================================
  4573. // Functions
  4574. //==============================================================================
  4575. stock KickEx(playerid, kick_type, reason[], admin = INVALID_PLAYER_ID, sendmsg = 1)
  4576. {
  4577. #pragma unused admin
  4578. new kick_t[8];
  4579. ClearChat(0, playerid);
  4580. switch(kick_type)
  4581. {
  4582. case 0:
  4583. {
  4584. kick_t = "Server";
  4585. #if defined GA_SAVE_LOGS
  4586. new log[128];
  4587. format(log, 256, "%s (%d) was kicked for %s.", pNick(playerid), playerid, reason);
  4588. SaveLog("/MAdmin/Logs/ServerKicks.txt", log);
  4589. #endif
  4590. #if defined GA_USE_IRC
  4591. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"SERVER_KICK"", pNick(playerid), playerid, reason);
  4592. #endif
  4593. printf("[server kick] %s (%d) has been kicked. Reason: %s.", pNick(playerid), playerid, reason);
  4594. SendMSGToAll(COLOUR_ADMIN, SERVER_KICK, pNick(playerid), playerid, reason);
  4595. }
  4596. case 1:
  4597. {
  4598. new log[128];
  4599. kick_t = "Admin";
  4600. #if defined GA_SAVE_LOGS
  4601. format(log, 256, "%s (%d) was kicked for %s by %s (%d).", pNick(playerid), playerid, reason, pNick(admin), admin);
  4602. SaveLog("/MAdmin/Logs/AdminKicks.txt", log);
  4603. #endif
  4604. format(log, 128, "%s (%d) was kicked by %s (%d) for \"%s\".", pNick(playerid), playerid, pNick(admin), admin, reason);
  4605. foreach(Player, i)
  4606. {
  4607. if(!IsPlayerAdmin(i) || GetPVarInt(i, "Level") < GetPVarInt(admin, "Level")) continue;
  4608. SendClientMessage(i, COLOUR_ADMIN, log);
  4609.  
  4610. }
  4611. if(sendmsg == 1)
  4612. {
  4613. #if defined GA_USE_IRC
  4614. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[kick] 3%s (%d) kicked %s (%d) for %s.", pNick(admin), admin, pNick(playerid), playerid, reason);
  4615. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_KICK"", pNick(playerid), playerid, reason);
  4616. #endif
  4617. printf("[admin kick] %s (%d) kicked %s (%d). Reason: %s.", pNick(admin), admin, pNick(playerid), playerid, reason);
  4618. SendMSGToAll(COLOUR_ADMIN, ADMIN_KICK, pNick(playerid), playerid, reason);
  4619. SendMSG(admin, COLOUR_INFO, I_KICK_MSG, pNick(playerid), playerid, reason);
  4620. }
  4621. }
  4622. }
  4623. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_KICK_INFORMATION, GetPlayerIpEx(playerid), pNick(playerid), kick_t, reason);
  4624. SendMSG(playerid, COLOUR_INFO, KICK_PLAYER_MSG, reason);
  4625. GameTextForPlayer(playerid, KICK_GAMETEXT, (999999 * 999999), 3);
  4626. SetTimerEx("KickPlayer", GA_KICK_DELAY, false, "i", playerid);
  4627. return 1;
  4628. }
  4629. function KickPlayer(playerid) return Kick(playerid);
  4630. stock BanEx2(playerid, ban_type, reason[], admin = INVALID_PLAYER_ID, sendmsg = 1)
  4631. {
  4632. #pragma unused admin
  4633. ClearChat(0, playerid);
  4634. new log[128], ban_t[8], filename[ACCOUNTPATH_LENGTH];
  4635. switch(ban_type)
  4636. {
  4637. case 0:
  4638. {
  4639. ban_t = "Server";
  4640. #if defined GA_SAVE_LOGS
  4641. format(log, 256, "%s (%d) was banned for %s.", pNick(playerid), playerid, reason);
  4642. SaveLog("/MAdmin/Logs/ServerBans.txt", log);
  4643. #endif
  4644. #if defined GA_USE_IRC
  4645. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"SERVER_BAN"", pNick(playerid), playerid, reason);
  4646. #endif
  4647. printf("[server ban] %s (%d) has been banned. Reason: %s.", pNick(playerid), playerid, reason);
  4648. SendMSGToAll(COLOUR_ADMIN, SERVER_BAN, pNick(playerid), playerid, reason);
  4649. }
  4650. case 1:
  4651. {
  4652. ban_t = "Admin";
  4653. #if defined GA_SAVE_LOGS
  4654. format(log, 128, "%s (%d) was banned by %s (%d) for %s.", pNick(playerid), playerid, pNick(admin), admin, reason);
  4655. SaveLog("/MAdmin/Logs/AdminBans.txt", log);
  4656. #endif
  4657. format(log, 128, "%s (%d) was banned by %s (%d) for \"%s\".", pNick(playerid), playerid, pNick(admin), admin, reason);
  4658. foreach(Player, i)
  4659. {
  4660. if(!IsPlayerAdmin(i) || GetPVarInt(i, "Level") < GetPVarInt(admin, "Level")) continue;
  4661. SendClientMessage(i, COLOUR_ADMIN, log);
  4662.  
  4663. }
  4664. if(sendmsg == 1)
  4665. {
  4666. #if defined GA_USE_IRC
  4667. IRC_GroupSayEx(gGroupID, IRC_ADMIN_ECHO_CHANNEL, "7[ban] 3%s (%d) banned %s (%d) for %s.", pNick(admin), admin, pNick(playerid), playerid, reason);
  4668. IRC_GroupSayEx(gGroupID, IRC_ECHO_CHANNEL, "13"ADMIN_BAN"", pNick(playerid), playerid, reason);
  4669. #endif
  4670. printf("[admin ban] %s (%d) banned %s (%d). Reason: %s.", pNick(admin), admin, pNick(playerid), playerid, reason);
  4671. SendMSG(admin, COLOUR_INFO, I_BAN_MSG, pNick(playerid), playerid, reason);
  4672. SendMSGToAll(COLOUR_ADMIN, ADMIN_BAN, pNick(playerid), playerid, reason);
  4673. }
  4674. }
  4675. }
  4676. ShowPlayerDialogEx(playerid, GA_INFOMENU, DIALOG_STYLE_MSGBOX, GA_DC_HEADER, "Close", "", I_BAN_INFORMATION, GetPlayerIpEx(playerid), pNick(playerid), ban_t, reason);
  4677. SendMSG(playerid, COLOUR_INFO, BAN_PLAYER_MSG, reason);
  4678. GameTextForPlayer(playerid, BAN_GAMETEXT, (999999 * 999999), 3);
  4679. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  4680. if(fexist(filename))
  4681. {
  4682. new INI:PFile;
  4683. PFile = INI_Open(filename);
  4684. INI_WriteInt(PFile, "Banned", 1);
  4685. INI_Close(PFile);
  4686. }
  4687. #if defined GA_USE_SAMPBAN
  4688. BanEx(playerid, reason);
  4689. #else
  4690. new File:file = fopen(BANFILE, io_append);
  4691. if(!file)
  4692. {
  4693. fcreate(BANFILE);
  4694. }
  4695. log = "";
  4696. new date[3], time[3];
  4697. getdate(date[2], date[1], date[0]), gettime(time[0], time[1], time[2]);
  4698. switch(ban_type)
  4699. {
  4700. case 0: format(log, sizeof(log), "%s|%s|%s|SERVER|SERVER|%02d/%02d/%02d - %02d:%02d:%02d\n\r", GetPlayerIpEx(playerid), pNick(playerid), reason, date[0], date[1], date[2], time[0], time[1], time[2]);
  4701. case 1: format(log, sizeof(log), "%s|%s|%s|ADMIN|%s|%02d/%02d/%02d - %02d:%02d:%02d\n\r", GetPlayerIpEx(playerid), pNick(playerid), reason, pNick(admin), date[0], date[1], date[2], time[0], time[1], time[2]);
  4702. }
  4703. fwrite(file, log);
  4704. fclose(file);
  4705. Kick(playerid);
  4706. #endif
  4707. return 1;
  4708. }
  4709. stock pNick(playerid)
  4710. {
  4711. new GI_nick[MAX_PLAYER_NAME];
  4712. GetPlayerName(playerid, GI_nick, MAX_PLAYER_NAME);
  4713. return GI_nick;
  4714. }
  4715. stock UncagePlayer(playerid)
  4716. {
  4717. if(GetPVarInt(playerid, "CageObject") != -1)
  4718. {
  4719. DestroyDynamicObject(GetPVarInt(playerid, "CageObject"));
  4720. DeletePVar(playerid, "CageObjects");
  4721. }
  4722. return 1;
  4723. }
  4724. stock CagePlayer(playerid)
  4725. {
  4726. if(GetPVarInt(playerid, "CageObject") != -1)
  4727. {
  4728. DestroyDynamicObject(GetPVarInt(playerid, "CageObject"));
  4729. }
  4730. new Float:X, Float:Y, Float:Z;
  4731. GetPlayerPos(playerid, X, Y, Z);
  4732. SetPVarInt(playerid, "CageObject", CreateDynamicObject(19074, X, Y, (Z+8.0), 0, 0, 0, -1, -1, -1, 75));
  4733. Streamer_UpdateEx(playerid, X, Y, Z);
  4734. SetPlayerPos(playerid, X, Y, (Z+9.5));
  4735. return 1;
  4736. }
  4737. function InitLogin(playerid, name[], value[])
  4738. {
  4739. if(!strcmp(name, "LastIP", true))
  4740. {
  4741. SetPVarString(playerid, "GA_TMP_LASTIP", value);
  4742. }
  4743. if(!strcmp(name, "PasswordHash", true))
  4744. {
  4745. format(pwhash[playerid], 130, "%s", value);
  4746. }
  4747. if(!strcmp(name, "Level", true))
  4748. {
  4749. SetPVarInt(playerid, "tmpLevel", strval(value));
  4750. }
  4751. }
  4752. function UnbanPlayer(playerid, name[], value[])
  4753. {
  4754. if(!strcmp(name, "LastIP", true))
  4755. {
  4756. SetPVarString(playerid, "UnbanPlayerIP", value);
  4757. }
  4758. if(!strcmp(name, "Banned", true))
  4759. {
  4760. SetPVarInt(playerid, "UnbanPlayerBanned", strval(value));
  4761. }
  4762. }
  4763. function ConnectTime(playerid, name[], value[])
  4764. {
  4765. if(!strcmp(name, "DaysConnected", true))
  4766. {
  4767. SetPVarInt(playerid, "DaysConnected", strval(value));
  4768. }
  4769. if(!strcmp(name, "HoursConnected", true))
  4770. {
  4771. SetPVarInt(playerid, "HoursConnected", strval(value));
  4772. }
  4773. if(!strcmp(name, "MinutesConnected", true))
  4774. {
  4775. SetPVarInt(playerid, "MinutesConnected", strval(value));
  4776. }
  4777. return 1;
  4778. }
  4779. function LoginPlayer(playerid, name[], value[])
  4780. {
  4781. if(!strcmp(name, "LastIP", true))
  4782. {
  4783. if(strcmp(value, GetPlayerIpEx(playerid), true))
  4784. {
  4785. new INI:file, filename[ACCOUNTPATH_LENGTH];
  4786. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  4787. file = INI_Open(filename);
  4788. INI_WriteString(file, "LastIP", GetPlayerIpEx(playerid));
  4789. INI_Close(file);
  4790. }
  4791. }
  4792. if(!strcmp(name, "Level", true)) { SetPVarInt(playerid, "Level", strval(value)); }
  4793. if(!strcmp(name, "VIP", true)) { SetPVarInt(playerid, "VIP", strval(value)); }
  4794. #if defined GA_SAVE_KILLS
  4795. if(!strcmp(name, "Kills", true)) { SetPVarInt(playerid, "Kills", strval(value)); }
  4796. #endif
  4797. #if defined GA_SAVE_DEATHS
  4798. if(!strcmp(name, "Deaths", true)) { SetPVarInt(playerid, "Deaths", strval(value)); }
  4799. #endif
  4800. #if defined GA_SAVE_SKIN
  4801. if(!strcmp(name, "Skin", true)) { SetPlayerSkin(playerid, strval(value)); }
  4802. #endif
  4803. #if defined GA_SAVE_SCORE
  4804. if(!strcmp(name, "Score", true)) { SetPlayerScore(playerid, strval(value)); }
  4805. #endif
  4806. #if defined GA_SAVE_MONEY
  4807. if(!strcmp(name, "Money", true)) { GivePlayerMoney(playerid, strval(value)); }
  4808. #endif
  4809. #if defined GA_SAVE_WANTEDLEVEL
  4810. if(!strcmp(name, "WantedLevel", true)) { SetPlayerWantedLevel(playerid, strval(value)); }
  4811. #endif
  4812. #if defined GA_SAVE_DRUNKLEVEL
  4813. if(!strcmp(name, "DrunkLevel", true)){ SetPlayerDrunkLevel(playerid, strval(value)); }
  4814. #endif
  4815. #if defined GA_SAVE_FIGHTSTYLE
  4816. if(!strcmp(name, "FightStyle", true)) { SetPlayerFightingStyle(playerid, strval(value)); }
  4817. #endif
  4818. if(!strcmp(name, "DaysConnected", true)) { SetPVarInt(playerid, "DaysConnected", strval(value)); }
  4819. if(!strcmp(name, "HoursConnected", true)) { SetPVarInt(playerid, "HoursConnected", strval(value)); }
  4820. if(!strcmp(name, "MinutesConnected", true)) { SetPVarInt(playerid, "MinutesConnected", strval(value)); }
  4821. if(!strcmp(name, "W1", true)) { SetPVarInt(playerid, "W1", strval(value)); }
  4822. if(!strcmp(name, "W1Ammo", true)) { SetPVarInt(playerid, "W1Ammo", strval(value)); }
  4823. if(!strcmp(name, "W2", true)) { SetPVarInt(playerid, "W2", strval(value)); }
  4824. if(!strcmp(name, "W2Ammo", true)) { SetPVarInt(playerid, "W2Ammo", strval(value)); }
  4825. if(!strcmp(name, "W3", true)) { SetPVarInt(playerid, "W3", strval(value)); }
  4826. if(!strcmp(name, "W3Ammo", true)) { SetPVarInt(playerid, "W3Ammo", strval(value)); }
  4827. if(!strcmp(name, "W4", true)) { SetPVarInt(playerid, "W4", strval(value)); }
  4828. if(!strcmp(name, "W4Ammo", true)) { SetPVarInt(playerid, "W4Ammo", strval(value)); }
  4829. if(!strcmp(name, "W5", true)) { SetPVarInt(playerid, "W5", strval(value)); }
  4830. if(!strcmp(name, "W5Ammo", true)) { SetPVarInt(playerid, "W5Ammo", strval(value)); }
  4831. if(!strcmp(name, "W6", true)) { SetPVarInt(playerid, "W6", strval(value)); }
  4832. if(!strcmp(name, "W6Ammo", true)) { SetPVarInt(playerid, "W6Ammo", strval(value)); }
  4833. if(!strcmp(name, "W7", true)) { SetPVarInt(playerid, "W7", strval(value)); }
  4834. if(!strcmp(name, "W7Ammo", true)) { SetPVarInt(playerid, "W7Ammo", strval(value)); }
  4835. if(!strcmp(name, "W8", true)) { SetPVarInt(playerid, "W8", strval(value)); }
  4836. if(!strcmp(name, "W8Ammo", true)) { SetPVarInt(playerid, "W8Ammo", strval(value)); }
  4837. if(!strcmp(name, "W9", true)) { SetPVarInt(playerid, "W9", strval(value)); }
  4838. if(!strcmp(name, "W9Ammo", true)) { SetPVarInt(playerid, "W9Ammo", strval(value)); }
  4839. if(!strcmp(name, "W10", true)) { SetPVarInt(playerid, "W10", strval(value)); }
  4840. if(!strcmp(name, "W10Ammo", true)) { SetPVarInt(playerid, "W10Ammo", strval(value)); }
  4841. if(!strcmp(name, "W11", true)) { SetPVarInt(playerid, "W11", strval(value)); }
  4842. if(!strcmp(name, "W11Ammo", true)) { SetPVarInt(playerid, "W11Ammo", strval(value)); }
  4843. if(!strcmp(name, "W12", true)) { SetPVarInt(playerid, "W12", strval(value)); }
  4844. if(!strcmp(name, "W12Ammo", true)) { SetPVarInt(playerid, "W12Ammo", strval(value)); }
  4845. if(GetPVarType(playerid, "W12Ammo") >= 1)
  4846. {
  4847. new weapstring[8], tmp;
  4848. for(new weap = 0; weap <= 12; weap++)
  4849. {
  4850. #if !defined GA_SAVE_ADMINWEAPONS
  4851. if(weap == 8 || weap == 7 || weap == 12) continue;
  4852. #endif
  4853. format(weapstring, sizeof(weapstring), "W%d", weap);
  4854. #if !defined GA_SAVE_ADMINWEAPONS
  4855. if((weap == 9 && tmp == 43) || (weap == 11 && tmp != 46)) continue;
  4856. #endif
  4857. tmp = GetPVarInt(playerid, weapstring);
  4858. DeletePVar(playerid, weapstring);
  4859. format(weapstring, sizeof(weapstring), "W%dAmmo", weap);
  4860. GivePlayerWeapon(playerid, tmp, GetPVarInt(playerid, weapstring));
  4861. DeletePVar(playerid, weapstring);
  4862. }
  4863. }
  4864. }
  4865. stock UpdateConnectTime(playerid)
  4866. {
  4867. new INI:file, filename[ACCOUNTPATH_LENGTH], pTime[25], time[3];
  4868. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  4869. if(fexist(filename) && GetPVarInt(playerid, "LoggedIn") == 1)
  4870. {
  4871. INI_ParseFile(filename, "ConnectTime", false, true, playerid, true, false);
  4872. ConvertTime(GetSecondsBetweenAction(GetPVarInt(playerid, "ConnectTime")), time[0], time[1], time[2]);
  4873. time[2] += GetPVarInt(playerid, "DaysConnected"), time[1] += GetPVarInt(playerid, "HoursConnected"), time[0] += GetPVarInt(playerid, "MinutesConnected");
  4874. SetPVarInt(playerid, "DaysConnected", time[2]);
  4875. SetPVarInt(playerid, "HoursConnected", time[1]);
  4876. SetPVarInt(playerid, "MinutesConnected", time[0]);
  4877. format(pTime, sizeof(pTime), "%d:%d:%d", time[2], time[1], time[0]);
  4878. file = INI_Open(filename);
  4879. INI_WriteString(file, "TimeConnected", pTime);
  4880. INI_Close(file);
  4881. }
  4882. return 1;
  4883. }
  4884. stock SavePlayerStats(playerid)
  4885. {
  4886. new INI:file, filename[ACCOUNTPATH_LENGTH];
  4887. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  4888. if(fexist(filename) && GetPVarInt(playerid, "LoggedIn") == 1)
  4889. {
  4890. UpdateConnectTime(playerid);
  4891. file = INI_Open(filename);
  4892. INI_WriteInt(file, "Level", GetPVarInt(playerid, "Level"));
  4893. INI_WriteInt(file, "VIP", GetPVarInt(playerid, "VIP"));
  4894. #if defined GA_SAVE_DEATHS
  4895. INI_WriteInt(file, "Deaths", GetPVarInt(playerid, "Deaths"));
  4896. #endif
  4897. #if defined GA_SAVE_KILLS
  4898. INI_WriteInt(file, "Kills", GetPVarInt(playerid, "Kills"));
  4899. #endif
  4900. #if defined GA_SAVE_SKIN
  4901. INI_WriteInt(file, "Skin", GetPlayerSkin(playerid));
  4902. #endif
  4903. #if defined GA_SAVE_SCORE
  4904. INI_WriteInt(file, "Score", GetPlayerScore(playerid));
  4905. #endif
  4906. #if defined GA_SAVE_MONEY
  4907. INI_WriteInt(file, "Money", GetPlayerMoney(playerid));
  4908. #endif
  4909. #if defined GA_SAVE_WANTEDLEVEL
  4910. INI_WriteInt(file, "WantedLevel", GetPlayerWantedLevel(playerid));
  4911. #endif
  4912. #if defined GA_SAVE_DRUNKLEVEL
  4913. INI_WriteInt(file, "DrunkLevel", GetPlayerDrunkLevel(playerid));
  4914. #endif
  4915. #if defined GA_SAVE_FIGHTSTYLE
  4916. INI_WriteInt(file, "FightStyle", GetPlayerFightingStyle(playerid));
  4917. #endif
  4918. #if defined GA_SAVE_WEAPONS
  4919. new Weapons[14][2], weapstring[8];
  4920. for(new weap = 0; weap <= 12; weap++)
  4921. {
  4922. GetPlayerWeaponData(playerid, weap, Weapons[weap][0], Weapons[weap][1]);
  4923. format(weapstring, sizeof(weapstring), "W%d", weap);
  4924. INI_WriteInt(file, weapstring, Weapons[weap][0]);
  4925. format(weapstring, sizeof(weapstring), "W%dAmmo", weap);
  4926. INI_WriteInt(file, weapstring, Weapons[weap][1]);
  4927. }
  4928. #endif
  4929. INI_Close(file);
  4930. }
  4931. return 1;
  4932. }
  4933. stock SaveLog(filename[], text[], timestamp = 1)
  4934. {
  4935. new File:gFile, year, month, day, hour, minute, second, log[256];
  4936. getdate(year, month, day); gettime(hour, minute, second);
  4937. if(!fexist(filename))
  4938. {
  4939. gFile = fopen(filename, io_write);
  4940. fclose(gFile);
  4941. }
  4942. gFile = fopen(filename, io_append);
  4943. switch(timestamp)
  4944. {
  4945. case 0: format(log, sizeof(log), "%s\n\r", day, month, year, hour, minute, second, text);
  4946. case 1: format(log, sizeof(log), "[%02d/%02d/%02d %02d:%02d:%02d] %s\n\r", day, month, year, hour, minute, second, text);
  4947. }
  4948. fwrite(gFile, log);
  4949. fclose(gFile);
  4950. return 1;
  4951. }
  4952. stock SendAdminCommand(playerid, command[])
  4953. {
  4954. if(IsPlayerConnected(playerid))
  4955. {
  4956. #if defined GA_SAVE_LOGS
  4957. new log[128];
  4958. format(log, sizeof(log), "%s (%d) has used the command /%s. Admin level: %d", pNick(playerid), playerid, command, GetPVarInt(playerid, "Level"));
  4959. SaveLog("/MAdmin/Logs/AdminCommands.txt", log);
  4960. #endif
  4961. foreach(Player, i)
  4962. {
  4963. if(i == playerid || !IsAdmin(i)) continue;
  4964. if(GetPVarInt(i, "Level") >= GetPVarInt(playerid, "Level"))
  4965. {
  4966. SendMSG(i, COLOUR_ADMIN, ADMIN_CMD_MSG, pNick(playerid), playerid, command);
  4967. }
  4968. }
  4969. }
  4970. return 1;
  4971. }
  4972. stock SendAdminMessage(playerid, message[], level_check = 0)
  4973. {
  4974. foreach(Player, i)
  4975. {
  4976. if(i == playerid || || !IsAdmin(i)) continue;
  4977. if(level_check == 0)
  4978. {
  4979. SendClientMessage(i, COLOUR_ADMIN, message);
  4980. }
  4981. if(GetPVarInt(i, "Level") >= GetPVarInt(playerid, "Level") && level_check == 1)
  4982. {
  4983. SendClientMessage(i, COLOUR_ADMIN, message);
  4984. }
  4985. }
  4986. return 1;
  4987. }
  4988. stock fcreate(filename[])
  4989. {
  4990. if(fexist(filename)) return 0;
  4991. new File:file = fopen(filename, io_write);
  4992. fclose(file);
  4993. return 1;
  4994. }
  4995. stock IsRegistered(playerid)
  4996. {
  4997. new filename[ACCOUNTPATH_LENGTH];
  4998. format(filename, 50, ACCOUNTPATH, UserFileName(pNick(playerid)));
  4999. return (fexist(filename)) ? (1) : (0);
  5000. }
  5001. stock IsValidSkin(skinid)
  5002. {
  5003. switch(skinid)
  5004. {
  5005. case 3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 273, 289: return 0;
  5006. }
  5007. if(skinid >= 300) return 0;
  5008. return 1;
  5009. }
  5010. stock GetWeaponIDFromName(wname[])
  5011. {
  5012. new rtvalue = strval(wname), attempt, WeapName[20];
  5013. if(rtvalue < 1 || rtvalue > 46)
  5014. {
  5015. for(new i; i < 47; i++)
  5016. {
  5017. GetWeaponName(i, WeapName, 20);
  5018. if(strfind(WeapName, wname, true) != -1)
  5019. {
  5020. attempt++;
  5021. rtvalue = i;
  5022. }
  5023. }
  5024. if(attempt > 1) return -1;
  5025. if(attempt == 0) return -2;
  5026. }
  5027. return rtvalue;
  5028. }
  5029. stock GetPVarStringEx(playerid, varname[])
  5030. {
  5031. new str[130];
  5032. GetPVarString(playerid, varname, str, 130);
  5033. return str;
  5034. }
  5035. stock RangeBan(playerid, ranges = 0)
  5036. {
  5037. new ip[16];
  5038. if(!GetPlayerIp(playerid, ip, 16) || ranges > 3) return 0;
  5039. new i = 16 - 1, last = sizeof(ip);
  5040. while(i >= 0 && last != -1)
  5041. {
  5042. if(ip[--i] == '.' || !i)
  5043. {
  5044. if(!ranges--)
  5045. {
  5046. format(ip, sizeof ip, "banip %s", ip);
  5047. SendRconCommand(ip);
  5048. last = -1;
  5049. }
  5050. else
  5051. {
  5052. ip[i + 1] = '*';
  5053. strdel(ip, i + 2, last);
  5054. last = i;
  5055. }
  5056. }
  5057. }
  5058. return 1;
  5059. }
  5060. stock IsMonth31(month)
  5061. {
  5062. switch(month)
  5063. {
  5064. case 1, 3, 5, 7, 8, 10, 12: return 1;
  5065. }
  5066. return 0;
  5067. }
  5068.  
  5069. stock IsMonth29(year)
  5070. {
  5071. new y = 2000;
  5072. for(new i = 4; i < 3000; i += 4)
  5073. {
  5074. if ((y + i) == year)
  5075. {
  5076. return 1;
  5077. }
  5078. }
  5079. return 0;
  5080. }
  5081. stock fdelete_line(filename[], line[])
  5082. {
  5083. if(fexist(filename)) return 0;
  5084. new line2[128], File:tmpfile, File:existingfile, randfilename[12];
  5085. format(randfilename, sizeof(randfilename), "%d.txt", random(125000));
  5086. fcreate(randfilename);
  5087. existingfile = fopen(filename, io_read);
  5088. tmpfile = fopen(randfilename, io_append);
  5089. while(fread(existingfile, line2, sizeof(line2)))
  5090. {
  5091. if(strfind(line2, line, true) == -1)
  5092. {
  5093. CMDSString = "";
  5094. format(CMDSString, sizeof(CMDSString), "%s\n\r", line2);
  5095. fwrite(tmpfile, CMDSString);
  5096. }
  5097. }
  5098. fclose(existingfile), fclose(tmpfile);
  5099. fremove(filename);
  5100. fcreate(filename);
  5101. existingfile = fopen(filename, io_append);
  5102. tmpfile = fopen(randfilename, io_read);
  5103. while(fread(tmpfile, line2, sizeof(line2)))
  5104. {
  5105. if(strfind(line2, line, true) == -1)
  5106. {
  5107. CMDSString = "";
  5108. format(CMDSString, sizeof(CMDSString), "%s\n\r", line2);
  5109. fwrite(existingfile, CMDSString);
  5110. }
  5111. }
  5112. fclose(existingfile), fclose(tmpfile), fremove(randfilename);
  5113. return 1;
  5114. }
  5115. stock BanCheck(playerid)
  5116. {
  5117. new line[128], year[2], month[2], day[2], ip[16], filename[ACCOUNTPATH_LENGTH], File:file, reason[61], kicker[8], admin[(MAX_PLAYER_NAME + 1)], user[(MAX_PLAYER_NAME + 1)], date[21];
  5118. getdate(year[0], month[0], day[0]);
  5119. file = fopen(TEMPBAN, io_read);
  5120. if(file)
  5121. {
  5122. while(fread(file, line, sizeof(line)))
  5123. {
  5124. sscanf(line, "p<|>ddds[16]s["#MAX_PLAYER_NAME"]s[20]", day[1], month[1], year[1], ip, user, date);
  5125. if(!strcmp(GetPlayerIpEx(playerid), ip, true))
  5126. {
  5127. if(!(year[0] >= year[1] && month[0] >= month[1] && day[0] >= day[1]))
  5128. {
  5129. format(line, sizeof(line), "Temporaly Banned Until %d/%d/%d", day[1], month[1], year[1]);
  5130. KickEx(playerid, SERVER, line);
  5131. return 1;
  5132. }
  5133. else fdelete_line(TEMPBAN, line);
  5134. }
  5135. }
  5136. }
  5137. #if !defined GA_USE_SAMPBAN
  5138. file = fopen(BANFILE, io_read);
  5139. if(file)
  5140. {
  5141. while(fread(file, line, sizeof(line)))
  5142. {
  5143. sscanf(line, "p<|>s[16]s["#MAX_PLAYER_NAME"]s[60]s[7]s["#MAX_PLAYER_NAME"]s[20]", ip, user, reason, kicker, admin, date);
  5144. if(!strcmp(GetPlayerIpEx(playerid), ip, true))
  5145. {
  5146. KickEx(playerid, SERVER, "IP Marked as Banned");
  5147. return 1;
  5148. }
  5149. }
  5150. }
  5151. #endif
  5152. format(filename, sizeof(filename), ACCOUNTPATH, UserFileName(pNick(playerid)));
  5153. if(fexist(filename))
  5154. {
  5155. INI_ParseFile(filename, "UnbanPlayer", false, true, playerid, true, false);
  5156. if(GetPVarInt(playerid, "UnbanPlayerBanned") == 1)
  5157. {
  5158. switch(BANEVADE_ACTION)
  5159. {
  5160. case 0: KickEx(playerid, SERVER, "Account Marked As Banned");
  5161. case 1: BanEx2(playerid, SERVER, "Account Marked As Banned");
  5162. }
  5163. return 1;
  5164. }
  5165. }
  5166. return 0;
  5167. }
  5168. stock GetDeathReason(killerid, reason)
  5169. {
  5170. new ReasonMsg[32];
  5171. if(killerid != INVALID_PLAYER_ID)
  5172. {
  5173. switch(reason)
  5174. {
  5175. case 0: ReasonMsg = "Unarmed";
  5176. case 1: ReasonMsg = "Brass Knuckles";
  5177. case 2: ReasonMsg = "Golf Club";
  5178. case 3: ReasonMsg = "Night Stick";
  5179. case 4: ReasonMsg = "Knife";
  5180. case 5: ReasonMsg = "Baseball Bat";
  5181. case 6: ReasonMsg = "Shovel";
  5182. case 7: ReasonMsg = "Pool Cue";
  5183. case 8: ReasonMsg = "Katana";
  5184. case 9: ReasonMsg = "Chainsaw";
  5185. case 10: ReasonMsg = "Dildo";
  5186. case 11: ReasonMsg = "Dildo";
  5187. case 12: ReasonMsg = "Vibrator";
  5188. case 13: ReasonMsg = "Vibrator";
  5189. case 14: ReasonMsg = "Flowers";
  5190. case 15: ReasonMsg = "Cane";
  5191. case 22: ReasonMsg = "Pistol";
  5192. case 23: ReasonMsg = "Silenced Pistol";
  5193. case 24: ReasonMsg = "Desert Eagle";
  5194. case 25: ReasonMsg = "Shotgun";
  5195. case 26: ReasonMsg = "Sawn-off Shotgun";
  5196. case 27: ReasonMsg = "Combat Shotgun";
  5197. case 28: ReasonMsg = "MAC-10";
  5198. case 29: ReasonMsg = "MP5";
  5199. case 30: ReasonMsg = "AK-47";
  5200. case 31:
  5201. {
  5202. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  5203. {
  5204. switch(GetVehicleModel(GetPlayerVehicleID(killerid)))
  5205. {
  5206. case 447: ReasonMsg = "Sea Sparrow Machine Gun";
  5207. default: ReasonMsg = "M4";
  5208. }
  5209. }
  5210. else
  5211. {
  5212. ReasonMsg = "M4";
  5213. }
  5214. }
  5215. case 32: ReasonMsg = "TEC-9";
  5216. case 33: ReasonMsg = "Rifle";
  5217. case 34: ReasonMsg = "Sniper Rifle";
  5218. case 37: ReasonMsg = "Fire";
  5219. case 38:
  5220. {
  5221. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  5222. {
  5223. switch(GetVehicleModel(GetPlayerVehicleID(killerid)))
  5224. {
  5225. case 425: ReasonMsg = "Hunter Machine Gun";
  5226. default: ReasonMsg = "Minigun";
  5227. }
  5228. }
  5229. else
  5230. {
  5231. ReasonMsg = "Minigun";
  5232. }
  5233. }
  5234. case 41: ReasonMsg = "Spraycan";
  5235. case 42: ReasonMsg = "Fire Extinguisher";
  5236. case 49: ReasonMsg = "Vehicle Collision";
  5237. case 50:
  5238. {
  5239. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  5240. {
  5241. switch(GetVehicleModel(GetPlayerVehicleID(killerid)))
  5242. {
  5243. case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563: ReasonMsg = "Helicopter Blades";
  5244. default: ReasonMsg = "Vehicle Collision";
  5245. }
  5246. }
  5247. else ReasonMsg = "Vehicle Collision";
  5248. }
  5249. case 51:
  5250. {
  5251. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  5252. {
  5253. switch(GetVehicleModel(GetPlayerVehicleID(killerid)))
  5254. {
  5255. case 425: ReasonMsg = "Hunter Rockets";
  5256. case 432: ReasonMsg = "Rhino Turret";
  5257. case 520: ReasonMsg = "Hydra Rockets";
  5258. default: ReasonMsg = "Explosion";
  5259. }
  5260. }
  5261. else
  5262. {
  5263. ReasonMsg = "Explosion";
  5264. }
  5265. }
  5266. default: ReasonMsg = "Unknown";
  5267. }
  5268. }
  5269. if(killerid == INVALID_PLAYER_ID)
  5270. {
  5271. switch (reason)
  5272. {
  5273. case 53: ReasonMsg = "Drowned";
  5274. case 54: ReasonMsg = "Collision";
  5275. default: ReasonMsg = "Died";
  5276. }
  5277. }
  5278. return ReasonMsg;
  5279. }
  5280. stock strreplace2(string[], const find[], const replace[], bool:ignorecase=false, count=cellmax, maxlength=sizeof(string))
  5281. {
  5282. if(isnull(find) || isnull(string)) return 0;
  5283. new matches;
  5284. for(new idx, flen = strlen(find), rlen = strlen(replace), pos = strfind(string, find, ignorecase); pos != -1 && idx < maxlength && matches < count; pos = strfind(string, find, ignorecase, idx))
  5285. {
  5286. strdel(string, pos, pos + flen);
  5287. if(rlen) strins(string, replace, pos, maxlength); // Crashy
  5288. idx = pos + rlen;
  5289. matches++;
  5290. }
  5291. return matches;
  5292. }
  5293. stock UserFileName(nickname[])
  5294. {
  5295. new nName[50];
  5296. format(nName, sizeof(nName), "%s", nickname);
  5297. strreplace2(nName, "_", "_00", true);
  5298. strreplace2(nName, ";", "_01", true);
  5299. strreplace2(nName, "!", "_02", true);
  5300. strreplace2(nName, "/", "_03", true);
  5301. strreplace2(nName, "\\", "_04", true);
  5302. strreplace2(nName, "[", "_05", true);
  5303. strreplace2(nName, "]", "_06", true);
  5304. strreplace2(nName, "?", "_07", true);
  5305. strreplace2(nName, ".", "_08", true);
  5306. strreplace2(nName, "*", "_09", true);
  5307. strreplace2(nName, "<", "_10", true);
  5308. strreplace2(nName, ">", "_11", true);
  5309. strreplace2(nName, "{", "_12", true);
  5310. strreplace2(nName, "}", "_13", true);
  5311. strreplace2(nName, " ", "_14", true);
  5312. strreplace2(nName, "\"", "_15", true);
  5313. strreplace2(nName, ":", "_16", true);
  5314. strreplace2(nName, "|", "_17", true);
  5315. strreplace2(nName, "=", "_18", true);
  5316. return nName;
  5317. }
  5318. stock CheckForTextdrawColours(string[])
  5319. {
  5320. CMDSString = "";
  5321. format(CMDSString, sizeof(CMDSString), "%s", string);
  5322. strreplace2(CMDSString, "$cr", "~r~", true);
  5323. strreplace2(CMDSString, "$cb", "~b~", true);
  5324. strreplace2(CMDSString, "$cy", "~y~", true);
  5325. strreplace2(CMDSString, "$cg", "~g~", true);
  5326. strreplace2(CMDSString, "$cp", "~p~", true);
  5327. strreplace2(CMDSString, "$cw", "~w~", true);
  5328. strreplace2(CMDSString, "$cl", "~l~", true);
  5329. strreplace2(CMDSString, "$cn", "~n~", true);
  5330. strreplace2(CMDSString, "$ch", "~h~", true);
  5331. strreplace2(CMDSString, "$<", "~<~", true);
  5332. strreplace2(CMDSString, "$>", "~>~", true);
  5333. strreplace2(CMDSString, "$cu", "~d~", true);
  5334. strreplace2(CMDSString, "$cd", "~u~", true);
  5335. return CMDSString;
  5336. }
  5337. stock DeleteTextdrawColours(string[])
  5338. {
  5339. CMDSString = "";
  5340. format(CMDSString, sizeof(CMDSString), "%s", string);
  5341. strreplace2(CMDSString, "$cr", "", true);
  5342. strreplace2(CMDSString, "$cb", "", true);
  5343. strreplace2(CMDSString, "$cy", "", true);
  5344. strreplace2(CMDSString, "$cg", "", true);
  5345. strreplace2(CMDSString, "$cp", "", true);
  5346. strreplace2(CMDSString, "$cw", "", true);
  5347. strreplace2(CMDSString, "$cl", "", true);
  5348. strreplace2(CMDSString, "$cn", "", true);
  5349. strreplace2(CMDSString, "$ch", "", true);
  5350. strreplace2(CMDSString, "$<", "", true);
  5351. strreplace2(CMDSString, "$>", "", true);
  5352. strreplace2(CMDSString, "$cu", "", true);
  5353. strreplace2(CMDSString, "$cd", "", true);
  5354. return CMDSString;
  5355. }
  5356. stock CreateTextDraw(playerid)
  5357. {
  5358. AnnouncementTextdraw[playerid] = TextDrawCreate(320.000000, 119.000000, "donate to server~n~at~n~~g~sub.site.com");
  5359. TextDrawAlignment(AnnouncementTextdraw[playerid], 2);
  5360. TextDrawBackgroundColor(AnnouncementTextdraw[playerid], 255);
  5361. TextDrawFont(AnnouncementTextdraw[playerid], 3);
  5362. TextDrawLetterSize(AnnouncementTextdraw[playerid], 0.579999, 1.999999);
  5363. TextDrawColor(AnnouncementTextdraw[playerid], -1);
  5364. TextDrawSetOutline(AnnouncementTextdraw[playerid], 1);
  5365. TextDrawSetProportional(AnnouncementTextdraw[playerid], 1);
  5366. return 1;
  5367. }
  5368. stock ShowAnnouncementTDForPlayer(playerid)
  5369. {
  5370. SetPVarInt(playerid, "AnnouncementTextdrawShown", 1);
  5371. TextDrawShowForPlayer(playerid, AnnouncementTextdraw[playerid]);
  5372. return 1;
  5373. }
  5374. new VehicleNames[212][] =
  5375. {
  5376. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"}, {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  5377. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"}, {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  5378. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"}, {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  5379. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"}, {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  5380. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"}, {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  5381. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"}, {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  5382. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"}, {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  5383. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"}, {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  5384. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"}, {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  5385. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"}, {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  5386. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"}, {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  5387. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"}, {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  5388. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"}, {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  5389. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"}, {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"}, {"Utility Trailer"}
  5390. };
  5391. stock GetVehicleModelIDFromName(vehicle_model[])
  5392. {
  5393. for(new i = 0; i < 211; i++)
  5394. {
  5395. if(strfind(VehicleNames[i], vehicle_model, true) != -1)
  5396. {
  5397. return i + 400;
  5398. }
  5399. }
  5400. return -1;
  5401. }
  5402. stock GetModelIDName(modelid)
  5403. {
  5404. new string[45];
  5405. format(string, sizeof(string), "%s", VehicleNames[modelid-400]);
  5406. return string;
  5407. }
  5408. stock ClearChat(all = 1, playerid = INVALID_PLAYER_ID, amount = 125)
  5409. {
  5410. switch(all)
  5411. {
  5412. case 0:
  5413. {
  5414. for(new i; i < amount; i++)
  5415. {
  5416. SendClientMessage(playerid, COLOUR_INFO, " ");
  5417. }
  5418. }
  5419. case 1:
  5420. {
  5421. for(new i; i < amount; i++)
  5422. {
  5423. SendClientMessageToAll(COLOUR_INFO, " ");
  5424. }
  5425. }
  5426. }
  5427. return 1;
  5428. }
  5429. stock ConvertTime(cts, &ctm=-1,&cth=-1,&ctd=-1,&ctw=-1,&ctmo=-1,&cty=-1)
  5430. {
  5431. #define PLUR(%0,%1,%2) (%0),((%0) == 1)?((#%1)):((#%2))
  5432. #define CTM_cty 31536000
  5433. #define CTM_ctmo 2628000
  5434. #define CTM_ctw 604800
  5435. #define CTM_ctd 86400
  5436. #define CTM_cth 3600
  5437. #define CTM_ctm 60
  5438. #define CT(%0) %0 = cts / CTM_%0; cts %= CTM_%0
  5439. new strii[128];
  5440. if(cty != -1 && (cts/CTM_cty))
  5441. {
  5442. CT(cty); CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
  5443. format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(cty,"year","years"),PLUR(ctmo,"month","months"),PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5444. return strii;
  5445. }
  5446. if(ctmo != -1 && (cts/CTM_ctmo))
  5447. {
  5448. cty = 0; CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
  5449. format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(ctmo,"month","months"),PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5450. return strii;
  5451. }
  5452. if(ctw != -1 && (cts/CTM_ctw))
  5453. {
  5454. cty = ctmo = 0; CT(ctw); CT(ctd); CT(cth); CT(ctm);
  5455. format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5456. return strii;
  5457. }
  5458. if(ctd != -1 && (cts/CTM_ctd))
  5459. {
  5460. cty = ctmo = ctw = 0; CT(ctd); CT(cth); CT(ctm);
  5461. format(strii, sizeof(strii), "%d %s, %d %s, %d %s, and %d %s",PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5462. return strii;
  5463. }
  5464. if(cth != -1 && (cts/CTM_cth))
  5465. {
  5466. cty = ctmo = ctw = ctd = 0; CT(cth); CT(ctm);
  5467. format(strii, sizeof(strii), "%d %s, %d %s, and %d %s",PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5468. return strii;
  5469. }
  5470. if(ctm != -1 && (cts/CTM_ctm))
  5471. {
  5472. cty = ctmo = ctw = ctd = cth = 0; CT(ctm);
  5473. format(strii, sizeof(strii), "%d %s, and %d %s",PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
  5474. return strii;
  5475. }
  5476. cty = ctmo = ctw = ctd = cth = ctm = 0;
  5477. format(strii, sizeof(strii), "%d %s", PLUR(cts,"second","seconds"));
  5478. return strii;
  5479. }
  5480. stock MAdmin_DeletePVars(playerid)
  5481. {
  5482. DeletePVar(playerid, "AnnouncementTextdrawShown"), DeletePVar(playerid, "Level"), DeletePVar(playerid, "LoggedIn"), DeletePVar(playerid, "Spawned");
  5483. DeletePVar(playerid, "ConnectTime"), DeletePVar(playerid, "Relogin"), DeletePVar(playerid, "TextSpam"), DeletePVar(playerid, "RepeatingTextCount"), DeletePVar(playerid, "LastMessage");
  5484. DeletePVar(playerid, "Muted"), DeletePVar(playerid, "CapsDisabled"), DeletePVar(playerid, "Frozen"), DeletePVar(playerid, "Caged"), DeletePVar(playerid, "LastChat"), DeletePVar(playerid, "VIP");
  5485. DeletePVar(playerid, "SpectatingPlayer"), DeletePVar(playerid, "Spectating"), DeletePVar(playerid, "LastCommand"), DeletePVar(playerid, "CommandSpam"), DeletePVar(playerid, "Warnings"), DeletePVar(playerid, "HoursConnected");
  5486. DeletePVar(playerid, "RconLogins"), DeletePVar(playerid, "PasswordAttempts"), DeletePVar(playerid, "Kills"), DeletePVar(playerid, "Deaths"), DeletePVar(playerid, "MinutesConnected"), DeletePVar(playerid, "DaysConnected");
  5487. DeletePVar(playerid, "OldPosX"), DeletePVar(playerid, "OldPosY"), DeletePVar(playerid, "OldPosZ"), DeletePVar(playerid, "OldAngle"), DeletePVar(playerid, "OldWorld"), DeletePVar(playerid, "OldInterior");
  5488. DeletePVar(playerid, "CageObject"), DeletePVar(playerid, "GA_TMP_LASTIP"), DeletePVar(playerid, "tmpLevel"), DeletePVar(playerid, "UnbanPlayerIP"), DeletePVar(playerid, "UnbanPlayerBanned");
  5489. return 1;
  5490. }
  5491. stock GetPlayerIpEx(playerid) return PlayerIP[playerid];
  5492. stock IsHigherAdminLevel(playerid, id) return ((GetPVarInt(id, "Level") > GetPVarInt(playerid, "Level")) || (IsPlayerAdmin(id) && !IsPlayerAdmin(playerid))) ? (1) : (0);
  5493. stock IsAdmin(playerid) return (GetPVarInt(playerid, "Level") >= 1 || IsPlayerAdmin(playerid)) ? (1) : (0);
  5494. stock IsAdminEx(playerid, lvl) return (GetPVarInt(playerid, "Level") >= lvl || IsPlayerAdmin(playerid)) ? (1) : (0);
  5495. stock GetSecondsBetweenAction(action) return floatround(floatdiv((GetTickCount() - action), 1000), floatround_tozero);
  5496. // © [03]Kakioshe 2011 - Keep The Credits!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement