Guest User

melaadmin

a guest
Nov 26th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 139.23 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2012 Mellnik
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. /*________________________________________________________________________________
  18.  
  19. MellAdmin - Advanced Account System
  20. --------------------------------------
  21. (¯`·._.·MELLNIK·._.·´¯)
  22. VERSION: 1.2 (11/13/2012)
  23. --------------------------------------
  24. ________________________________________________________________________________
  25.  
  26. Special thanks to,
  27. --------------------------------------
  28. Y_Less for sscanf and the MD5 include
  29. BlueG (G-Stylezzzz) for MySQL
  30. DracoBlue for DINI
  31. ZeeX for ZCMD
  32. -------------------------------------
  33. ________________________________________________________________________________
  34.  
  35. Forum thread: http://forum.sa-mp.com/showthread.php?t=372212
  36.  
  37. ================================================================================
  38. Includes
  39. ===============================================================================*/
  40. #include <a_samp>
  41. #include <dini> //remove this line if you use MySQL (USE_MYSQL)
  42. #include <a_mysql> //remove this line if you use DINI (USE_MYSQL)
  43. #include <md5> //remove this line if you use MySQL [MD5 will be still used (MD5 is implemented in MySQL)] (USE_MYSQL)
  44. #include <sscanf2>
  45. #include <zcmd>
  46.  
  47. #pragma dynamic 2400
  48. /*==============================================================================
  49. Saving Options
  50. ===============================================================================*/
  51. #define USE_MYSQL (false) //true = mysql_R7 by BlueG | false = dini_1.6 by DracoBlue
  52. #define DINI_PATH "Account" //The dini path if you use DINI
  53.  
  54. //You dont need this if you use dini
  55. #if USE_MYSQL == true
  56. #define MYSQL_HOST "127.0.0.1" //mysql server address | if mysql server is running on the same machine as samp use "localhost" or "127.0.0.1"
  57. #define MYSQL_USER "root" //mysql user
  58. #define MYSQL_PASS "" //mysql password
  59. #define MYSQL_DB "samp" //mysql database
  60. #define MYSQL_TABLE "Account" //The table name where to save
  61. #endif
  62.  
  63. /*==============================================================================
  64. Colors
  65. ===============================================================================*/
  66. #define RED (0xFF0A00FF)
  67. #define DARK_RED (0x910000FF)
  68. #define GREEN (0x73FF00FF)
  69. #define LIGHT_GREEN (0x9BFF00FF)
  70. #define BLUE (0x00A5FFFF)
  71. #define DARK_BLUE (0x0000FFFF)
  72. #define ORANGE (0xFF8200FF)
  73. #define YELLOW (0xFFFA00FF)
  74. #define GREY (0xAAAAAAFF)
  75. #define BLACK (0x000000FF)
  76. #define PURPLE (0xA000FFFF)
  77. #define WHITE (0xF0F0F0FF)
  78. #define red "{E10000}"
  79. #define orange "{FF7E19}"
  80. #define yellow "{FF9E00}"
  81. #define blue "{0087FF}"
  82. #define white "{FFFFFF}"
  83. #define green "{00FF28}"
  84. #define grey "{969696}"
  85.  
  86. /*==============================================================================
  87. General Settings
  88. (true|false|
  89. ===============================================================================*/
  90. #define SERVER_NAME "my awesome server name" //your server name
  91.  
  92. #define MAX_ADMIN_LEVEL (10) //Max. admin level
  93. #define MAX_VIP_LEVEL (3) //Max. VIP level
  94.  
  95. #define USE_AUTO_LOGIN (false) //true = enable false = disable
  96. #define MAX_WARNINGS (3) //Max. Warnings before player gets kicked
  97. #define MAX_REPORTS (10) //max. reports
  98. #define MAX_BAD_RCON_ATTEMPS (2) //Max. bad rcon attemps
  99. #define ENABLE_SPECATE (true) //Enabling the specsystem
  100. #define USE_PM_SYSTEM (true) //Enabling the PM SYSTEM
  101. #define MAX_FAIL_LOGINS (3)
  102. #define VERSION "1.2" //define version
  103. #define MIN_PASS_LEN (3) //min. password lengh
  104. #define MAX_PASS_LEN (32) //max. password lengh
  105. #define USE_VIP_SYSTEM (true) //true = enable false = disable
  106. #define USE_CHAT_BUBBELS (true) //true = enable false = disable
  107. #define USE_ID_MESSAGES (true) //eg.: "Mellnik(ID 42): Hello there!"
  108. #define ENABLE_ADMIN_CHAT (true) //true = enable false = disable
  109. #define USE_RANDOM_MSGS (true) //true = enable false = disable
  110. #define RAND_MSG_INTERVAL (60) //random messages interval in seconds
  111. #define USE_ANTI_ADS (true) //anti advertising true|false (anti ip in chat)
  112. #define MAX_PING (350) //max. allowed ping | only works if you enable
  113. #define PINGCHECK_TIME (2) //ping check interval in seconds
  114. #define MAX_EXCEEDS (3) //how many times it is allowed to exceed the ping limit
  115. #define OPC_DELAY (4) //if you set USE_OPC_DELAY to true, you change the delay until the checktimer for the player will be executed (no need to change this)
  116. #define USE_OPC_DELAY (true) //when a player connect he always has a high ping true= player will be checked after he connected (5 seconds) false= player will be checked immediately after he connected (not recommend)
  117. #define IS_ADMIN_IMMUNE (true) //is an admin immune against the ping kicker (true|false)
  118. #define SEND_MSG_BYKICK (true) //send a message to all when a player gets kicked cause of high ping (true|false)
  119. #define SEND_ADM_BYEXCEED (true) //send message to admin when player exceeds the ping limit (true|false)
  120. #define SEND_PMSG_BYEXCEED (true) //send a message to player when he exceeds the ping limit (true|false)
  121. #define PRINT_BYKICK (true) //print message in server logs when player gets kicked (true|false)
  122. #define LOAD_PLAYER_POS (true) //Should the player pos be be loaded by first spawn?
  123. #define LOAD_PLAYER_HA (true) //load player health and armour by login? (true|false|
  124. #define NO_PERM "Insufficient permissions" //this is the message which will be send to the player if he hasnt the needed adminlevel
  125.  
  126. /*==============================================================================
  127. MySQL Threads - no need to change
  128. ===============================================================================*/
  129. #if USE_MYSQL == true
  130. #define _THREAD_LOAD_PLAYER (0)
  131. #define _THREAD_SAVE_PLAYER (1)
  132. #define _THREAD_CREATE_PLAYER (2)
  133. #define _THREAD_ACCOUNT_EXIST (3)
  134. #define _FETCH_PLAYER_INFO (4)
  135. #define _FETCH_BAN_STAT (5)
  136. #define _UPDATE_PLAYER_PW (6)
  137. #define _THREAD_IS_BANNED (7)
  138. #define _CHECK_PASSWORD (8)
  139. #define _THREAD_BAN_USER (9)
  140. #define _CHECK_AUTO_LOGIN (10)
  141. #define _THREAD_PLAYER_LOGIN (11)
  142. #define _THREAD_PLAYER_LOGOUT (12)
  143. #define _THREAD_GET_AKA (13)
  144. #endif
  145.  
  146. /*==============================================================================
  147. Dialog IDs - Be sure that they are not already used in other of your scritps
  148. ===============================================================================*/
  149. #define LOGIN_DIALOG (10000)
  150. #define REGISTER_DIALOG (10100)
  151. #define BAN_DIALOG (10200)
  152. #define VEHICLE_DIALOG (10300)
  153. #define WEAPON_DIALOG (10400)
  154. #define STATS_DIALOG (10500)
  155. #define ADMINHELP_DIALOG (10600)
  156. #define VTOYS_DIALOG (10700)
  157. #define VIPS_DIALOG (10800)
  158. #define AKA_DIALOG (10900)
  159.  
  160. /*==============================================================================
  161. Other Defines - No need to change them
  162. ================================================================================*/
  163. #define UpperToLower(%1) for(new ToLowerChar; ToLowerChar < strlen( %1 ); ToLowerChar ++ ) if ( %1[ ToLowerChar ]> 64 && %1[ ToLowerChar ] < 91 ) %1[ ToLowerChar ] += 32
  164. #define ADMIN_SPEC_TYPE_NONE (0)
  165. #define ADMIN_SPEC_TYPE_PLAYER (1)
  166. #define ADMIN_SPEC_TYPE_VEHICLE (2)
  167.  
  168. /*==============================================================================
  169. command permissions - set the level which is needed for these commands
  170.  
  171. !!! >>>> "LEVEL_" is not a part of the command its just for the defines <<<< !!!
  172.  
  173. Setting it to 0 will make the command available for everyone
  174.  
  175. Players with a higher adminlevel than needed for a command can still use all commands which
  176. are lower than their level
  177.  
  178. Do not set the need adminlevel higher than MAX_ADMIN_LEVEL or they get interrupted
  179.  
  180. command: adminlevel at least: what the command does:
  181. ================================================================================*/
  182. #define LEVEL_togping (10) //command for enable/disabling ping kicker
  183. #define LEVEL_reports (1) //command which shows all written reports
  184. #define LEVEL_spec (1) //cmd for specing someone
  185. #define LEVEL_onduty (3) //same level is for /offduty
  186. #define LEVEL_enable (10) //server settings
  187. #define LEVEL_disable (10) //server settings
  188. #define LEVEL_adminhelp (1) //see all available commad
  189. #define LEVEL_mytime (1)
  190. #define LEVEL_eject (3) //ject someone from a vehicle
  191. #define LEVEL_burn (3)
  192. #define LEVEL_crash (4) //crash the game of a player
  193. #define LEVEL_ip (3)
  194. #define LEVEL_asay (1)
  195. #define LEVEL_announce (7) //gametext msg to every player
  196. #define LEVEL_goto (5) //goto a player
  197. #define LEVEL_get (8)
  198. #define LEVEL_kick (5)
  199. #define LEVEL_mute (4)
  200. #define LEVEL_unmute (4)
  201. #define LEVEL_ban (8)
  202. #define LEVEL_warn (2) //just a kick warning, by 3 warns player gets kicked
  203. #define LEVEL_slap (2)
  204. #define LEVEL_setadminlevel (10)
  205. #define LEVEL_setviplevel (10)
  206. #define LEVEL_richlist (1)
  207. #define LEVEL_unfreeze (5)
  208. #define LEVEL_freeze (5)
  209. #define LEVEL_clearchat (9)
  210. #define LEVEL_move (8)
  211. #define LEVEL_healall (10)
  212. #define LEVEL_armourall (10)
  213. #define LEVEL_setallweather (6)
  214. #define LEVEL_setalltime (9)
  215. #define LEVEL_cashfall (10) //will give everyone 100 score
  216. #define LEVEL_scorefall (10) //will give everyone $50,000
  217. #define LEVEL_jail (5)
  218. #define LEVEL_unjail (5)
  219. #define LEVEL_wanteds (2)
  220. #define LEVEL_jailed (2)
  221. #define LEVEL_frozen (2)
  222. #define LEVEL_akill (4)
  223. #define LEVEL_showguns (1)
  224. #define LEVEL_morning (1)
  225. #define LEVEL_miniguns (1)
  226. #define LEVEL_muted (1)
  227. #define LEVEL_killall (9)
  228. #define LEVEL_kickall (9)
  229. #define LEVEL_setallwanted (9)
  230. #define LEVEL_disarmall (10)
  231. #define LEVEL_ejectall (8)
  232. #define LEVEL_giveallweapon (7)
  233. #define LEVEL_spawnveh (3)
  234. #define LEVEL_setmoney (4)
  235. #define LEVEL_setscore (4)
  236. #define LEVEL_setwanted (4)
  237. #define LEVEL_aka (7)
  238. #define LEVEL_sethealth (5)
  239. #define LEVEL_setarmour (5)
  240.  
  241. /*==============================================================================
  242. VIP COMMANDS:
  243. write a ! before your text ingame to enter vip chat
  244. "VIP_" is not part of the command
  245. command: needed level:
  246. ================================================================================*/
  247. #define VIP_vsay (2)
  248. #define VIP_mycolor (3)
  249. #define VIP_myweather (1)
  250. #define VIP_vtoys (2)
  251.  
  252. /*==============================================================================
  253. NON-ADMIN COMMANDS:
  254.  
  255. /vips /pay /admins /time /pm /stats /report /changepass /flip
  256. ================================================================================
  257.  
  258.  
  259. ================================================================================
  260. Enums
  261. ===============================================================================*/
  262. enum PlayerData
  263. {
  264. Float:XPos,
  265. Float:YPos,
  266. Float:ZPos,
  267. Float:Health,
  268. Float:Armour,
  269. bool:Logged,
  270. AdminLevel,
  271. Kills,
  272. Deaths,
  273. Hours,
  274. Minutes,
  275. Seconds,
  276. TotalTime,
  277. ConnectTime,
  278. Warnings,
  279. Vehicle,
  280. FailLogins,
  281. bool:Muted,
  282. MuteTimer,
  283. bool:Jailed,
  284. JailTime,
  285. JailTimer,
  286. PingExceeds,
  287. PingTimer,
  288. bool:Frozen,
  289. VIPLevel,
  290. #if ENABLE_SPECATE == true
  291. SpecID,
  292. SpecType,
  293. #endif
  294. RconAttempt,
  295. LastSkin,
  296. FailLogin,
  297. bool:AdminOnDuty,
  298. RegDate[16],
  299. ReportCount,
  300. SpawnCount,
  301. KickCount
  302. }
  303.  
  304. enum ServerData
  305. {
  306. bool:AutoLogin,
  307. bool:NoCaps,
  308. bool:ConnectMessages,
  309. bool:PingSystem,
  310. bool:EnableChat
  311. }
  312.  
  313. /*==============================================================================
  314. Global Variables
  315. ===============================================================================*/
  316. new ServerInfo[ServerData];
  317. new PlayerInfo[MAX_PLAYERS][PlayerData];
  318. new Reports[MAX_REPORTS][128];
  319. new Text3D:adminlabel[MAX_PLAYERS];
  320. #if ENABLE_SPECATE == true
  321. new Float:Pos[MAX_PLAYERS][4];
  322. #endif
  323.  
  324. #if USE_MYSQL == true
  325. new gSQL;
  326. #endif
  327.  
  328. #if USE_RANDOM_MSGS == true
  329. new RandMSGS;
  330. new RandomMessages[][] =
  331. {
  332. ">> Saw a cheater? Use /report [id] [reason]",
  333. ">> Follow the server rules! /rules",
  334. ">> Our TeamSpeak³ Address: 127.0.0.1",
  335. ">> Visit our forum! www.my-forum.com"
  336. };
  337. #endif
  338.  
  339. /*==============================================================================
  340. Public forwards
  341. ===============================================================================*/
  342. #if USE_RANDOM_MSGS == true
  343. forward RandomClientMessage();
  344. #endif
  345. #if USE_MYSQL == true
  346. forward OnQueryFinish(query[], resultid, extraid, connectionHandle);
  347. #endif
  348. forward Kick_Delay(playerid);
  349. forward ConnectedPlayers();
  350. forward unmute(playerid);
  351. forward AdminMSG(color,const string[]);
  352. forward VIPMSG(color,const string[]);
  353. forward CheckPlayerPing(playerid);
  354. forward Jail1(playerid);
  355. forward Jail2(playerid);
  356. forward Jail3(playerid);
  357. forward JailPlayer(playerid);
  358. forward UnjailPlayer(playerid);
  359. #if USE_OPC_DELAY == true
  360. forward ExecCheckTimerForPlayer(playerid);
  361. #endif
  362.  
  363.  
  364. public OnFilterScriptInit()
  365. {
  366. #if USE_MYSQL == true
  367. ConnectToDatabase();
  368. //mysql_debug(1);
  369. #endif
  370.  
  371.  
  372. #if USE_RANDOM_MSGS == true
  373. RandMSGS = SetTimer("RandomClientMessage",RAND_MSG_INTERVAL*1000,true);
  374. #endif
  375.  
  376. if(!dini_Exists("/aka.txt")) dini_Create("/aka.txt");
  377.  
  378. // (true|false]
  379. ServerInfo[EnableChat] = true;
  380. ServerInfo[AutoLogin] = true;
  381. ServerInfo[NoCaps] = true;
  382. ServerInfo[ConnectMessages] = true;
  383. ServerInfo[PingSystem] = true;
  384. ServerInfo[EnableChat] = true;
  385.  
  386.  
  387. for(new i = 1; i < MAX_REPORTS; i++) Reports[i] = "<none>";
  388.  
  389. print("=======================================================================");
  390. print(" >> MellAdmin - Advanced Account System V."#VERSION" loaded! ");
  391. print("=======================================================================");
  392.  
  393. return 1;
  394. }
  395.  
  396. public OnFilterScriptExit()
  397. {
  398. #if USE_RANDOM_MSGS == true
  399. KillTimer(RandMSGS);
  400. #endif
  401.  
  402. print("=======================================================================");
  403. print(" << MellAdmin - Advanced Account System V."#VERSION" unloaded! ");
  404. print("=======================================================================");
  405.  
  406. return 1;
  407. }
  408.  
  409. public OnPlayerConnect(playerid)
  410. {
  411. PlayerInfo[playerid][XPos] = 0.0;
  412. PlayerInfo[playerid][YPos] = 0.0;
  413. PlayerInfo[playerid][ZPos] = 0.0;
  414. PlayerInfo[playerid][Health] = 100.0;
  415. PlayerInfo[playerid][Armour] = 0.0;
  416. PlayerInfo[playerid][FailLogin] = 0;
  417. PlayerInfo[playerid][Logged] = false;
  418. PlayerInfo[playerid][AdminLevel] = 0;
  419. PlayerInfo[playerid][Kills] = 0;
  420. PlayerInfo[playerid][Deaths] = 0;
  421. PlayerInfo[playerid][Warnings] = 0;
  422. PlayerInfo[playerid][Vehicle] = -1;
  423. PlayerInfo[playerid][FailLogins] = 0;
  424. PlayerInfo[playerid][Frozen] = false;
  425. PlayerInfo[playerid][Muted] = false;
  426. PlayerInfo[playerid][MuteTimer] = -1;
  427. PlayerInfo[playerid][Jailed] = false;
  428. PlayerInfo[playerid][JailTime] = 0;
  429. PlayerInfo[playerid][JailTimer] = -1;
  430. PlayerInfo[playerid][VIPLevel] = 0;
  431. PlayerInfo[playerid][Hours] = 0;
  432. PlayerInfo[playerid][Minutes] = 0;
  433. PlayerInfo[playerid][Seconds] = 0;
  434. PlayerInfo[playerid][TotalTime] = 0;
  435. #if ENABLE_SPECATE == true
  436. PlayerInfo[playerid][SpecID] = 0;
  437. PlayerInfo[playerid][SpecType] = 0;
  438. #endif
  439. PlayerInfo[playerid][LastSkin] = 0;
  440. PlayerInfo[playerid][FailLogin] = 0;
  441. PlayerInfo[playerid][AdminOnDuty] = false;
  442. PlayerInfo[playerid][ReportCount] = 0;
  443. PlayerInfo[playerid][SpawnCount] = 0;
  444. PlayerInfo[playerid][KickCount] = 0;
  445. PlayerInfo[playerid][RconAttempt] = 0;
  446. PlayerInfo[playerid][ConnectTime] = gettime();
  447.  
  448. ExistAccount(playerid);
  449.  
  450. if(ServerInfo[ConnectMessages] == true)
  451. {
  452. new string[128];
  453. format(string,sizeof(string),">> Player %s (ID: %d) has joined the server", GetName(playerid), playerid);
  454. SendClientMessageToAll(GREY, string);
  455. }
  456.  
  457. SetPlayerColor(playerid, WHITE);
  458.  
  459. PlayerInfo[playerid][PingExceeds] = 0;
  460. PlayerInfo[playerid][PingTimer] = -1;
  461. if(!IsPlayerNPC(playerid) && ServerInfo[PingSystem] == true)
  462. {
  463. #if USE_OPC_DELAY == false
  464. PlayerInfo[playerid][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", playerid); //Starting the timer which will call the CheckPlayerPing function
  465. #else
  466. SetTimerEx("ExecCheckTimerForPlayer", OPC_DELAY*1000, false, "d", playerid);
  467. #endif
  468. }
  469.  
  470. return 1;
  471. }
  472.  
  473. public OnPlayerDisconnect(playerid, reason)
  474. {
  475. if(PlayerInfo[playerid][Logged] == true)
  476. {
  477. SavePlayer(playerid);
  478. LogPlayerOut(playerid);
  479.  
  480. if(PlayerInfo[playerid][AdminOnDuty] == true)
  481. {
  482. Delete3DTextLabel(adminlabel[playerid]);
  483. }
  484.  
  485. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  486.  
  487. #if ENABLE_SPECATE == true
  488. for(new x=0; x<MAX_PLAYERS; x++)
  489. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
  490. AdvanceSpectate(x);
  491. #endif
  492. }
  493.  
  494. if((PlayerInfo[playerid][PingTimer] != -1) && (!IsPlayerNPC(playerid)))
  495. {
  496. KillTimer(PlayerInfo[playerid][PingTimer]);
  497. }
  498.  
  499. return 1;
  500. }
  501.  
  502. public OnPlayerCommandReceived(playerid, cmdtext[])
  503. {
  504. if(PlayerInfo[playerid][Logged] != true)
  505. {
  506. SendClientMessage(playerid, GREY, "You need to login to use commands");
  507. return 0;
  508. }
  509.  
  510. if(PlayerInfo[playerid][Frozen] == true)
  511. {
  512. SendClientMessage(playerid, RED, "You can´t use commands now");
  513. return 0;
  514. }
  515. return 1;
  516. }
  517.  
  518. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  519. {
  520. if(response)
  521. {
  522. switch(dialogid)
  523. {
  524. case LOGIN_DIALOG :
  525. {
  526. if(strlen(inputtext) < MIN_PASS_LEN || strlen(inputtext) > MAX_PASS_LEN || strlen(inputtext) == 0)
  527. {
  528. SendClientMessage(playerid, RED, "Invalid password lengh!");
  529. ShowPlayerLoginDialog(playerid);
  530. }
  531. else CheckPlayerPassword(playerid, inputtext);
  532. return 1;
  533. }
  534. case REGISTER_DIALOG :
  535. {
  536. if(strlen(inputtext) < MIN_PASS_LEN || strlen(inputtext) > MAX_PASS_LEN || strlen(inputtext) == 0)
  537. {
  538. SendClientMessage(playerid, RED, "Invalid password lengh!");
  539. ShowPlayerRegisterDialog(playerid);
  540. }
  541. else CreateAccount(playerid, inputtext);
  542. return 1;
  543. }
  544. case VEHICLE_DIALOG :
  545. {
  546. switch (listitem)
  547. {
  548. case 0 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+1, DIALOG_STYLE_LIST, "Airplanes", "Andromada\nAT-400\nBeagle\nCropduster\nDodo\nNevada\nRustler\nShamal\nSkimmer\nStuntplane", "Select", "Back" );
  549. case 1 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+2, DIALOG_STYLE_LIST, "Helicopters", "Cargobob\nLeviathan\nMaverick\nNews Maverick\nPolice Maverick\nRaindance\nSeasparrow\nSparrow", "Select", "Back" );
  550. case 2 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+3, DIALOG_STYLE_LIST, "Bikes", "BF-400\nBike\nBMX\nFaggio\nFCR-900\nFreeway\nMountain Bike\nNRG-500\nPCJ-600\nPizzaboy\nQuad\nSanchez\nWayfarer", "Select", "Back" );
  551. case 3 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+4, DIALOG_STYLE_LIST, "Convertibles", "Comet\nFeltzer\nStallion\nWindsor", "Select", "Back" );
  552. case 4 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+5, DIALOG_STYLE_LIST, "Industrial", "Benson\nBobcat\nBurrito\nBoxville\nBoxburg\nCement Truck\nDFT-30\nFlatbed\nLinerunner\nMule\nNewsvan\nPacker\nPetrol Tanker\nPony\nRoadtrain\nRumpo\nSadler\nSadler Shit\nTopfun\nTractor\nTrashmaster\nUtility Van\nWalton\nYankee\nYosemite", "Select", "Back" );
  553. case 5 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+6, DIALOG_STYLE_LIST, "Lowriders", "Blade\nBroadway\nRemington\nSavanna\nSlamvan\nTahoma\nTornado\nVoodoo", "Select", "Back" );
  554. case 6 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+7, DIALOG_STYLE_LIST, "Off Road", "Bandito\nBF Injection\nDune\nHuntley\nLandstalker\nMesa\nMonster\nMonster A\nMonster B\nPatriot\nRancher A\nRancher B\nSandking", "Select", "Back" );
  555. case 7 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+8, DIALOG_STYLE_LIST, "Public Service Vehicles", "Ambulance\nBarracks\nBus\nCabbie\nCoach\nCop Bike (HPV-1000)\nEnforcer\nFBI Rancher\nFBI Truck\nFiretruck\nFiretruck LA\nPolice Car (LSPD)\nPolice Car (LVPD)\nPolice Car (SFPD)\nRanger\nRhino\nS.W.A.T\nTaxi", "Select", "Back" );
  556. case 8 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+9, DIALOG_STYLE_LIST, "Saloons", "Admiral\nBloodring Banger\nBravura\nBuccaneer\nCadrona\nClover\nElegant\nElegy\nEmperor\nEsperanto\nFortune\nGlendale Shit\nGlendale\nGreenwood\nHermes\nIntruder\nMajestic\nManana\nMerit\nNebula\nOceanic\nPicador\nPremier\nPrevion\nPrimo\nSentinel\nStafford\nSultan\nSunrise\nTampa\nVincent\nVirgo\nWillard\nWashington", "Select", "Back" );
  557. case 9 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+10, DIALOG_STYLE_LIST, "Sport Vehicles", "Alpha\nBanshee\nBlista Compact\nBuffalo\nBullet\nCheetah\nClub\nEuros\nFlash\nHotring Racer\nHotring Racer A\nHotring Racer B\nInfernus\nJester\nPhoenix\nSabre\nSuper GT\nTurismo\nUranus\nZR-350", "Select", "Back" );
  558. case 10 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+11, DIALOG_STYLE_LIST, "Station Wagons", "Moonbeam\nPerenniel\nRegina\nSolair\nStratum", "Select", "Back" );
  559. case 11 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+12, DIALOG_STYLE_LIST, "Boats", "Coastguard\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSquallo\nTropic", "Select", "Back" );
  560. case 12 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+13, DIALOG_STYLE_LIST, "Trailers", "Article Trailer\nArticle Trailer 2\nArticle Trailer 3\nBaggage Trailer A\nBaggage Trailer B\nFarm Trailer\nPetrol Trailer\nStairs Trailer\nUtility Trailer", "Select", "Back" );
  561. case 13 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+14, DIALOG_STYLE_LIST, "Unique Vehicles", "Baggage\nBrownstreak (Train)\nCaddy\nCamper\nCamper A\nCombine Harvester\nDozer\nDumper\nForklift\nFreight (Train)\nHotknife\nHustler\nHotdog\nKart\nMower\nMr Whoopee\nRomero\nSecuricar\nStretch\nSweeper\nTram\nTowtruck\nTug\nVortex", "Select", "Back" );
  562. case 14 : ShowPlayerDialog( playerid, VEHICLE_DIALOG+15, DIALOG_STYLE_LIST, "RC Vehicles", "RC Bandit\nRC Baron\nRC Raider\nRC Goblin\nRC Tiger\nRC Cam", "Select", "Back" );
  563. }
  564. }
  565. case VEHICLE_DIALOG+1 :
  566. {
  567. if (listitem > 9)
  568. {
  569. ShowPlayerVehicleSpawnDialog(playerid);
  570. return 1;
  571. }
  572.  
  573. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  574.  
  575. new
  576. model_array[] = { 592, 577, 511, 512, 593, 553, 476, 519, 460, 513 };
  577.  
  578. CarSpawner(playerid, model_array[listitem]);
  579. return 1;
  580. }
  581. case VEHICLE_DIALOG+2 :
  582. {
  583. if ( listitem > 7 )
  584. {
  585. ShowPlayerVehicleSpawnDialog(playerid);
  586. return 1;
  587. }
  588. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  589.  
  590. new
  591. model_array[] = { 548, 417, 487, 488, 497, 563, 447, 469 };
  592.  
  593. CarSpawner(playerid, model_array[listitem]);
  594. return 1;
  595. }
  596. case VEHICLE_DIALOG+3 :
  597. {
  598. if ( listitem > 12 )
  599. {
  600. ShowPlayerVehicleSpawnDialog(playerid);
  601. return 1;
  602. }
  603. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  604.  
  605. new
  606. model_array[] = { 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 471, 468, 586 };
  607.  
  608. CarSpawner(playerid, model_array[listitem]);
  609. return 1;
  610. }
  611. case VEHICLE_DIALOG+4 :
  612. {
  613. if ( listitem > 3)
  614. {
  615. ShowPlayerVehicleSpawnDialog(playerid);
  616. return 1;
  617. }
  618. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  619. new
  620. model_array[] = { 480, 533, 439, 555 };
  621.  
  622. CarSpawner(playerid, model_array[listitem]);
  623. return 1;
  624. }
  625. case VEHICLE_DIALOG+5 :
  626. {
  627. if ( listitem > 24 )
  628. {
  629. ShowPlayerVehicleSpawnDialog(playerid);
  630. return 1;
  631. }
  632. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  633. new
  634. model_array[] = { 499, 422, 482, 498, 609, 524, 578, 455, 403, 414, 582, 443, 514, 413, 515, 440, 543, 605, 459, 531, 408, 552, 478, 456, 554 };
  635.  
  636. CarSpawner(playerid, model_array[listitem]);
  637. return 1;
  638. }
  639. case VEHICLE_DIALOG+6 :
  640. {
  641. if ( listitem > 7 )
  642. {
  643. ShowPlayerVehicleSpawnDialog(playerid);
  644. return 1;
  645. }
  646. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  647. new
  648. model_array[] = { 536, 575, 534, 567, 535, 566, 576, 412 };
  649.  
  650. CarSpawner(playerid, model_array[listitem]);
  651. return 1;
  652. }
  653. case VEHICLE_DIALOG+7 :
  654. {
  655. if ( listitem > 12 )
  656. {
  657. ShowPlayerVehicleSpawnDialog(playerid);
  658. return 1;
  659. }
  660. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  661. new
  662. model_array[] = { 568, 424, 573, 579, 400, 500, 444, 556, 557, 470, 489, 505, 495 };
  663.  
  664. CarSpawner(playerid, model_array[listitem]);
  665. return 1;
  666. }
  667. case VEHICLE_DIALOG+8 :
  668. {
  669. if ( listitem > 17 )
  670. {
  671. ShowPlayerVehicleSpawnDialog(playerid);
  672. return 1;
  673. }
  674. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  675. new
  676. model_array[] = { 416, 433, 431, 438, 437, 523, 427, 490, 528, 407, 544, 596, 598, 597, 599, 432, 601, 420 };
  677.  
  678. CarSpawner(playerid, model_array[listitem]);
  679. return 1;
  680. }
  681. case VEHICLE_DIALOG+9 :
  682. {
  683. if ( listitem > 33 )
  684. {
  685. ShowPlayerVehicleSpawnDialog(playerid);
  686. return 1;
  687. }
  688. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  689. new
  690. model_array[] = { 445, 504, 401, 518, 527, 542, 507, 562, 585, 419, 526, 604, 466, 492, 474, 546, 517, 410, 551, 516, 467, 600, 426, 436, 547, 405, 580, 560, 550, 549, 540, 491, 529, 421 };
  691.  
  692. CarSpawner(playerid, model_array[listitem]);
  693. return 1;
  694. }
  695. case VEHICLE_DIALOG+10 :
  696. {
  697. if ( listitem > 19 )
  698. {
  699. ShowPlayerVehicleSpawnDialog(playerid);
  700. return 1;
  701. }
  702. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  703. new
  704. model_array[] = { 602, 429, 496, 402, 541, 415, 589, 587, 565, 494, 502, 503, 411, 559, 603, 475, 506, 451, 558, 477 };
  705.  
  706. CarSpawner(playerid, model_array[listitem]);
  707. return 1;
  708. }
  709. case VEHICLE_DIALOG+11 :
  710. {
  711. if ( listitem > 4 )
  712. {
  713. ShowPlayerVehicleSpawnDialog(playerid);
  714. return 1;
  715. }
  716. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  717. new
  718. model_array[] = { 418, 404, 479, 458, 561 };
  719.  
  720. CarSpawner(playerid, model_array[listitem]);
  721. return 1;
  722. }
  723. case VEHICLE_DIALOG+12 :
  724. {
  725. if ( listitem > 9 )
  726. {
  727. ShowPlayerVehicleSpawnDialog(playerid);
  728. return 1;
  729. }
  730. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  731. new
  732. model_array[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
  733.  
  734. CarSpawner(playerid, model_array[listitem]);
  735. return 1;
  736. }
  737. case VEHICLE_DIALOG+13 :
  738. {
  739. if ( listitem > 8 )
  740. {
  741. ShowPlayerVehicleSpawnDialog(playerid);
  742. return 1;
  743. }
  744. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  745. new
  746. model_array[] = { 435, 450, 591, 606, 607, 610, 584, 608, 611 };
  747.  
  748. CarSpawner(playerid, model_array[listitem]);
  749. return 1;
  750. }
  751. case VEHICLE_DIALOG+14 :
  752. {
  753. if ( listitem > 23 )
  754. {
  755. ShowPlayerVehicleSpawnDialog(playerid);
  756. return 1;
  757. }
  758. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  759. new
  760. model_array[] = { 485, 537, 457, 483, 508, 532, 486, 406, 530, 538, 434, 545, 588, 571, 572, 423, 442, 428, 409, 574, 449, 525, 583, 539 };
  761.  
  762. CarSpawner(playerid, model_array[listitem]);
  763. return 1;
  764. }
  765. case VEHICLE_DIALOG+15 :
  766. {
  767. if ( listitem > 5 ) return ShowPlayerVehicleSpawnDialog( playerid );
  768. if(PlayerInfo[playerid][Vehicle] != -1) DestroyVehicle(PlayerInfo[playerid][Vehicle]);
  769. new
  770. model_array[] = { 441, 464, 465, 501, 564, 594 };
  771.  
  772. CarSpawner(playerid, model_array[listitem]);
  773. return 1;
  774. }
  775. #if USE_VIP_SYSTEM == true
  776. case VTOYS_DIALOG :
  777. {
  778. switch( listitem )
  779. {
  780. case 0:
  781. {
  782. for(new i = 0; i < 5; i++)
  783. if(IsPlayerAttachedObjectSlotUsed(playerid, i))
  784. RemovePlayerAttachedObject(playerid, i);
  785.  
  786. SetPlayerAttachedObject(playerid, 1, 19086, 8, -0.049768, -0.014062, -0.108385, 87.458297, 263.478149, 184.123764, 0.622413, 1.041609, 1.012785);
  787. }
  788. case 1:
  789. {
  790. for ( new i = 0; i < 5; i++ )
  791. if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
  792. RemovePlayerAttachedObject( playerid, i );
  793.  
  794. SetPlayerAttachedObject( playerid, 0, 1114, 1, 0.138007, 0.002714, -0.157366, 350.942352, 16.794704, 32.683506, 0.791829, 0.471535, 1.032759 );
  795. SetPlayerAttachedObject( playerid, 1, 1114, 1, 0.138007, 0.002714, 0.064523, 342.729064, 354.099456, 32.369094, 0.791829, 0.471535, 1.032759 );
  796. }
  797. case 2:
  798. {
  799. for ( new i = 0; i < 5; i++ )
  800. if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
  801. RemovePlayerAttachedObject( playerid, i );
  802.  
  803. SetPlayerAttachedObject( playerid, 0, 18645, 2, 0.017478, 0.051500, 0.003912, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
  804. SetPlayerAttachedObject( playerid, 1, 18690, 2, -2.979508, 0.306475, -0.388553, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
  805. SetPlayerAttachedObject( playerid, 2, 18716, 2, -2.979508, 0.306475, -0.388553, 285.055511, 90.860740, 171.179550, 1.780549, 0.912008, 1.208514 );
  806. }
  807. case 3:
  808. {
  809. for ( new i = 0; i < 5; i++ )
  810. if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
  811. RemovePlayerAttachedObject( playerid, i );
  812.  
  813. SetPlayerAttachedObject( playerid, 0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
  814. SetPlayerAttachedObject( playerid, 1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
  815. SetPlayerAttachedObject( playerid, 2, 18703, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
  816. SetPlayerAttachedObject( playerid, 3, 18703, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000 );
  817. SetPlayerAttachedObject( playerid, 4, 18965, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000 );
  818. }
  819. case 4:
  820. {
  821. SetPlayerSpecialAction(playerid, 2);
  822. SendClientMessage(playerid, PURPLE, "Jetpack spawned");
  823. }
  824. case 5:
  825. {
  826. if(!IsPlayerAttachedObjectSlotUsed( playerid, 0 ) &&
  827. !IsPlayerAttachedObjectSlotUsed( playerid, 1 ) &&
  828. !IsPlayerAttachedObjectSlotUsed( playerid, 2 ) &&
  829. !IsPlayerAttachedObjectSlotUsed( playerid, 3 ) &&
  830. !IsPlayerAttachedObjectSlotUsed( playerid, 4 ) )
  831. return SendClientMessage(playerid, RED, "You are not holding any toys" );
  832. for ( new i = 0; i < 5; i ++ )
  833. {
  834. if ( IsPlayerAttachedObjectSlotUsed( playerid, i ) )
  835. {
  836. RemovePlayerAttachedObject( playerid, i );
  837. SendClientMessage( i, RED, "You removed all attached toys" );
  838. }
  839. }
  840. }
  841. }
  842. }
  843. #endif
  844. }
  845. return 1;
  846. }
  847. else if(!response)
  848. {
  849. switch(dialogid)
  850. {
  851. case LOGIN_DIALOG :
  852. {
  853. ShowPlayerLoginDialog(playerid);
  854. return 1;
  855. }
  856. case REGISTER_DIALOG :
  857. {
  858. ShowPlayerRegisterDialog(playerid);
  859. return 1;
  860. }
  861. case VEHICLE_DIALOG:{ShowPlayerVehicleSpawnDialog(playerid);}
  862. case VEHICLE_DIALOG+1:{ShowPlayerVehicleSpawnDialog(playerid);}
  863. case VEHICLE_DIALOG+2:{ShowPlayerVehicleSpawnDialog(playerid);}
  864. case VEHICLE_DIALOG+3:{ShowPlayerVehicleSpawnDialog(playerid);}
  865. case VEHICLE_DIALOG+4:{ShowPlayerVehicleSpawnDialog(playerid);}
  866. case VEHICLE_DIALOG+5:{ShowPlayerVehicleSpawnDialog(playerid);}
  867. case VEHICLE_DIALOG+6:{ShowPlayerVehicleSpawnDialog(playerid);}
  868. case VEHICLE_DIALOG+7:{ShowPlayerVehicleSpawnDialog(playerid);}
  869. case VEHICLE_DIALOG+8:{ShowPlayerVehicleSpawnDialog(playerid);}
  870. case VEHICLE_DIALOG+9:{ShowPlayerVehicleSpawnDialog(playerid);}
  871. case VEHICLE_DIALOG+10:{ShowPlayerVehicleSpawnDialog(playerid);}
  872. case VEHICLE_DIALOG+11:{ShowPlayerVehicleSpawnDialog(playerid);}
  873. case VEHICLE_DIALOG+12:{ShowPlayerVehicleSpawnDialog(playerid);}
  874. case VEHICLE_DIALOG+13:{ShowPlayerVehicleSpawnDialog(playerid);}
  875. case VEHICLE_DIALOG+14:{ShowPlayerVehicleSpawnDialog(playerid);}
  876. case VEHICLE_DIALOG+15:{ShowPlayerVehicleSpawnDialog(playerid);}
  877. }
  878.  
  879. }
  880.  
  881. return 0;
  882. }
  883.  
  884. public OnRconLoginAttempt(ip[], password[], success)
  885. {
  886. if(!success)
  887. {
  888. for(new i = 0; i < MAX_PLAYERS; i++)
  889. {
  890. if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  891. new IP[16];
  892. GetPlayerIp(i, IP, sizeof(IP));
  893. if(!strcmp(ip, IP, true))
  894. {
  895. PlayerInfo[i][RconAttempt]++;
  896. if(PlayerInfo[i][RconAttempt] == MAX_BAD_RCON_ATTEMPS)
  897. {
  898. new string[128];
  899. format(string, sizeof(string), ""red">>%s has been kicked! [Reason: Bad rcon attempts]", GetName(i));
  900. AdminMSG(RED, string);
  901. PlayerInfo[i][KickCount]++;
  902. #if PRINT_BYKICK == true
  903. printf("[KICK]: %s has been kicked", GetName(i));
  904. #endif
  905. Kick(i);
  906. }
  907. break;
  908. }
  909. }
  910. }
  911.  
  912. return 1;
  913. }
  914.  
  915. #if ENABLE_SPECATE == true
  916. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  917. {
  918. new x = 0;
  919. while(x!=MAX_PLAYERS)
  920. {
  921. if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
  922. PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
  923. {
  924. SetPlayerInterior(x,newinteriorid);
  925. }
  926. x++;
  927. }
  928. }
  929. #endif
  930.  
  931. #if USE_MYSQL == true
  932. public OnQueryFinish(query[], resultid, extraid, connectionHandle)
  933. {
  934. //printf("OnQueryFinish('%s',%d,%d,%d)",query,resultid,extraid,connectionHandle);
  935.  
  936. switch(resultid)
  937. {
  938. case _THREAD_GET_AKA :
  939. {
  940. mysql_store_result();
  941. new tempstring[1024], count = 0, finstring[1536];
  942.  
  943. while(mysql_retrieve_row())
  944. {
  945. new result[MAX_PLAYER_NAME], temp[MAX_PLAYER_NAME+50];
  946.  
  947. mysql_fetch_field_row(result, "PlayerName");
  948.  
  949. format(temp, sizeof(temp), ""white"\n%d. - %s", count, result);
  950. strcat(tempstring, temp);
  951. count++;
  952. }
  953. if(count == 1)
  954. {
  955. SendClientMessage(extraid, GREEN, "This user has no more account with the same ip");
  956. }
  957. else
  958. {
  959. format(finstring, sizeof(finstring), ""white"Player has "red"%d "white"account(s) with the same IP,\nHe´s using following names:\n", count);
  960. strcat(finstring, tempstring);
  961.  
  962. ShowPlayerDialog(extraid, AKA_DIALOG, DIALOG_STYLE_MSGBOX, "Aka list", finstring, "OK", "");
  963. }
  964. mysql_free_result();
  965. }
  966. case _THREAD_ACCOUNT_EXIST :
  967. {
  968. mysql_store_result();
  969. if(mysql_num_rows(gSQL) == 0)
  970. {
  971. ShowPlayerRegisterDialog(extraid);
  972. }
  973. else
  974. {
  975. IsPlayerMySQLBanned(extraid);
  976. }
  977. mysql_free_result();
  978. }
  979. case _THREAD_CREATE_PLAYER :
  980. {
  981. SendClientMessage(extraid, LIGHT_GREEN, "Your account has been created! Welcome!");
  982. PlayerInfo[extraid][Logged] = true;
  983. }
  984. case _THREAD_LOAD_PLAYER :
  985. {
  986. mysql_store_result();
  987. if(mysql_num_rows(gSQL) > 0)
  988. {
  989. new resultline[512], score, money, wanted;
  990.  
  991. mysql_fetch_row_format(resultline);
  992.  
  993. if(sscanf(resultline, "p<|>fffdddddddffddddddds[16]",
  994. PlayerInfo[extraid][XPos],
  995. PlayerInfo[extraid][YPos],
  996. PlayerInfo[extraid][ZPos],
  997. PlayerInfo[extraid][AdminLevel],
  998. PlayerInfo[extraid][VIPLevel],
  999. wanted,
  1000. PlayerInfo[extraid][Kills],
  1001. PlayerInfo[extraid][Deaths],
  1002. money,
  1003. score,
  1004. PlayerInfo[extraid][Health],
  1005. PlayerInfo[extraid][Armour],
  1006. PlayerInfo[extraid][Hours],
  1007. PlayerInfo[extraid][Minutes],
  1008. PlayerInfo[extraid][Seconds],
  1009. PlayerInfo[extraid][KickCount],
  1010. PlayerInfo[extraid][LastSkin],
  1011. PlayerInfo[extraid][SpawnCount],
  1012. PlayerInfo[extraid][ReportCount],
  1013. PlayerInfo[extraid][RegDate]))
  1014. {
  1015. SendClientMessage(extraid, LIGHT_GREEN, "There was a problem while loading your account");
  1016. KickEx(extraid);
  1017. mysql_free_result();
  1018. return 1;
  1019. }
  1020.  
  1021. SetPlayerWantedLevel(extraid, wanted);
  1022. GivePlayerMoney(extraid, money);
  1023. SetPlayerScore(extraid, score);
  1024. PlayerInfo[extraid][Logged] = true;
  1025. if(PlayerInfo[extraid][AdminLevel] > 0)
  1026. {
  1027. new string[128];
  1028. format(string,sizeof(string),"Successfully logged in. (Adminlevel %d)", PlayerInfo[extraid][AdminLevel]);
  1029. SendClientMessage(extraid,GREEN,string);
  1030. } else SendClientMessage(extraid,GREEN,"Successfully logged in!");
  1031. }
  1032. mysql_free_result();
  1033. }
  1034. case _THREAD_IS_BANNED :
  1035. {
  1036. mysql_store_result();
  1037. if(mysql_num_rows(gSQL) > 0)
  1038. {
  1039. LoadMySQLBanStat(extraid);
  1040. }
  1041. else
  1042. {
  1043. #if USE_AUTO_LOGIN == true
  1044. new IP[16];
  1045. GetPlayerIp(extraid, IP, sizeof(IP));
  1046. MySQLCheckAutoLogin(extraid, IP);
  1047. #else
  1048. ShowPlayerLoginDialog(extraid);
  1049. #endif
  1050. }
  1051. mysql_free_result();
  1052. }
  1053. case _FETCH_BAN_STAT :
  1054. {
  1055. mysql_store_result();
  1056. new string2[512], resultline[512], adminname[MAX_PLAYER_NAME], reason[128], Date[16];
  1057. mysql_fetch_row_format(resultline);
  1058. sscanf(resultline, "p<|>s[24]s[128]s[16]", adminname, reason, Date);
  1059. mysql_free_result();
  1060. format(string2,sizeof(string2),""red"You have been banned\n\n"white"Banned by:\t%s\nYour name:\t%s\nReason:\t%s\nDate:\t\t%s", adminname, GetName(extraid), reason, Date);
  1061. ShowPlayerDialog(extraid, BAN_DIALOG, DIALOG_STYLE_MSGBOX, " ", string2, "OK", "");
  1062. PlayerInfo[extraid][KickCount]++;
  1063. #if PRINT_BYKICK == true
  1064. printf("[KICK]: %s has been kicked", GetName(extraid));
  1065. #endif
  1066. KickEx(extraid);
  1067. }
  1068. case _CHECK_PASSWORD :
  1069. {
  1070. mysql_store_result();
  1071. if(mysql_num_rows(gSQL) > 0)
  1072. {
  1073. LoadPlayer(extraid);
  1074. LogPlayerIn(extraid);
  1075. }
  1076. else
  1077. {
  1078. SendClientMessage(extraid,RED,"Login failed! Incorrect password");
  1079. PlayerInfo[extraid][FailLogin]++;
  1080. printf("LOGIN: %s has failed to login, Wrong password Attempt (%d)", GetName(extraid), PlayerInfo[extraid][FailLogin]);
  1081. if(PlayerInfo[extraid][FailLogin] == MAX_FAIL_LOGINS)
  1082. {
  1083. printf("%s has been kicked (Failed Logins)",GetName(extraid));
  1084. #if PRINT_BYKICK == true
  1085. printf("[KICK]: %s has been kicked", GetName(extraid));
  1086. #endif
  1087. Kick(extraid);
  1088. }
  1089. ShowPlayerLoginDialog(extraid);
  1090. }
  1091. mysql_free_result();
  1092. }
  1093. case _CHECK_AUTO_LOGIN :
  1094. {
  1095. mysql_store_result();
  1096. if(mysql_num_rows(gSQL) > 0)
  1097. {
  1098. SendClientMessage(extraid,RED,"SERVER: You will get autologged in now");
  1099. LoadPlayer(extraid);
  1100. LogPlayerIn(extraid);
  1101. }
  1102. else
  1103. {
  1104. ShowPlayerLoginDialog(extraid);
  1105. }
  1106. mysql_free_result();
  1107. }
  1108. }
  1109.  
  1110. return 1;
  1111. }
  1112.  
  1113. public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
  1114. {
  1115. printf("%d, %s, %s, %s, %d", errorid, error, callback, query, connectionHandle);
  1116. return 1;
  1117. }
  1118. #endif
  1119.  
  1120. public OnPlayerText(playerid, text[])
  1121. {
  1122. if(PlayerInfo[playerid][Logged] != true)
  1123. {
  1124. SendClientMessage(playerid, GREY, "You need to login to use the chat");
  1125. return 0;
  1126. }
  1127.  
  1128. if(ServerInfo[EnableChat] == false)
  1129. {
  1130. SendClientMessage(playerid, GREY, "The chat has been disabled");
  1131. return 0;
  1132. }
  1133.  
  1134. #if USE_VIP_SYSTEM == true
  1135. if(text[0] == '!' && PlayerInfo[playerid][VIPLevel] >= 1)
  1136. {
  1137. new string[128];
  1138. GetPlayerName(playerid,string,sizeof(string));
  1139. format(string,sizeof(string),"VIP Chat %s: %s",string,text[1]);
  1140. VIPMSG(ORANGE,string);
  1141. return 0;
  1142. }
  1143. #endif
  1144.  
  1145. #if ENABLE_ADMIN_CHAT == true
  1146. if(text[0] == '#' && PlayerInfo[playerid][AdminLevel] >= 1)
  1147. {
  1148. new string[128];
  1149. GetPlayerName(playerid,string,sizeof(string));
  1150. format(string,sizeof(string),"Admin Chat %s: %s",string,text[1]);
  1151. AdminMSG(GREEN,string);
  1152. return 0;
  1153. }
  1154. #endif
  1155.  
  1156. #if USE_ANTI_ADS == true
  1157. new
  1158. is1 = 0,
  1159. r = 0,
  1160. strR[255];
  1161.  
  1162. while(strlen(text[is1]))
  1163. {
  1164. if('0' <= text[is1] <= '9')
  1165. {
  1166. new is2 = is1 + 1, p=0;
  1167.  
  1168. while(p == 0)
  1169. {
  1170. if('0' <= text[is2] <= '9' && strlen(text[is2]))
  1171. {
  1172. is2++;
  1173. }
  1174. else
  1175. {
  1176. strmid(strR[r], text, is1, is2, sizeof(strR));
  1177. if(strval(strR[r]) < sizeof(strR)) r++;
  1178. is1 = is2;
  1179. p = 1;
  1180. }
  1181. }
  1182. }
  1183. is1++;
  1184. }
  1185. if(r >= 4)
  1186. {
  1187. SendClientMessage(playerid, RED, "Advertising is not allowed");
  1188. return 0;
  1189. }
  1190. #endif
  1191.  
  1192.  
  1193. if(ServerInfo[NoCaps] == true)
  1194. {
  1195. UpperToLower(text);
  1196. }
  1197.  
  1198. if(PlayerInfo[playerid][Muted] == true)
  1199. {
  1200. SendClientMessage(playerid, RED,"You hvae been muted! Please wait until the time is over!");
  1201. return 0;
  1202. }
  1203. else
  1204. {
  1205. #if USE_CHAT_BUBBELS == true
  1206. new cbMSG[150];
  1207. format(cbMSG,sizeof(cbMSG),"%s", text);
  1208. SetPlayerChatBubble(playerid, cbMSG, WHITE, 65.0, 8000);
  1209. #endif
  1210.  
  1211. #if USE_ID_MESSAGES == true
  1212. new idMSG[150];
  1213. format(idMSG,sizeof(idMSG),"%s (%d): {FFFFFF}%s", GetName(playerid), playerid, text);
  1214. SendClientMessageToAll(GetPlayerColor(playerid), idMSG);
  1215. #endif
  1216. }
  1217. return 0;
  1218. }
  1219.  
  1220. public OnPlayerSpawn(playerid)
  1221. {
  1222. #if LOAD_PLAYER_POS == true
  1223. if(GetPVarInt(playerid, "1stSpawn") == 1)
  1224. {
  1225. SetPlayerPos(playerid, PlayerInfo[playerid][XPos], PlayerInfo[playerid][YPos], PlayerInfo[playerid][ZPos]);
  1226. SetPlayerSkin(playerid, PlayerInfo[playerid][LastSkin]);
  1227. #if LOAD_PLAYER_HA == true
  1228. SetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
  1229. SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
  1230. #endif
  1231. SetPVarInt(playerid, "1stSpawn", 0);
  1232. }
  1233. #endif
  1234. PlayerInfo[playerid][SpawnCount]++;
  1235. SetPlayerSkin(playerid, PlayerInfo[playerid][LastSkin]);
  1236. return 1;
  1237. }
  1238.  
  1239. public OnPlayerDeath(playerid, killerid, reason)
  1240. {
  1241. PlayerInfo[playerid][Deaths]++;
  1242. if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID && killerid != playerid)
  1243. {
  1244. PlayerInfo[killerid][Kills]++;
  1245. }
  1246. #if ENABLE_SPECATE == true
  1247. for(new x=0; x<MAX_PLAYERS; x++)
  1248. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
  1249. AdvanceSpectate(x);
  1250. #endif
  1251.  
  1252. return 1;
  1253. }
  1254.  
  1255. #if ENABLE_SPECATE == true
  1256. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1257. {
  1258. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
  1259. {
  1260. if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
  1261. else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
  1262. }
  1263. return 1;
  1264. }
  1265.  
  1266. public OnPlayerEnterVehicle(playerid, vehicleid)
  1267. {
  1268. for(new x=0; x<MAX_PLAYERS; x++)
  1269. {
  1270. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
  1271. {
  1272. TogglePlayerSpectating(x, 1);
  1273. PlayerSpectateVehicle(x, vehicleid);
  1274. PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
  1275. }
  1276. }
  1277. return 1;
  1278. }
  1279.  
  1280. public OnPlayerExitVehicle(playerid, vehicleid)
  1281. {
  1282. for(new x=0; x<MAX_PLAYERS; x++)
  1283. {
  1284. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE)
  1285. {
  1286. TogglePlayerSpectating(x, 1);
  1287. PlayerSpectatePlayer(x, playerid);
  1288. PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
  1289. }
  1290. }
  1291. return 1;
  1292. }
  1293. #endif
  1294.  
  1295. //==============================================================================
  1296. //------------------------------------------------------------------------------
  1297. // ZCMD COMMANDS
  1298. //------------------------------------------------------------------------------
  1299. //==============================================================================
  1300. #if USE_VIP_SYSTEM == true
  1301. COMMAND:vsay(playerid,params[])
  1302. {
  1303. if(PlayerInfo[playerid][VIPLevel] >= VIP_vsay)
  1304. {
  1305. new text[128];
  1306. if(sscanf(params, "s[128]", text))
  1307. {
  1308. SendClientMessage(playerid,RED,"Usage: /vsay <message>");
  1309. return 1;
  1310. }
  1311. new string[128];
  1312. format(string, sizeof(string), "* VIP %s: %s", GetName(playerid), text);
  1313. SendClientMessageToAll(PURPLE,string);
  1314. }
  1315. else
  1316. {
  1317. SendClientMessage(playerid, RED, NO_PERM);
  1318. }
  1319. return 1;
  1320. }
  1321.  
  1322. COMMAND:mycolor(playerid,params[])
  1323. {
  1324. if(PlayerInfo[playerid][VIPLevel] >= VIP_mycolor)
  1325. {
  1326. new color;
  1327. if(sscanf(params, "d", color))
  1328. {
  1329. SendClientMessage(playerid,RED,"Usage: /mycolor < 0 = White / 1 = Red / 2 = Orange / 3 = Blue / 4 = Green / 5 = Purple>");
  1330. return 1;
  1331. }
  1332. if(color > 5 || color < 0) return SendClientMessage(playerid,RED,"Usage: /mycolor < 0 = White / 1 = Red / 2 = Orange / 3 = Blue / 4 = Green / 5 = Purple>");
  1333.  
  1334. switch(color)
  1335. {
  1336. case 0 : SetPlayerColor(playerid, WHITE);
  1337. case 1 : SetPlayerColor(playerid, RED);
  1338. case 2 : SetPlayerColor(playerid, ORANGE);
  1339. case 3 : SetPlayerColor(playerid, BLUE);
  1340. case 4 : SetPlayerColor(playerid, LIGHT_GREEN);
  1341. case 5 : SetPlayerColor(playerid, PURPLE);
  1342. }
  1343. }
  1344. else
  1345. {
  1346. SendClientMessage(playerid, RED, NO_PERM);
  1347. }
  1348. return 1;
  1349. }
  1350.  
  1351. COMMAND:myweather(playerid,params[])
  1352. {
  1353. if(PlayerInfo[playerid][VIPLevel] >= VIP_myweather)
  1354. {
  1355. new weather;
  1356. if(sscanf(params, "d", weather))
  1357. {
  1358. SendClientMessage(playerid,RED,"Usage: /myweather <weather id>");
  1359. return 1;
  1360. }
  1361. SetPlayerWeather(playerid, weather);
  1362. }
  1363. else
  1364. {
  1365. SendClientMessage(playerid, RED, NO_PERM);
  1366. }
  1367. return 1;
  1368. }
  1369.  
  1370. COMMAND:vtoys(playerid,params[])
  1371. {
  1372. if(PlayerInfo[playerid][VIPLevel] >= VIP_vtoys)
  1373. {
  1374. ShowPlayerDialog(playerid, VTOYS_DIALOG, DIALOG_STYLE_LIST, "V.I.P Toys!", "Dick\nIron\nAlien\nIncred\nJetPack\nRemove toys", "Select", "Cancel");
  1375. }
  1376. else
  1377. {
  1378. SendClientMessage(playerid, RED, NO_PERM);
  1379. }
  1380. return 1;
  1381. }
  1382. #endif
  1383.  
  1384. COMMAND:togping(playerid,params[])
  1385. {
  1386. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_togping)
  1387. {
  1388. if(ServerInfo[PingSystem] == true)
  1389. {
  1390. for(new i=0; i <= MAX_PLAYERS; i++)
  1391. {
  1392. #if IS_ADMIN_IMMUNE == true
  1393. if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
  1394. #endif
  1395.  
  1396. if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerInfo[i][PingTimer] == -1) continue;
  1397. KillTimer(PlayerInfo[i][PingTimer]);
  1398. PlayerInfo[i][PingTimer] = -1;
  1399. }
  1400. ServerInfo[PingSystem] = false;
  1401. SendClientMessage(playerid, RED, "Anti High Ping System has been disabled");
  1402. }
  1403. else if(ServerInfo[PingSystem] == false)
  1404. {
  1405. for(new i=0; i <= MAX_PLAYERS; i++)
  1406. {
  1407. #if IS_ADMIN_IMMUNE == true
  1408. if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
  1409. #endif
  1410. if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  1411. PlayerInfo[i][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", i);
  1412. }
  1413. ServerInfo[PingSystem] = true;
  1414. SendClientMessage(playerid, GREEN, "Anti High Ping System has been enabled");
  1415. }
  1416. }
  1417. return 1;
  1418. }
  1419.  
  1420. #if USE_PM_SYSTEM == true
  1421. COMMAND:pm(playerid,params[])
  1422. {
  1423. new player, msg[128], finmsg[192];
  1424. if(sscanf(params,"rs[128]", player, msg))
  1425. {
  1426. SendClientMessage(playerid,RED,"Usage: /pm <playerid/part of nick> <message>");
  1427. return 1;
  1428. }
  1429. if(!IsPlayerConnected(player))
  1430. {
  1431. SendClientMessage(playerid,RED,"Player is not connected.");
  1432. return 1;
  1433. }
  1434. if(player == playerid)
  1435. {
  1436. SendClientMessage(playerid, RED, "You can´t pm yourself");
  1437. return 1;
  1438. }
  1439. format(finmsg,sizeof(finmsg),"***[PM] from %s(%d): %s", GetName(playerid), playerid, msg);
  1440. SendClientMessage(player, YELLOW, finmsg);
  1441. format(finmsg,sizeof(finmsg),">>>[PM] to %s(%d): %s", GetName(player), player, msg);
  1442. SendClientMessage(playerid, YELLOW, finmsg);
  1443. return 1;
  1444. }
  1445. #endif
  1446.  
  1447. #if ENABLE_SPECATE == true
  1448. COMMAND:spec(playerid,params[])
  1449. {
  1450. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spec || IsPlayerAdmin(playerid))
  1451. {
  1452. new player;
  1453. if(sscanf(params, "r", player))
  1454. {
  1455. SendClientMessage(playerid,RED,"Usage: /spec <playerid/part of nick>");
  1456. return 1;
  1457. }
  1458. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL)
  1459. {
  1460. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1461. return 1;
  1462. }
  1463. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
  1464. {
  1465. if(GetPlayerState(player) == PLAYER_STATE_SPECTATING && PlayerInfo[player][SpecID] != INVALID_PLAYER_ID)
  1466. {
  1467. SendClientMessage(playerid, RED, "Spectate: Player spectating someone else");
  1468. return 1;
  1469. }
  1470. if(GetPlayerState(player) != 1 && GetPlayerState(player) != 2 && GetPlayerState(player) != 3)
  1471. {
  1472. SendClientMessage(playerid, RED, "Spectate: Player not spawned");
  1473. return 1;
  1474. }
  1475. if((PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL))
  1476. {
  1477. StartSpectate(playerid, player);
  1478. GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
  1479. GetPlayerFacingAngle(playerid,Pos[playerid][3]);
  1480. SendClientMessage(playerid,BLUE,"Now Spectating");
  1481. }
  1482. else
  1483. {
  1484. SendClientMessage(playerid,RED,"ERROR: You cannot spectate the highest level admin");
  1485. }
  1486. }
  1487. else
  1488. {
  1489. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1490. }
  1491. }
  1492. else
  1493. {
  1494. SendClientMessage(playerid, RED, NO_PERM);
  1495. }
  1496. return 1;
  1497. }
  1498.  
  1499.  
  1500. COMMAND:adminhelp(playerid,params[])
  1501. {
  1502. #pragma unused params
  1503. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_adminhelp)
  1504. {
  1505. ShowPlayerDialog(playerid,ADMINHELP_DIALOG,DIALOG_STYLE_MSGBOX, "Admin-Commands", ""white"/spec /specoff /warn /slap /asay /mute /unmute /onduty /offduty \n\n/burn /goto /eject /kick /ban /clearchat /get /cashfall /scorefall \n\n/healall /armourall /setallweather /setalltime /setcash /setmoney /announce\n\n/jail /unjail /jailed /wanteds /frozen /akill /showguns /miniguns\n\n/muted /killall /kickall /setallwanted /disarmall /ejectall /giveallweapon /spawnveh","OK","");
  1506. }
  1507. else
  1508. {
  1509. SendClientMessage(playerid, RED, NO_PERM);
  1510. }
  1511. return 1;
  1512. }
  1513.  
  1514. COMMAND:setscore(playerid,params[])
  1515. {
  1516. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setscore)
  1517. {
  1518. new player, amount;
  1519. if(sscanf(params, "rd", player, amount))
  1520. {
  1521. SendClientMessage(playerid,RED,"Usage: /setscore <playerid/part of nick> <score>");
  1522. return 1;
  1523. }
  1524.  
  1525. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1526. {
  1527. new string[128];
  1528. if(player != playerid)
  1529. {
  1530. format(string,sizeof(string),"Administrator \"%s\" has set your score to %d.", GetName(playerid), amount);
  1531. SendClientMessage(player,YELLOW,string);
  1532. format(string,sizeof(string),"You set \"%s\'s\" score to %d.",GetName(player));
  1533. SendClientMessage(playerid,YELLOW,string);
  1534. }
  1535. else
  1536. {
  1537. format(string,sizeof(string),"You have set your score to %d.",amount);
  1538. SendClientMessage(playerid,YELLOW,string);
  1539. }
  1540. SetPlayerScore(player, amount);
  1541. }
  1542. else
  1543. {
  1544. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1545. }
  1546. }
  1547. else
  1548. {
  1549. SendClientMessage(playerid, RED, NO_PERM);
  1550. }
  1551. return 1;
  1552. }
  1553.  
  1554. COMMAND:setwanted(playerid,params[])
  1555. {
  1556. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setwanted)
  1557. {
  1558. new player, wanted, string[128];
  1559. if(sscanf(params, "rd", player, wanted))
  1560. {
  1561. SendClientMessage(playerid,RED,"Usage: /setscore <playerid/part of nick> <wanted>");
  1562. return 1;
  1563. }
  1564. if(wanted > 6) return SendClientMessage(playerid, RED, "Wanted level 1-6");
  1565.  
  1566. SetPlayerWantedLevel(player, wanted);
  1567.  
  1568. format(string,sizeof(string),"Administrator \"%s\" has set your WantedLevel to %d.", GetName(playerid), wanted);
  1569. SendClientMessage(player, YELLOW, string);
  1570. format(string,sizeof(string),"You have set \"%s's\" WantedLevel to %d.", GetName(player), wanted);
  1571. SendClientMessage(playerid, YELLOW, string);
  1572. }
  1573. else
  1574. {
  1575. SendClientMessage(playerid, RED, NO_PERM);
  1576. }
  1577. return 1;
  1578. }
  1579.  
  1580. COMMAND:setmoney(playerid, params[])
  1581. {
  1582. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setmoney)
  1583. {
  1584. new player, amount;
  1585. if(sscanf(params, "rd", player, amount))
  1586. {
  1587. SendClientMessage(playerid,RED,"Usage: /setmoney <playerid/part of nick> <amount>");
  1588. return 1;
  1589. }
  1590.  
  1591. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1592. {
  1593. new string[128];
  1594. if(player != playerid)
  1595. {
  1596. format(string,sizeof(string),"Administrator \"%s\" has set your cash to $%d.", GetName(playerid), amount);
  1597. SendClientMessage(player, YELLOW, string);
  1598. format(string,sizeof(string),"You have set \"%s's\" cash to $%d.", GetName(player), amount);
  1599. SendClientMessage(playerid, YELLOW, string);
  1600. }
  1601. else
  1602. {
  1603. format(string,sizeof(string),"You have set your cash to $%d.", amount);
  1604. SendClientMessage(playerid, YELLOW, string);
  1605. }
  1606. ResetPlayerMoney(player);
  1607. GivePlayerMoney(player, amount);
  1608. }
  1609. else
  1610. {
  1611. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1612. }
  1613. }
  1614. else
  1615. {
  1616. SendClientMessage(playerid, RED, NO_PERM);
  1617. }
  1618. return 1;
  1619. }
  1620.  
  1621. COMMAND:eject(playerid,params[])
  1622. {
  1623. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_eject)
  1624. {
  1625. new player;
  1626. if(sscanf(params, "r", player))
  1627. {
  1628. SendClientMessage(playerid,RED,"Usage: /eject <playerid/part of nick>");
  1629. return 1;
  1630. }
  1631. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
  1632. {
  1633. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1634. return 1;
  1635. }
  1636.  
  1637. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1638. {
  1639. if(IsPlayerInAnyVehicle(player))
  1640. {
  1641. new string[128], Float:x, Float:y, Float:z;
  1642. if(player != playerid)
  1643. {
  1644. format(string,sizeof(string),"Administrator \"%s\" has ejected you from your vehicle", GetName(playerid));
  1645. SendClientMessage(player,BLUE,string);
  1646. }
  1647. format(string,sizeof(string),"You have ejected \"%s\" from their vehicle", GetName(player));
  1648. SendClientMessage(playerid,BLUE,string);
  1649. GetPlayerPos(player,x,y,z);
  1650. SetPlayerPos(player,x,y,z+3);
  1651. }
  1652. else
  1653. {
  1654. SendClientMessage(playerid,RED,"ERROR: Player is not in a vehicle");
  1655. }
  1656. }
  1657. else
  1658. {
  1659. SendClientMessage(playerid,RED,"ERROR: Player is not connected or unavailable");
  1660. }
  1661. }
  1662. else
  1663. {
  1664. SendClientMessage(playerid, RED, NO_PERM);
  1665. }
  1666. return 1;
  1667. }
  1668.  
  1669. COMMAND:burn(playerid,params[])
  1670. {
  1671. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_burn)
  1672. {
  1673. new player;
  1674. if(sscanf(params, "r", player))
  1675. {
  1676. SendClientMessage(playerid,RED,"Usage: /burn <playerid/part of nick>");
  1677. return 1;
  1678. }
  1679. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
  1680. {
  1681. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1682. return 1;
  1683. }
  1684. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1685. {
  1686. new string[128], Float:x, Float:y, Float:z;
  1687. format(string, sizeof(string), "You have burnt \"%s\" ", GetName(player));
  1688. SendClientMessage(playerid,BLUE,string);
  1689. if(player != playerid)
  1690. {
  1691. format(string,sizeof(string),"Administrator \"%s\" has burnt you", GetName(playerid));
  1692. SendClientMessage(player,BLUE,string);
  1693. }
  1694. GetPlayerPos(player, x, y, z);
  1695. CreateExplosion(x, y , z + 3, 1, 10);
  1696. }
  1697. else
  1698. {
  1699. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1700. }
  1701. }
  1702. else
  1703. {
  1704. SendClientMessage(playerid, RED, NO_PERM);
  1705. }
  1706. return 1;
  1707. }
  1708.  
  1709. COMMAND:crash(playerid,params[])
  1710. {
  1711. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_crash)
  1712. {
  1713. new player;
  1714. if(sscanf(params, "r", player))
  1715. {
  1716. SendClientMessage(playerid,RED,"Usage: /crash <playerid/part of nick>");
  1717. return 1;
  1718. }
  1719. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
  1720. {
  1721. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1722. return 1;
  1723. }
  1724. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1725. {
  1726. new string[128], Float:X, Float:Y, Float:Z;
  1727. GetPlayerPos(player,X,Y,Z);
  1728. new objectcrash = CreatePlayerObject(player,111111121,X,Y,Z,0,0,0);
  1729. SetPlayerVirtualWorld(player, 1337);
  1730. new crashveh = CreateVehicle(520, X, Y, Z, 0, 0, 0, -1);
  1731. SetVehicleVirtualWorld(crashveh, 1337);
  1732. PutPlayerInVehicle(player, crashveh, 0);
  1733. AddVehicleComponent(crashveh, 13372);
  1734. DestroyVehicle(crashveh);
  1735. DestroyObject(objectcrash);
  1736. format(string, sizeof(string), "You have crashed \"%s's\" game", GetName(player));
  1737. SendClientMessage(playerid, BLUE, string);
  1738. }
  1739. else
  1740. {
  1741. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1742. }
  1743. }
  1744. else
  1745. {
  1746. SendClientMessage(playerid, RED, NO_PERM);
  1747. }
  1748. return 1;
  1749. }
  1750.  
  1751. COMMAND:ip(playerid,params[])
  1752. {
  1753. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_ip)
  1754. {
  1755. new player;
  1756. if(sscanf(params, "r", player))
  1757. {
  1758. SendClientMessage(playerid,RED,"Usage: /ip <playerid/part of nick>");
  1759. return 1;
  1760. }
  1761. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
  1762. {
  1763. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1764. return 1;
  1765. }
  1766. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  1767. {
  1768. new IP[16], string[64];
  1769. GetPlayerIp(player,IP,sizeof(IP));
  1770. format(string,sizeof(string),"\"%s's\" ip is '%s'", GetName(player), IP);
  1771. SendClientMessage(playerid,BLUE,string);
  1772. }
  1773. else
  1774. {
  1775. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1776. }
  1777. }
  1778. else
  1779. {
  1780. SendClientMessage(playerid, RED, NO_PERM);
  1781. }
  1782. return 1;
  1783. }
  1784.  
  1785. COMMAND:time(playerid,params[])
  1786. {
  1787. #pragma unused params
  1788. new string[64], hour,minuite,second; gettime(hour,minuite,second);
  1789. format(string, sizeof(string), "~g~|~w~%d:%d~g~|", hour, minuite);
  1790. GameTextForPlayer(playerid, string, 5000, 1);
  1791. return 1;
  1792. }
  1793.  
  1794.  
  1795. COMMAND:mytime(playerid,params[])
  1796. {
  1797. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_mytime)
  1798. {
  1799. new time;
  1800. if(sscanf(params, "d", time))
  1801. {
  1802. SendClientMessage(playerid,RED,"Usage: /mytime <hour>");
  1803. return 1;
  1804. }
  1805. new string[128];
  1806. format(string,sizeof(string),"You have set your time to %d:00", time);
  1807. SendClientMessage(playerid,BLUE,string);
  1808. SetPlayerTime(playerid, time, 0);
  1809. }
  1810. else
  1811. {
  1812. SendClientMessage(playerid, RED, NO_PERM);
  1813. }
  1814. return 1;
  1815. }
  1816.  
  1817. COMMAND:asay(playerid,params[])
  1818. {
  1819. #pragma unused params
  1820. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_asay)
  1821. {
  1822. new text[128];
  1823. if(sscanf(params, "s[128]", text))
  1824. {
  1825. SendClientMessage(playerid,RED,"Usage: /asay <message>");
  1826. return 1;
  1827. }
  1828. new string[128];
  1829. format(string, sizeof(string), "* Admin %s: %s", GetName(playerid), text);
  1830. SendClientMessageToAll(RED,string);
  1831. }
  1832. else
  1833. {
  1834. SendClientMessage(playerid, RED, NO_PERM);
  1835. }
  1836. return 1;
  1837. }
  1838.  
  1839.  
  1840. COMMAND:announce(playerid,params[])
  1841. {
  1842. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_announce || IsPlayerAdmin(playerid))
  1843. {
  1844. new text[128];
  1845. if(sscanf(params, "s[128]", text))
  1846. {
  1847. SendClientMessage(playerid,RED,"Usage: /announce <message>");
  1848. return 1;
  1849. }
  1850. GameTextForAll(text, 4000, 3);
  1851. }
  1852. else
  1853. {
  1854. SendClientMessage(playerid, RED, NO_PERM);
  1855. }
  1856. return 1;
  1857. }
  1858.  
  1859. COMMAND:goto(playerid,params[])
  1860. {
  1861. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_goto || IsPlayerAdmin(playerid))
  1862. {
  1863. new player;
  1864. if(sscanf(params, "r", player))
  1865. {
  1866. SendClientMessage(playerid,RED,"Usage: /goto <playerid/part of nick>");
  1867. return 1;
  1868. }
  1869.  
  1870. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
  1871. {
  1872. new Float:x, Float:y, Float:z; GetPlayerPos(player,x,y,z);
  1873. SetPlayerInterior(playerid,GetPlayerInterior(player));
  1874. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player));
  1875. if(GetPlayerState(playerid) == 2)
  1876. {
  1877. SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
  1878. LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player));
  1879. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player));
  1880. }
  1881. else SetPlayerPos(playerid,x+2,y,z);
  1882. new string[128];
  1883. format(string,sizeof(string),"You have Teleported to \"%s\"", GetName(player));
  1884. return SendClientMessage(playerid,RED,string);
  1885. }
  1886. else
  1887. {
  1888. SendClientMessage(playerid,RED,"ERROR: Player is not connected");
  1889. }
  1890. }
  1891. else
  1892. {
  1893. SendClientMessage(playerid, RED, NO_PERM);
  1894. }
  1895. return 1;
  1896. }
  1897.  
  1898. COMMAND:get(playerid,params[])
  1899. {
  1900. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_get || IsPlayerAdmin(playerid))
  1901. {
  1902. new player;
  1903. if(sscanf(params, "r", player))
  1904. {
  1905. SendClientMessage(playerid,RED,"Usage: /get <playerid/part of nick>");
  1906. return 1;
  1907. }
  1908. new string[128];
  1909. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL && PlayerInfo[playerid][AdminLevel] != MAX_ADMIN_LEVEL)
  1910. {
  1911. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  1912. return 1;
  1913. }
  1914. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
  1915. {
  1916. new Float:x, Float:y, Float:z;
  1917. GetPlayerPos(playerid,x,y,z);
  1918. SetPlayerInterior(player,GetPlayerInterior(playerid));
  1919. SetPlayerVirtualWorld(player,GetPlayerVirtualWorld(playerid));
  1920. if(GetPlayerState(player) == 2)
  1921. {
  1922. new VehicleID = GetPlayerVehicleID(player);
  1923. SetVehiclePos(VehicleID,x+3,y,z);
  1924. LinkVehicleToInterior(VehicleID,GetPlayerInterior(playerid));
  1925. SetVehicleVirtualWorld(GetPlayerVehicleID(player),GetPlayerVirtualWorld(playerid));
  1926. }
  1927. else
  1928. {
  1929. SetPlayerPos(player,x+2,y,z);
  1930. }
  1931. format(string,sizeof(string),"You have been teleported to Administrator \"%s's\" location", GetName(playerid));
  1932. SendClientMessage(player,BLUE,string);
  1933. format(string,sizeof(string),"You have teleported \"%s\" to your location", GetName(player));
  1934. SendClientMessage(playerid,BLUE,string);
  1935. return 1;
  1936. }
  1937. else
  1938. {
  1939. SendClientMessage(playerid, RED, "Player is not connected or is yourself");
  1940. }
  1941. }
  1942. else
  1943. {
  1944. SendClientMessage(playerid, RED, NO_PERM);
  1945. }
  1946. return 1;
  1947. }
  1948.  
  1949. COMMAND:kick(playerid,params[])
  1950. {
  1951. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_kick)
  1952. {
  1953. new player, reason[128];
  1954. if(sscanf(params, "rs[128]", player, reason))
  1955. {
  1956. SendClientMessage(playerid,RED,"Usage: /kick <playerid/part of nick> <reason>");
  1957. return 1;
  1958. }
  1959. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  1960. {
  1961. new string[128];
  1962. format(string,sizeof(string),"**%s has been kicked by Admin %s [reason: %s]",GetName(player),GetName(playerid),reason);
  1963. SendClientMessageToAll(YELLOW,string);
  1964. print(string);
  1965. PlayerInfo[player][KickCount]++;
  1966. #if PRINT_BYKICK == true
  1967. printf("[KICK]: %s has been kicked", GetName(playerid));
  1968. #endif
  1969. Kick(player);
  1970. }
  1971. else
  1972. {
  1973. SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
  1974. }
  1975. }
  1976. else
  1977. {
  1978. SendClientMessage(playerid, RED, NO_PERM);
  1979. }
  1980. return 1;
  1981. }
  1982.  
  1983. COMMAND:mute(playerid,params[])
  1984. {
  1985. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_mute)
  1986. {
  1987. new player, time, reason[128];
  1988. if(sscanf(params, "rds[128]", player, time, reason))
  1989. {
  1990. SendClientMessage(playerid,RED,"Usage: /mute <playerid/part of nick> <seconds> <reason>");
  1991. return 1;
  1992. }
  1993. if(PlayerInfo[player][Muted] == true)
  1994. {
  1995. SendClientMessage(playerid,RED,"This player is already muted");
  1996. return 1;
  1997. }
  1998. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  1999. {
  2000. new string[128];
  2001. PlayerInfo[player][Muted] = true;
  2002. format(string,sizeof(string),"**%s has been muted by Admin '%s' for %d seconds [Reason: %s]",GetName(player), GetName(playerid), time, reason);
  2003. SendClientMessageToAll(YELLOW,string);
  2004. PlayerInfo[player][MuteTimer] = SetTimerEx("unmute",time*1000, false, "d", player);
  2005. }
  2006. else
  2007. {
  2008. SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
  2009. }
  2010. }
  2011. else
  2012. {
  2013. SendClientMessage(playerid, RED, NO_PERM);
  2014. }
  2015. return 1;
  2016. }
  2017.  
  2018. COMMAND:unmute(playerid,params[])
  2019. {
  2020. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unmute)
  2021. {
  2022. new player;
  2023. if(sscanf(params, "r", player))
  2024. {
  2025. SendClientMessage(playerid,RED,"Usage: /unmute <playerid/part of nick>");
  2026. return 1;
  2027. }
  2028.  
  2029. if(PlayerInfo[player][Muted] == false)
  2030. {
  2031. SendClientMessage(playerid,RED,"This player is not muted");
  2032. return 1;
  2033. }
  2034. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
  2035. {
  2036. PlayerInfo[player][Muted] = false;
  2037. KillTimer(PlayerInfo[player][MuteTimer]);
  2038. SendClientMessage(player, GREEN, "You have been unmuted!");
  2039. SendClientMessage(playerid, RED, "Player has been unmuted.");
  2040. }
  2041. else
  2042. {
  2043. SendClientMessage(playerid, RED, "Player isn´t connected or invalid!");
  2044. }
  2045. }
  2046. else
  2047. {
  2048. SendClientMessage(playerid, RED, NO_PERM);
  2049. }
  2050. return 1;
  2051. }
  2052.  
  2053. COMMAND:ban(playerid,params[])
  2054. {
  2055. if((PlayerInfo[playerid][AdminLevel] >= LEVEL_ban) || (IsPlayerAdmin(playerid)))
  2056. {
  2057. new player, reason[128];
  2058. if(sscanf(params, "rs[128]", player, reason))
  2059. {
  2060. SendClientMessage(playerid,RED,"Usage: /ban <playerid/part of nick> <reason>");
  2061. return 1;
  2062. }
  2063. if(PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  2064. {
  2065. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL && PlayerInfo[player][Logged] == true)
  2066. {
  2067. new year, month, day, string[128];
  2068. getdate(year, month, day);
  2069. format(string, sizeof(string), "**%s has been banned by Admin %s [Reason: %s]", GetName(player), GetName(playerid),reason);
  2070. SendClientMessageToAll(YELLOW, string);
  2071. print(string);
  2072. CreateBan(player, GetName(playerid), reason);
  2073. format(string, sizeof(string),""red"You have been banned!"white"\n\nAdmin:\t\t%s\nReason:\t%s\n",GetName(playerid),reason);
  2074. ShowPlayerDialog(player, BAN_DIALOG, DIALOG_STYLE_MSGBOX, "Notice", string, "OK", "");
  2075. Kick(player);
  2076. return 1;
  2077. }
  2078. else
  2079. {
  2080. SendClientMessage(playerid, RED, "Player is not connected or is yourself or is the highest level admin");
  2081. }
  2082. }
  2083. else
  2084. {
  2085. format(reason,sizeof(reason),"WARNING: %s just tried to ban you with reason: %s", GetName(playerid), reason);
  2086. SendClientMessage(player, RED, reason);
  2087. }
  2088. }
  2089. else
  2090. {
  2091. SendClientMessage(playerid, RED, NO_PERM);
  2092. }
  2093. return 1;
  2094. }
  2095.  
  2096. COMMAND:slap(playerid,params[])
  2097. {
  2098. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_slap)
  2099. {
  2100. new player;
  2101. if(sscanf(params, "r", player))
  2102. {
  2103. SendClientMessage(playerid,RED,"Usage: /slap <playerid/part of nick>");
  2104. return 1;
  2105. }
  2106.  
  2107. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && (PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL))
  2108. {
  2109. new Float:pHealth, Float:x, Float:y, Float:z, string[128];
  2110. GetPlayerHealth(player,pHealth);
  2111. SetPlayerHealth(player,pHealth-25);
  2112. GetPlayerPos(player,x,y,z);
  2113. SetPlayerPos(player,x,y,z+10);
  2114. format(string,sizeof(string),"You have been slapped by Administrator %s",GetName(playerid));
  2115. SendClientMessage(player,RED,string);
  2116. format(string,sizeof(string),"You have slapped %s",GetName(player));
  2117. SendClientMessage(playerid,BLUE,string);
  2118. }
  2119. else
  2120. {
  2121. SendClientMessage(playerid, RED, "Player is not connected or is the highest level admin");
  2122. }
  2123. }
  2124. else
  2125. {
  2126. SendClientMessage(playerid, RED, NO_PERM);
  2127. }
  2128. return 1;
  2129. }
  2130.  
  2131. COMMAND:admins(playerid,params[])
  2132. {
  2133. #pragma unused params
  2134. SendClientMessage(playerid, PURPLE, "--------------------------------------");
  2135.  
  2136. new Count[2], i, string[128];
  2137. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
  2138. {
  2139. if(PlayerInfo[i][AdminLevel] > 0) Count[0]++;
  2140. if(IsPlayerAdmin(i)) Count[1]++;
  2141. }
  2142.  
  2143. if((Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][AdminLevel] == 0))
  2144. {
  2145. SendClientMessage(playerid, PURPLE, "No Administrators online");
  2146. SendClientMessage(playerid, PURPLE, "--------------------------------------");
  2147. return 1;
  2148. }
  2149.  
  2150. if(Count[0] == 1)
  2151. {
  2152. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][AdminLevel] > 0)
  2153. {
  2154. format(string, sizeof(string), "Admin: (%d)%s [AdminLevel: %d]", i, GetName(i), PlayerInfo[i][AdminLevel] ); SendClientMessage(playerid, BLUE, string);
  2155. }
  2156. }
  2157.  
  2158. if(Count[0] > 1)
  2159. {
  2160. new x; format(string, sizeof(string), "Admins:");
  2161. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][AdminLevel] > 0)
  2162. {
  2163. format(string,sizeof(string),"%s(%d)%s [AdminLevel: %d]",string,i,GetName(i),PlayerInfo[i][AdminLevel]);
  2164. x++;
  2165. if(x >= 5)
  2166. {
  2167. SendClientMessage(playerid, PURPLE, string); format(string, sizeof(string), "Admins: "); x = 0;
  2168. }
  2169. else format(string, sizeof(string), "%s, ", string);
  2170. }
  2171. if(x <= 4 && x > 0) {
  2172. string[strlen(string)-3] = '.';
  2173. SendClientMessage(playerid, PURPLE, string);
  2174. }
  2175. }
  2176.  
  2177. if( (Count[1] == 1) && (PlayerInfo[playerid][AdminLevel] > 0))
  2178. {
  2179. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
  2180. {
  2181. format(string, sizeof(string), "RCON Admin: (%d)%s", i, GetName(i));
  2182. SendClientMessage(playerid, GREEN, string);
  2183. }
  2184. }
  2185. if(Count[1] > 1)
  2186. {
  2187. new x; format(string, sizeof(string), "RCON Admins: ");
  2188. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
  2189. {
  2190. format(string,sizeof(string),"%s(%d)%s",string,i,GetName(i));
  2191. x++;
  2192. if(x >= 5)
  2193. {
  2194. SendClientMessage(playerid, WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
  2195. }
  2196. else format(string, sizeof(string), "%s, ", string);
  2197. }
  2198. if(x <= 4 && x > 0)
  2199. {
  2200. string[strlen(string)-3] = '.';
  2201. SendClientMessage(playerid, GREEN, string);
  2202. }
  2203. }
  2204.  
  2205. SendClientMessage(playerid, PURPLE, "--------------------------------------");
  2206. return 1;
  2207. }
  2208.  
  2209. #if USE_VIP_SYSTEM == true
  2210. COMMAND:setviplevel(playerid,params[])
  2211. {
  2212. if(PlayerInfo[playerid][AdminLevel] == LEVEL_setviplevel)
  2213. {
  2214. new player, vlevel;
  2215. if(sscanf(params, "rd", player, vlevel))
  2216. {
  2217. SendClientMessage(playerid,RED,"Usage: /setviplevel <playerid/part of nick> <level>");
  2218. return 1;
  2219. }
  2220.  
  2221. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][Logged] == true)
  2222. {
  2223. if(vlevel > MAX_VIP_LEVEL)
  2224. {
  2225. SendClientMessage(playerid,RED,"ERROR: Incorrect Level");
  2226. return 1;
  2227. }
  2228. if(vlevel == PlayerInfo[player][VIPLevel])
  2229. {
  2230. SendClientMessage(playerid,RED,"ERROR: Player is already this level");
  2231. return 1;
  2232. }
  2233.  
  2234. new year, month, day, hour, minute, second, string[128];
  2235. getdate(year, month, day);
  2236. gettime(hour,minute,second);
  2237.  
  2238. if(vlevel > 0)
  2239. {
  2240. format(string,sizeof(string),"Administrator %s has set you to VIP Status [level %d]",GetName(playerid), vlevel);
  2241. }
  2242. else
  2243. {
  2244. format(string,sizeof(string),"Administrator %s deleted your VIP level",GetName(playerid));
  2245. }
  2246.  
  2247. SendClientMessage(player,BLUE,string);
  2248.  
  2249. if(vlevel > PlayerInfo[player][VIPLevel])
  2250. {
  2251. GameTextForPlayer(player,"Promoted", 5000, 3);
  2252. }
  2253. else
  2254. {
  2255. GameTextForPlayer(player,"Demoted", 5000, 3);
  2256. }
  2257. format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", GetName(player), vlevel, day, month, year, hour, minute, second);
  2258. SendClientMessage(playerid,BLUE,string);
  2259. format(string,sizeof(string),"Administrator %s has made %s VIPLevel %d on %d/%d/%d at %d:%d:%d",GetName(playerid), GetName(player), vlevel, day, month, year, hour, minute, second);
  2260. SendClientMessageToAll(BLUE,string);
  2261. PlayerInfo[player][VIPLevel] = vlevel;
  2262. }
  2263. else
  2264. {
  2265. SendClientMessage(playerid,RED,"ERROR: Cannot VIP permissions");
  2266. }
  2267. }
  2268. else
  2269. {
  2270. SendClientMessage(playerid, RED, NO_PERM);
  2271. }
  2272. return 1;
  2273. }
  2274. #endif
  2275.  
  2276. COMMAND:setadminlevel(playerid,params[])
  2277. {
  2278. if(PlayerInfo[playerid][AdminLevel] == LEVEL_setadminlevel || IsPlayerAdmin(playerid))
  2279. {
  2280. new player, alevel;
  2281. if(sscanf(params, "rd", player, alevel))
  2282. {
  2283. SendClientMessage(playerid,RED,"Usage: /setadminlevel <playerid/part of nick> <level>");
  2284. return 1;
  2285. }
  2286.  
  2287. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][Logged] == true)
  2288. {
  2289. if(alevel > MAX_ADMIN_LEVEL)
  2290. {
  2291. SendClientMessage(playerid,RED,"ERROR: Incorrect Level");
  2292. return 1;
  2293. }
  2294. if(alevel == PlayerInfo[player][AdminLevel])
  2295. {
  2296. SendClientMessage(playerid,RED,"ERROR: Player is already this level");
  2297. return 1;
  2298. }
  2299. new year, month, day, hour, minute, second, string[128];
  2300. getdate(year, month, day);
  2301. gettime(hour,minute,second);
  2302.  
  2303. if(alevel > 0)
  2304. {
  2305. format(string,sizeof(string),"Administrator %s has set you to Administrator Status [level %d]",GetName(playerid), alevel);
  2306. }
  2307. else
  2308. {
  2309. format(string,sizeof(string),"Administrator %s has set you to Player Status [level %d]",GetName(playerid), alevel);
  2310. }
  2311. SendClientMessage(player,BLUE,string);
  2312.  
  2313. if(alevel > PlayerInfo[player][AdminLevel])
  2314. {
  2315. GameTextForPlayer(player,"Promoted", 5000, 3);
  2316. }
  2317. else
  2318. {
  2319. GameTextForPlayer(player,"Demoted", 5000, 3);
  2320. }
  2321. format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", GetName(player), alevel, day, month, year, hour, minute, second);
  2322. SendClientMessage(playerid,BLUE,string);
  2323. format(string,sizeof(string),"Administrator %s has made %s AdminLevel %d on %d/%d/%d at %d:%d:%d",GetName(playerid), GetName(player), alevel, day, month, year, hour, minute, second);
  2324. SendClientMessageToAll(BLUE,string);
  2325. PlayerInfo[player][AdminLevel] = alevel;
  2326. }
  2327. else
  2328. {
  2329. SendClientMessage(playerid,RED,"ERROR: Cannot assign permissions");
  2330. }
  2331. }
  2332. else
  2333. {
  2334. SendClientMessage(playerid, RED, NO_PERM);
  2335. }
  2336. return 1;
  2337. }
  2338.  
  2339. COMMAND:richlist(playerid,params[])
  2340. {
  2341. #pragma unused params
  2342. if(PlayerInfo[playerid][AdminLevel] == LEVEL_richlist || IsPlayerAdmin(playerid))
  2343. {
  2344. new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestCash = -9999;
  2345. SendClientMessage(playerid,WHITE,"Rich List:");
  2346.  
  2347. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerMoney(x) >= HighestCash) {
  2348. HighestCash = GetPlayerMoney(x);
  2349. Slot1 = x;
  2350. }
  2351. HighestCash = -9999;
  2352. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerMoney(x) >= HighestCash) {
  2353. HighestCash = GetPlayerMoney(x);
  2354. Slot2 = x;
  2355. }
  2356. HighestCash = -9999;
  2357. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerMoney(x) >= HighestCash) {
  2358. HighestCash = GetPlayerMoney(x);
  2359. Slot3 = x;
  2360. }
  2361. HighestCash = -9999;
  2362. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerMoney(x) >= HighestCash) {
  2363. HighestCash = GetPlayerMoney(x);
  2364. Slot4 = x;
  2365. }
  2366. format(string, sizeof(string), "(%d) %s - $%d", Slot1,GetName(Slot1),GetPlayerMoney(Slot1) );
  2367. SendClientMessage(playerid,WHITE,string);
  2368. if(Slot2 != -1) {
  2369. format(string, sizeof(string), "(%d) %s - $%d", Slot2,GetName(Slot2),GetPlayerMoney(Slot2) );
  2370. SendClientMessage(playerid,WHITE,string);
  2371. }
  2372. if(Slot3 != -1) {
  2373. format(string, sizeof(string), "(%d) %s - $%d", Slot3,GetName(Slot3),GetPlayerMoney(Slot3) );
  2374. SendClientMessage(playerid,WHITE,string);
  2375. }
  2376. if(Slot4 != -1) {
  2377. format(string, sizeof(string), "(%d) %s - $%d", Slot4,GetName(Slot4),GetPlayerMoney(Slot4) );
  2378. SendClientMessage(playerid,WHITE,string);
  2379. }
  2380. }
  2381. else
  2382. {
  2383. SendClientMessage(playerid, RED, NO_PERM);
  2384. }
  2385. return 1;
  2386. }
  2387.  
  2388. COMMAND:wanteds(playerid,params[])
  2389. {
  2390. #pragma unused params
  2391. if(PlayerInfo[playerid][AdminLevel] == LEVEL_wanteds || IsPlayerAdmin(playerid))
  2392. {
  2393. new string[128], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1, HighestWanted = -9999;
  2394. SendClientMessage(playerid, YELLOW, "___________ |- Wanted Players -| ___________");
  2395.  
  2396.  
  2397. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerWantedLevel(x) >= HighestWanted)
  2398. {
  2399. HighestWanted = GetPlayerWantedLevel(x);
  2400. Slot1 = x;
  2401. }
  2402. HighestWanted = -9999;
  2403. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1) if (GetPlayerWantedLevel(x) >= HighestWanted)
  2404. {
  2405. HighestWanted = GetPlayerWantedLevel(x);
  2406. Slot2 = x;
  2407. }
  2408. HighestWanted = -9999;
  2409. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2) if (GetPlayerWantedLevel(x) >= HighestWanted)
  2410. {
  2411. HighestWanted = GetPlayerWantedLevel(x);
  2412. Slot3 = x;
  2413. }
  2414. HighestWanted = -9999;
  2415. for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3) if (GetPlayerWantedLevel(x) >= HighestWanted)
  2416. {
  2417. HighestWanted = GetPlayerWantedLevel(x);
  2418. Slot4 = x;
  2419. }
  2420. format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot1,GetName(Slot1),GetPlayerWantedLevel(Slot1));
  2421. SendClientMessage(playerid,WHITE,string);
  2422. if(Slot2 != -1)
  2423. {
  2424. format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot2,GetName(Slot2),GetPlayerWantedLevel(Slot2));
  2425. SendClientMessage(playerid,WHITE,string);
  2426. }
  2427. if(Slot3 != -1)
  2428. {
  2429. format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot3,GetName(Slot3),GetPlayerWantedLevel(Slot3));
  2430. SendClientMessage(playerid,WHITE,string);
  2431. }
  2432. if(Slot4 != -1)
  2433. {
  2434. format(string, sizeof(string), "(%d) %s - Wanteds: %d", Slot4,GetName(Slot4),GetPlayerWantedLevel(Slot4));
  2435. SendClientMessage(playerid,WHITE,string);
  2436. }
  2437. }
  2438. else
  2439. {
  2440. SendClientMessage(playerid, RED, NO_PERM);
  2441. }
  2442. return 1;
  2443. }
  2444.  
  2445. COMMAND:jailed(playerid,params[])
  2446. {
  2447. #pragma unused params
  2448. if(PlayerInfo[playerid][AdminLevel] == LEVEL_jailed || IsPlayerAdmin(playerid))
  2449. {
  2450. new bool:First2 = false;
  2451. new Count, i;
  2452. new string[128];
  2453. new adminname[MAX_PLAYER_NAME];
  2454. for(i = 0; i < MAX_PLAYERS; i++)
  2455. if(IsPlayerConnected(i) && PlayerInfo[i][Jailed])
  2456. Count++;
  2457. if(Count == 0)
  2458. return SendClientMessage(playerid,RED, "No players are Jailed!");
  2459.  
  2460. for(i = 0; i < MAX_PLAYERS; i++)
  2461. if(IsPlayerConnected(i) && PlayerInfo[i][Jailed])
  2462. {
  2463. GetPlayerName(i, adminname, sizeof(adminname));
  2464. if(!First2)
  2465. {
  2466. format(string, sizeof(string), "Jailed Players: (%d)%s", i,adminname); First2 = true;
  2467. }
  2468. else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
  2469. SendClientMessage(playerid,YELLOW,string);
  2470. }
  2471. }
  2472. else
  2473. {
  2474. SendClientMessage(playerid, RED, NO_PERM);
  2475. }
  2476. return 1;
  2477. }
  2478.  
  2479. COMMAND:frozen(playerid,params[])
  2480. {
  2481. #pragma unused params
  2482. if(PlayerInfo[playerid][AdminLevel] == LEVEL_frozen || IsPlayerAdmin(playerid))
  2483. {
  2484. new bool:First2 = false;
  2485. new Count,string[128], i;
  2486. new adminname[MAX_PLAYER_NAME];
  2487.  
  2488. for(i = 0; i < MAX_PLAYERS; i++)
  2489. if(IsPlayerConnected(i) && PlayerInfo[i][Frozen])
  2490. Count++;
  2491. if(Count == 0)
  2492. return SendClientMessage(playerid,RED, "No players are Frozen!");
  2493.  
  2494. for(i = 0; i < MAX_PLAYERS; i++)
  2495. if(IsPlayerConnected(i) && PlayerInfo[i][Frozen])
  2496. {
  2497. GetPlayerName(i, adminname, sizeof(adminname));
  2498. if(!First2)
  2499. {
  2500. format(string, sizeof(string), "Frozen Players: (%d)%s", i,adminname);
  2501. First2 = true;
  2502. }
  2503. else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
  2504. SendClientMessage(playerid,YELLOW,string);
  2505. }
  2506. }
  2507. else
  2508. {
  2509. SendClientMessage(playerid, RED, NO_PERM);
  2510. }
  2511. return 1;
  2512. }
  2513.  
  2514. COMMAND:akill(playerid,params[])
  2515. {
  2516. if(PlayerInfo[playerid][AdminLevel] == LEVEL_akill || IsPlayerAdmin(playerid))
  2517. {
  2518. new player;
  2519. if(sscanf(params, "r", player))
  2520. {
  2521. SendClientMessage(playerid,RED,"Usage: /akill <playerid/part of nick>");
  2522. return 1;
  2523. }
  2524.  
  2525. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  2526. {
  2527. new string[128];
  2528. format(string,sizeof(string),"Administrator %s has killed you",GetName(playerid));
  2529. SendClientMessage(player,RED,string);
  2530. format(string,sizeof(string),"You have killed %s",GetName(player));
  2531. SendClientMessage(playerid,PURPLE,string);
  2532. SetPlayerHealth(player,0.0);
  2533. }
  2534. else SendClientMessage(playerid,YELLOW,"Player not connected or highest level admin");
  2535. }
  2536. else
  2537. {
  2538. SendClientMessage(playerid, RED, NO_PERM);
  2539. }
  2540. return 1;
  2541. }
  2542.  
  2543. COMMAND:showguns(playerid,params[])
  2544. {
  2545. if(PlayerInfo[playerid][AdminLevel] == LEVEL_showguns || IsPlayerAdmin(playerid))
  2546. {
  2547. new player;
  2548. if(sscanf(params, "r", player))
  2549. {
  2550. SendClientMessage(playerid,RED,"Usage: /showguns <playerid/part of nick>");
  2551. return 1;
  2552. }
  2553.  
  2554. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  2555. {
  2556. new Count, x;
  2557. new string[128];
  2558. new WeapName[24], slot, weap, ammo;
  2559. format(string,sizeof(string),"_______|- %s(%d) Weapons -|_______", player,GetName(player));
  2560. SendClientMessage(playerid,YELLOW,string);
  2561. for(slot = 0; slot < 14; slot++)
  2562. {
  2563. GetPlayerWeaponData(player, slot, weap, ammo);
  2564. if(ammo != 0 && weap != 0)
  2565. Count++;
  2566. }
  2567. if(Count < 1)
  2568. return SendClientMessage(playerid,RED,"No Weapons found!");
  2569.  
  2570. if(Count >= 1)
  2571. {
  2572. for(slot = 0; slot < 14; slot++)
  2573. {
  2574. GetPlayerWeaponData(player, slot, weap, ammo);
  2575.  
  2576. if(ammo != 0 && weap != 0)
  2577. {
  2578. GetWeaponName(weap, WeapName, sizeof(WeapName));
  2579. if(ammo == 65535 || ammo == 1)
  2580. format(string,sizeof(string),"%s%s (1)",string, WeapName);
  2581. else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
  2582. x++;
  2583. if(x >= 5)
  2584. {
  2585. SendClientMessage(playerid, BLUE, string);
  2586. x = 0;
  2587. format(string, sizeof(string), "");
  2588. }
  2589. else format(string, sizeof(string), "%s, ", string);
  2590. }
  2591. }
  2592. if(x <= 4 && x > 0)
  2593. {
  2594. string[strlen(string)-3] = '.';
  2595. SendClientMessage(playerid, RED, string);
  2596. }
  2597. }
  2598. }
  2599. else SendClientMessage(playerid,YELLOW,"Player not connected");
  2600. }
  2601. else
  2602. {
  2603. SendClientMessage(playerid, RED, NO_PERM);
  2604. }
  2605. return 1;
  2606. }
  2607.  
  2608. COMMAND:morning(playerid,params[])
  2609. {
  2610. #pragma unused params
  2611. if(PlayerInfo[playerid][AdminLevel] == LEVEL_morning)
  2612. {
  2613. SetPlayerTime(playerid,7,0);
  2614. }
  2615. else
  2616. {
  2617. SendClientMessage(playerid, RED, NO_PERM);
  2618. }
  2619. return 1;
  2620. }
  2621.  
  2622. COMMAND:miniguns(playerid,params[])
  2623. {
  2624. #pragma unused params
  2625. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_miniguns)
  2626. {
  2627. new bool:First2 = false;
  2628. new Count, string[128];
  2629. new i, slot, weap, ammo;
  2630. for(i = 0; i < MAX_PLAYERS; i++)
  2631. {
  2632. if(IsPlayerConnected(i))
  2633. {
  2634. for(slot = 0; slot < 14; slot++)
  2635. {
  2636. GetPlayerWeaponData(i, slot, weap, ammo);
  2637. if(ammo != 0 && weap == 38)
  2638. {
  2639. Count++;
  2640. if(!First2)
  2641. {
  2642. format(string, sizeof(string), "Minigun: (%d)%s(ammo%d)", i, GetName(i), ammo);
  2643. First2 = true;
  2644. }
  2645. else format(string,sizeof(string),"%s, (%d)%s(ammo%d) ",string, i, GetName(i), ammo);
  2646. }
  2647. }
  2648. }
  2649. }
  2650. if(Count == 0)
  2651. return SendClientMessage(playerid,GREEN,"No player has Minigun!");
  2652. else return SendClientMessage(playerid,WHITE,string);
  2653. }
  2654. else
  2655. {
  2656. SendClientMessage(playerid, RED, NO_PERM);
  2657. }
  2658. return 1;
  2659. }
  2660.  
  2661. COMMAND:spawnveh(playerid, params[])
  2662. {
  2663. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spawnveh)
  2664. {
  2665. ShowPlayerVehicleSpawnDialog(playerid);
  2666. return 1;
  2667. }
  2668. else
  2669. {
  2670. SendClientMessage(playerid, RED, NO_PERM);
  2671. }
  2672. return 1;
  2673. }
  2674.  
  2675. COMMAND:muted(playerid,params[])
  2676. {
  2677. #pragma unused params
  2678. if(PlayerInfo[playerid][AdminLevel] == LEVEL_muted || IsPlayerAdmin(playerid))
  2679. {
  2680. new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
  2681. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted]) Count++;
  2682. if(Count == 0) return SendClientMessage(playerid,RED, "ERROR: No players are Muted!");
  2683.  
  2684. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted])
  2685. {
  2686. GetPlayerName(i, adminname, sizeof(adminname));
  2687. if(!First2)
  2688. {
  2689. format(string, sizeof(string), "Muted Players: (%d)%s", i,adminname);
  2690. First2 = true;
  2691. } else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
  2692. SendClientMessage(playerid,YELLOW,string);
  2693. }
  2694. }
  2695. else
  2696. {
  2697. SendClientMessage(playerid, RED, NO_PERM);
  2698. }
  2699. return 1;
  2700. }
  2701.  
  2702. COMMAND:unfreeze(playerid,params[])
  2703. {
  2704. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unfreeze)
  2705. {
  2706. new player;
  2707. if(sscanf(params, "r", player))
  2708. {
  2709. SendClientMessage(playerid,RED,"Usage: /unfreeze <playerid/part of nick>");
  2710. return 1;
  2711. }
  2712. if(PlayerInfo[player][Frozen] == true)
  2713. {
  2714. TogglePlayerControllable(player,true);
  2715. PlayerInfo[player][Frozen] = false;
  2716. SendClientMessage(player,GREEN, "You have been unfreezed by an admin");
  2717. }
  2718. else
  2719. {
  2720. SendClientMessage(playerid,RED,"Not possible to unfreeze him now");
  2721. }
  2722. }
  2723. else
  2724. {
  2725. SendClientMessage(playerid, RED, NO_PERM);
  2726. }
  2727. return 1;
  2728. }
  2729.  
  2730. COMMAND:freeze(playerid,params[])
  2731. {
  2732. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_freeze)
  2733. {
  2734. new player;
  2735. if(sscanf(params, "r", player))
  2736. {
  2737. SendClientMessage(playerid,RED,"Usage: /freeze <playerid/part of nick>");
  2738. return 1;
  2739. }
  2740.  
  2741. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  2742. {
  2743. TogglePlayerControllable(player,false);
  2744. PlayerInfo[player][Frozen] = true;
  2745. SendClientMessage(player,RED, "You have been freezed by an admin");
  2746. }
  2747. else
  2748. {
  2749. SendClientMessage(playerid,RED,"Not possible to freeze him now");
  2750. }
  2751. }
  2752. else
  2753. {
  2754. SendClientMessage(playerid, RED, NO_PERM);
  2755. }
  2756. return 1;
  2757. }
  2758.  
  2759. COMMAND:jail(playerid,params[])
  2760. {
  2761. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_jail)
  2762. {
  2763. new player, time, reason[128];
  2764. if(sscanf(params, "rds[128]", player, time, reason))
  2765. {
  2766. SendClientMessage(playerid,RED,"Usage: /jail <playerid/part of nick> <minutes> <reason>");
  2767. return 1;
  2768. }
  2769.  
  2770. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  2771. {
  2772. if(PlayerInfo[player][Jailed] == false)
  2773. {
  2774. PlayerInfo[playerid][JailTime] = time * 1000 * 60;
  2775. SetTimerEx("JailPlayer", 5000, 0, "d", player);
  2776. SetTimerEx("Jail1", 1000, 0, "d", player);
  2777. PlayerInfo[player][Jailed] = true;
  2778. new string[128];
  2779. format(string, sizeof(string), "**%s has been jailed for %i minutes by admin %s [Reason: %s]", GetName(player), time, GetName(playerid), reason);
  2780. SendClientMessageToAll(RED,string);
  2781. } else SendClientMessage(playerid, RED, "ERROR: Player is already in jail");
  2782. }else SendClientMessage(playerid, RED, "ERROR: Player is not connected or is the highest level admin");
  2783. }
  2784. else
  2785. {
  2786. SendClientMessage(playerid, RED, NO_PERM);
  2787. }
  2788. return 1;
  2789. }
  2790.  
  2791. COMMAND:unjail(playerid,params[])
  2792. {
  2793. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_unjail)
  2794. {
  2795. new player;
  2796. if(sscanf(params, "r", player))
  2797. {
  2798. SendClientMessage(playerid,RED,"Usage: /unjail <playerid/part of nick>");
  2799. return 1;
  2800. }
  2801. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
  2802. {
  2803. if(PlayerInfo[player][Jailed] == true)
  2804. {
  2805. new string[128];
  2806. format(string,sizeof(string),"Administrator %s has unjailed you", GetName(playerid));
  2807. SendClientMessage(player,GREEN,string);
  2808. format(string,sizeof(string),"**%s has been released from prison",GetName(player));
  2809. SendClientMessage(player,RED,string);
  2810. UnjailPlayer(player);
  2811. } else SendClientMessage(playerid, RED, "ERROR: Player is not in jail");
  2812. } else SendClientMessage(playerid, RED, "ERROR: Player is not connected or is the highest level admin");
  2813. }
  2814. else
  2815. {
  2816. SendClientMessage(playerid, RED, NO_PERM);
  2817. }
  2818. return 1;
  2819. }
  2820.  
  2821. COMMAND:clearchat(playerid,params[])
  2822. {
  2823. #pragma unused params
  2824. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_clearchat)
  2825. {
  2826. for(new i = 0; i < 64; i++)
  2827. {
  2828. SendClientMessageToAll(GREEN," ");
  2829. }
  2830. }
  2831. else
  2832. {
  2833. SendClientMessage(playerid, RED, NO_PERM);
  2834. }
  2835. return 1;
  2836. }
  2837.  
  2838. COMMAND:move(playerid,params[])
  2839. {
  2840. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_move)
  2841. {
  2842. if(!strlen(params))
  2843. {
  2844. SendClientMessage(playerid, RED, "USAGE: /move [up / down / +x / -x / +y / -y / off]");
  2845. return 1;
  2846. }
  2847. new Float:X, Float:Y, Float:Z;
  2848. if(strcmp(params,"up",true) == 0)
  2849. {
  2850. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y,Z+5); SetCameraBehindPlayer(playerid);
  2851. }
  2852. else if(strcmp(params,"down",true) == 0)
  2853. {
  2854. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y,Z-5); SetCameraBehindPlayer(playerid);
  2855. }
  2856. else if(strcmp(params,"+x",true) == 0)
  2857. {
  2858. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X+5,Y,Z);
  2859. }
  2860. else if(strcmp(params,"-x",true) == 0)
  2861. {
  2862. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X-5,Y,Z);
  2863. }
  2864. else if(strcmp(params,"+y",true) == 0)
  2865. {
  2866. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y+5,Z);
  2867. }
  2868. else if(strcmp(params,"-y",true) == 0)
  2869. {
  2870. TogglePlayerControllable(playerid,false); GetPlayerPos(playerid,X,Y,Z); SetPlayerPos(playerid,X,Y-5,Z);
  2871. }
  2872. else if(strcmp(params,"off",true) == 0)
  2873. {
  2874. TogglePlayerControllable(playerid,true);
  2875. }
  2876. else
  2877. {
  2878. SendClientMessage(playerid,RED,"USAGE: /move [up / down / +x / -x / +y / -y / off]");
  2879. return 1;
  2880. }
  2881. }
  2882. else
  2883. {
  2884. SendClientMessage(playerid, RED, NO_PERM);
  2885. }
  2886.  
  2887. return 1;
  2888. }
  2889.  
  2890. COMMAND:changepass(playerid,params[])
  2891. {
  2892. new pass[128];
  2893. if(sscanf(params, "s[128]", pass))
  2894. {
  2895. SendClientMessage(playerid,RED,"Usage: /changepass <new pass>");
  2896. return 1;
  2897. }
  2898. if(strlen(pass) < MIN_PASS_LEN || strlen(pass) > MAX_PASS_LEN)
  2899. {
  2900. SendClientMessage(playerid,RED,"SERVER: Incorrect password length.");
  2901. return 1;
  2902. }
  2903. new string[128];
  2904. UpdatePlayerPass(playerid, pass);
  2905. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  2906. format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
  2907. SendClientMessage(playerid,YELLOW,string);
  2908. return 1;
  2909. }
  2910.  
  2911. COMMAND:healall(playerid,params[])
  2912. {
  2913. #pragma unused params
  2914. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_healall)
  2915. {
  2916. for(new i = 0; i < MAX_PLAYERS; i++)
  2917. {
  2918. if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
  2919. {
  2920. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  2921. SetPlayerHealth(i,100.0);
  2922. }
  2923. }
  2924. new string[64];
  2925. format(string,sizeof(string),"Administrator \"%s\" healed all players", GetName(playerid));
  2926. SendClientMessageToAll(BLUE, string);
  2927. GameTextForAll("Health for all!", 3000, 3);
  2928. SetPlayerHealth(playerid,100.0);
  2929. }
  2930. else
  2931. {
  2932. SendClientMessage(playerid, RED, NO_PERM);
  2933. }
  2934. return 1;
  2935. }
  2936.  
  2937. COMMAND:armourall(playerid,params[])
  2938. {
  2939. #pragma unused params
  2940. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_armourall)
  2941. {
  2942. for(new i = 0; i < MAX_PLAYERS; i++)
  2943. {
  2944. if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
  2945. {
  2946. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  2947. SetPlayerArmour(i,100.0);
  2948. }
  2949. }
  2950. new string[64];
  2951. format(string,sizeof(string),"Administrator \"%s\" restored all players armour", GetName(playerid));
  2952. SendClientMessageToAll(BLUE, string);
  2953. GameTextForAll("Armour for all!", 3000, 3);
  2954. SetPlayerArmour(playerid,100.0);
  2955. }
  2956. else
  2957. {
  2958. SendClientMessage(playerid, RED, NO_PERM);
  2959. }
  2960. return 1;
  2961. }
  2962.  
  2963. COMMAND:vips(playerid, params[])
  2964. {
  2965. new string[1024], temp[128];
  2966. strcat(string, ""blue"Online VIPs:\n"white"");
  2967. for(new i = 0; i < MAX_PLAYERS; i++)
  2968. {
  2969. if(PlayerInfo[i][VIPLevel] >= 1 && IsPlayerConnected(i))
  2970. {
  2971. format(temp, sizeof(temp), "\n%s [ID: %d] Level: %d", GetName(i), i, PlayerInfo[i][VIPLevel]);
  2972. strcat(string, temp);
  2973. }
  2974. }
  2975.  
  2976. ShowPlayerDialog(playerid, VIPS_DIALOG, DIALOG_STYLE_MSGBOX, "Vips", string, "OK", "");
  2977. return 1;
  2978. }
  2979. COMMAND:sethealth(playerid,params[])
  2980. {
  2981. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_sethealth)
  2982. {
  2983. new Float:health, player;
  2984. if(sscanf(params, "rf", player, health))
  2985. {
  2986. SendClientMessage(playerid,RED,"Usage: /sethealth <playerid/part of nick> <health>");
  2987. return 1;
  2988. }
  2989. if(IsPlayerConnected(player))
  2990. {
  2991. SetPlayerHealth(player, health);
  2992. new string[128];
  2993. format(string, sizeof(string), "Admin %s set your health to %f", GetName(playerid), health);
  2994. SendClientMessage(player, GREEN, string);
  2995. format(string, sizeof(string), "You set %´s health to %f", GetName(player), health);
  2996. SendClientMessage(playerid, GREEN, string);
  2997. }
  2998. }
  2999. else
  3000. {
  3001. SendClientMessage(playerid, RED, NO_PERM);
  3002. }
  3003. return 1;
  3004. }
  3005. COMMAND:setarmour(playerid,params[])
  3006. {
  3007. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setarmour)
  3008. {
  3009. new player, Float:armour;
  3010. if(sscanf(params, "rf", player, armour))
  3011. {
  3012. SendClientMessage(playerid,RED,"Usage: /setarmour <playerid/part of nick> <armour>");
  3013. return 1;
  3014. }
  3015. if(IsPlayerConnected(player))
  3016. {
  3017. SetPlayerArmour(player, armour);
  3018. new string[128];
  3019. format(string, sizeof(string), "Admin %s set your armour to %f", GetName(playerid), armour);
  3020. SendClientMessage(player, GREEN, string);
  3021. format(string, sizeof(string), "You set %´s armour to %f", GetName(player), armour);
  3022. SendClientMessage(playerid, GREEN, string);
  3023. }
  3024. }
  3025. else
  3026. {
  3027. SendClientMessage(playerid, RED, NO_PERM);
  3028. }
  3029. return 1;
  3030. }
  3031. COMMAND:pay(playerid, params[])
  3032. {
  3033. new player, cash;
  3034. if(sscanf(params, "rd", player, cash))
  3035. {
  3036. SendClientMessage(playerid,RED,"Usage: /pay <playerid/part of nick> <money>");
  3037. return 1;
  3038. }
  3039.  
  3040. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  3041. {
  3042. if(GetPlayerMoney(playerid) < cash)
  3043. {
  3044. SendClientMessage(playerid, RED, "You don't have that much!");
  3045. return 1;
  3046. }
  3047. if(cash < 1000 || cash > 1000000)
  3048. {
  3049. SendClientMessage(playerid, RED, "Cash must be $1,000 - $1,000,000");
  3050. return 1;
  3051. }
  3052. if(player == playerid)
  3053. {
  3054. SendClientMessage(playerid, RED, "You really want to pay yourself?... lol");
  3055. return 1;
  3056. }
  3057. new string[128];
  3058. GivePlayerMoney(playerid, -cash);
  3059. GivePlayerMoney(player, cash);
  3060. format(string,sizeof(string),"%s paid you $%d", GetName(playerid), cash);
  3061. SendClientMessage(player,YELLOW,string);
  3062. SendClientMessage(playerid,YELLOW,"Successfully paid the money!");
  3063. }
  3064. else
  3065. {
  3066. SendClientMessage(playerid, RED, NO_PERM);
  3067. }
  3068. return 1;
  3069. }
  3070.  
  3071. COMMAND:setallweather(playerid,params[])
  3072. {
  3073. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setallweather)
  3074. {
  3075. new weather;
  3076. if(sscanf(params, "d", weather))
  3077. {
  3078. SendClientMessage(playerid,RED,"Usage: /setallweather <weather id>");
  3079. return 1;
  3080. }
  3081.  
  3082. for(new i = 0; i < MAX_PLAYERS; i++)
  3083. {
  3084. if(IsPlayerConnected(i))
  3085. {
  3086. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3087. SetPlayerWeather(i, weather);
  3088. }
  3089. }
  3090. new string[128];
  3091. format(string,sizeof(string),"Administrator \"%s\" has set all players weather to '%d'", GetName(playerid), weather);
  3092. SendClientMessageToAll(BLUE, string);
  3093. }
  3094. else
  3095. {
  3096. SendClientMessage(playerid, RED, NO_PERM);
  3097. }
  3098. return 1;
  3099. }
  3100.  
  3101. COMMAND:setalltime(playerid,params[])
  3102. {
  3103. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setalltime)
  3104. {
  3105. new hour;
  3106. if(sscanf(params, "d", hour))
  3107. {
  3108. SendClientMessage(playerid,RED,"Usage: /setalltime <hour>");
  3109. return 1;
  3110. }
  3111. if(hour > 24)
  3112. {
  3113. SendClientMessage(playerid, RED, "ERROR: Invalid hour");
  3114. return 1;
  3115. }
  3116. for(new i = 0; i < MAX_PLAYERS; i++)
  3117. {
  3118. if(IsPlayerConnected(i))
  3119. {
  3120. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3121. SetPlayerTime(i, hour, 0);
  3122. }
  3123. }
  3124. new string[128];
  3125. format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", GetName(playerid), hour);
  3126. SendClientMessageToAll(BLUE, string);
  3127. }
  3128. else
  3129. {
  3130. SendClientMessage(playerid, RED, NO_PERM);
  3131. }
  3132. return 1;
  3133. }
  3134.  
  3135. COMMAND:cashfall(playerid,params[])
  3136. {
  3137. #pragma unused params
  3138. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_cashfall)
  3139. {
  3140. new string[128];
  3141. for(new i = 0; i < MAX_PLAYERS; i++)
  3142. {
  3143. if(IsPlayerConnected(i) && PlayerInfo[i][Logged] == true)
  3144. {
  3145. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3146. GivePlayerMoney(i,50000);
  3147. }
  3148. }
  3149. format(string,sizeof(string),"Administrator \"%s\" has given all players $50,000", GetName(playerid));
  3150. SendClientMessageToAll(BLUE, string);
  3151. }
  3152. else
  3153. {
  3154. SendClientMessage(playerid, RED, NO_PERM);
  3155. }
  3156. return 1;
  3157. }
  3158.  
  3159. COMMAND:scorefall(playerid,params[])
  3160. {
  3161. #pragma unused params
  3162. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_scorefall)
  3163. {
  3164. new string[128];
  3165. for(new i = 0; i < MAX_PLAYERS; i++)
  3166. {
  3167. if(IsPlayerConnected(i) && PlayerInfo[i][Logged] == true)
  3168. {
  3169. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3170. GivePlayerScore(i,100);
  3171. }
  3172. }
  3173. format(string,sizeof(string),"Administrator \"%s\" has given all players 100 score", GetName(playerid));
  3174. SendClientMessageToAll(BLUE, string);
  3175. }
  3176. else
  3177. {
  3178. SendClientMessage(playerid, RED, NO_PERM);
  3179. }
  3180. return 1;
  3181. }
  3182.  
  3183. COMMAND:killall(playerid,params[])
  3184. {
  3185. #pragma unused params
  3186. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_killall)
  3187. {
  3188. for(new i = 0; i < MAX_PLAYERS; i++)
  3189. {
  3190. if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
  3191. {
  3192. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3193. SetPlayerHealth(i,0.0);
  3194. }
  3195. }
  3196. new string[128];
  3197. format(string,sizeof(string),"Administrator \"%s\" has killed all players", GetName(playerid));
  3198. SendClientMessageToAll(BLUE, string);
  3199. }
  3200. else
  3201. {
  3202. SendClientMessage(playerid, RED, NO_PERM);
  3203. }
  3204. return 1;
  3205. }
  3206.  
  3207. COMMAND:kickall(playerid,params[])
  3208. {
  3209. #pragma unused params
  3210. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_kickall)
  3211. {
  3212. for(new i = 0; i < MAX_PLAYERS; i++)
  3213. {
  3214. if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
  3215. {
  3216. #if PRINT_BYKICK == true
  3217. printf("[KICK]: %s has been kicked", GetName(playerid));
  3218. #endif
  3219. Kick(i);
  3220. }
  3221. }
  3222. new string[128];
  3223. format(string,sizeof(string),"Administrator \"%s\" has kicked all players", GetName(playerid));
  3224. SendClientMessageToAll(DARK_BLUE, string);
  3225. }
  3226. else
  3227. {
  3228. SendClientMessage(playerid, RED, NO_PERM);
  3229. }
  3230. return 1;
  3231. }
  3232.  
  3233. COMMAND:setallwanted(playerid,params[])
  3234. {
  3235. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_setallwanted)
  3236. {
  3237. if(!strlen(params)) return SendClientMessage(playerid, RED, "Usage: /setallwanted <WantedLevel>");
  3238. new var = strval(params), string[128];
  3239. for(new i = 0; i < MAX_PLAYERS; i++)
  3240. {
  3241. if(IsPlayerConnected(i))
  3242. {
  3243. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3244. SetPlayerWantedLevel(i,var);
  3245. }
  3246. }
  3247. format(string,sizeof(string),"Administrator \"%s\" has set all players wanted level to '%d'", GetName(playerid), var);
  3248. SendClientMessageToAll(ORANGE, string);
  3249. }
  3250. else
  3251. {
  3252. SendClientMessage(playerid, RED, NO_PERM);
  3253. }
  3254. return 1;
  3255. }
  3256.  
  3257. COMMAND:disarmall(playerid,params[])
  3258. {
  3259. #pragma unused params
  3260. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_disarmall)
  3261. {
  3262. for(new i = 0; i < MAX_PLAYERS; i++)
  3263. {
  3264. if(IsPlayerConnected(i) && (i != playerid) && i != MAX_ADMIN_LEVEL)
  3265. {
  3266. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3267. ResetPlayerWeapons(i);
  3268. }
  3269. }
  3270. new string[128];
  3271. format(string,sizeof(string),"Administrator \"%s\" has disarmed all players", GetName(playerid));
  3272. SendClientMessageToAll(PURPLE, string);
  3273. }
  3274. else
  3275. {
  3276. SendClientMessage(playerid, RED, NO_PERM);
  3277. }
  3278. return 1;
  3279. }
  3280.  
  3281. COMMAND:ejectall(playerid,params[])
  3282. {
  3283. #pragma unused params
  3284. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_ejectall)
  3285. {
  3286. new Float:x, Float:y, Float:z;
  3287. for(new i = 0; i < MAX_PLAYERS; i++)
  3288. {
  3289. if(IsPlayerConnected(i) && i != MAX_ADMIN_LEVEL)
  3290. {
  3291. if(IsPlayerInAnyVehicle(i))
  3292. {
  3293. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3294. GetPlayerPos(i,x,y,z);
  3295. SetPlayerPos(i,x,y,z+3);
  3296. }
  3297. }
  3298. }
  3299. new string[128];
  3300. format(string,sizeof(string),"Administrator \"%s\" has ejected all Players", GetName(playerid));
  3301. SendClientMessageToAll(PURPLE, string);
  3302. }
  3303. else
  3304. {
  3305. SendClientMessage(playerid, RED, NO_PERM);
  3306. }
  3307. return 1;
  3308. }
  3309.  
  3310. COMMAND:giveallweapon(playerid,params[])
  3311. {
  3312. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_giveallweapon)
  3313. {
  3314. new gun, WeapName[64], string[128];
  3315. if(sscanf(params, "d", gun))
  3316. {
  3317. SendClientMessage(playerid,RED,"Usage: /giveallweapon <weapon id>");
  3318. return 1;
  3319. }
  3320.  
  3321. for(new i = 0; i < MAX_PLAYERS; i++)
  3322. {
  3323. if(IsPlayerConnected(i))
  3324. {
  3325. PlayerPlaySound(i,1057,0.0,0.0,0.0);
  3326. GivePlayerWeapon(i,gun,99999);
  3327. }
  3328. }
  3329. GetWeaponName(gun, WeapName, sizeof(WeapName));
  3330. format(string,sizeof(string),"Administrator \"%s\" has given all players a %s", GetName(playerid), WeapName);
  3331. SendClientMessageToAll(BLUE, string);
  3332. }
  3333. else
  3334. {
  3335. SendClientMessage(playerid, RED, NO_PERM);
  3336. }
  3337. return 1;
  3338. }
  3339.  
  3340. COMMAND:enable(playerid,params[])
  3341. {
  3342. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_enable || IsPlayerAdmin(playerid))
  3343. {
  3344. new cmd[64];
  3345. if(sscanf(params, "s", cmd))
  3346. {
  3347. SendClientMessage(playerid,RED,"Usage: /enable <PingKicker / AntiCaps / Chat / AutoLogin / ConnectMsgs>");
  3348. return 1;
  3349. }
  3350.  
  3351. if(!strcmp(cmd, "pingkicker", true))
  3352. {
  3353. if(ServerInfo[PingSystem] == false)
  3354. {
  3355. for(new i=0; i <= MAX_PLAYERS; i++)
  3356. {
  3357. #if IS_ADMIN_IMMUNE == true
  3358. if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
  3359. #endif
  3360. if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  3361. PlayerInfo[i][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", i);
  3362. }
  3363. SendClientMessage(playerid, GREEN, "Anti High Ping System has been enabled");
  3364. ServerInfo[PingSystem] = true;
  3365. }
  3366. }
  3367. else if(!strcmp(cmd, "anticaps", true))
  3368. {
  3369. ServerInfo[NoCaps] = true;
  3370. }
  3371. else if(!strcmp(cmd, "chat", true))
  3372. {
  3373. ServerInfo[EnableChat] = true;
  3374. }
  3375. else if(!strcmp(cmd, "autologin", true))
  3376. {
  3377. ServerInfo[AutoLogin] = true;
  3378. }
  3379. else if(!strcmp(cmd, "connectmsgs", true))
  3380. {
  3381. ServerInfo[ConnectMessages] = true;
  3382. }
  3383. }
  3384. else
  3385. {
  3386. SendClientMessage(playerid, RED, NO_PERM);
  3387. }
  3388. return 1;
  3389. }
  3390.  
  3391. COMMAND:disable(playerid,params[])
  3392. {
  3393. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_disable || IsPlayerAdmin(playerid))
  3394. {
  3395. new cmd[64];
  3396. if(sscanf(params, "s", cmd))
  3397. {
  3398. SendClientMessage(playerid,RED,"Usage: /disable <PingKicker / AntiCaps / Chat / ConnectMsgs>");
  3399. return 1;
  3400. }
  3401.  
  3402. if(!strcmp(cmd, "pingkicker", true))
  3403. {
  3404. if(ServerInfo[PingSystem] == true)
  3405. {
  3406. for(new i=0; i <= MAX_PLAYERS; i++)
  3407. {
  3408. #if IS_ADMIN_IMMUNE == true
  3409. if(IsPlayerAdmin(i) || PlayerInfo[i][AdminLevel] >= 1) continue;
  3410. #endif
  3411.  
  3412. if(!IsPlayerConnected(i) || IsPlayerNPC(i) || PlayerInfo[i][PingTimer] == -1) continue;
  3413. KillTimer(PlayerInfo[i][PingTimer]);
  3414. PlayerInfo[i][PingTimer] = -1;
  3415. }
  3416. ServerInfo[PingSystem] = false;
  3417. SendClientMessage(playerid, RED, "Anti High Ping System has been disabled");
  3418. }
  3419. }
  3420. else if(!strcmp(cmd, "anticaps", true))
  3421. {
  3422. ServerInfo[NoCaps] = false;
  3423. }
  3424. else if(!strcmp(cmd, "chat", true))
  3425. {
  3426. ServerInfo[EnableChat] = false;
  3427. }
  3428. else if(!strcmp(cmd, "autologin", true))
  3429. {
  3430. ServerInfo[AutoLogin] = false;
  3431. }
  3432. else if(!strcmp(cmd, "connectmsgs", true))
  3433. {
  3434. ServerInfo[ConnectMessages] = false;
  3435. }
  3436. }
  3437. else
  3438. {
  3439. SendClientMessage(playerid, RED, NO_PERM);
  3440. }
  3441. return 1;
  3442. }
  3443.  
  3444. COMMAND:specoff(playerid,params[])
  3445. {
  3446. #pragma unused params
  3447. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_spec || IsPlayerAdmin(playerid))
  3448. {
  3449. if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
  3450. {
  3451. StopSpectate(playerid);
  3452. SendClientMessage(playerid,BLUE,"No Longer Spectating");
  3453. }
  3454. else
  3455. {
  3456. SendClientMessage(playerid,RED,"ERROR: You are not spectating");
  3457. }
  3458. }
  3459. else
  3460. {
  3461. SendClientMessage(playerid, RED, NO_PERM);
  3462. }
  3463. return 1;
  3464. }
  3465. #endif
  3466.  
  3467. COMMAND:onduty(playerid,params[])
  3468. {
  3469. #pragma unused params
  3470. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_onduty)
  3471. {
  3472. if(PlayerInfo[playerid][AdminOnDuty] == false)
  3473. {
  3474. PlayerInfo[playerid][AdminOnDuty] = true;
  3475. SetPlayerColor(playerid, RED);
  3476. adminlabel[playerid] = Create3DTextLabel("ADMIN ON DUTY", RED,0,0,0,70.5,1);
  3477. Attach3DTextLabelToPlayer(adminlabel[playerid], playerid, 0.0, 0.0, 0.45);
  3478. new aonduty[64];
  3479. format(aonduty, sizeof(aonduty), "[ Administrator %s is now onduty! ]", GetName(playerid));
  3480. SendClientMessageToAll(RED, aonduty);
  3481. SetPlayerHealth(playerid,999999);
  3482. }
  3483. else if(PlayerInfo[playerid][AdminOnDuty] == true)
  3484. {
  3485. SendClientMessage(playerid,RED,"You are already onduty!");
  3486. }
  3487. }
  3488. else
  3489. {
  3490. SendClientMessage(playerid, RED, NO_PERM);
  3491. }
  3492. return 1;
  3493. }
  3494.  
  3495. COMMAND:offduty(playerid,params[])
  3496. {
  3497. #pragma unused params
  3498. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_onduty)
  3499. {
  3500. if(PlayerInfo[playerid][AdminOnDuty] == true)
  3501. {
  3502. PlayerInfo[playerid][AdminOnDuty] = false;
  3503. new offduty[64];
  3504. Delete3DTextLabel(adminlabel[playerid]);
  3505. format(offduty, sizeof(offduty), "[ Administrator %s is now offduty! ]", GetName(playerid));
  3506. SendClientMessageToAll(GREEN, offduty);
  3507. SetPlayerColor(playerid, WHITE);
  3508. SetPlayerHealth(playerid,100);
  3509. }
  3510. else if(PlayerInfo[playerid][AdminOnDuty] == false)
  3511. {
  3512. SendClientMessage(playerid,RED,"You are not onduty!");
  3513. }
  3514. }
  3515. else
  3516. {
  3517. SendClientMessage(playerid, RED, NO_PERM);
  3518. }
  3519. return 1;
  3520. }
  3521.  
  3522. COMMAND:flip(playerid, params[])
  3523. {
  3524. #pragma unused params
  3525. new currentveh,
  3526. Float:angle;
  3527. currentveh = GetPlayerVehicleID(playerid);
  3528. GetVehicleZAngle(currentveh, angle);
  3529. SetVehicleZAngle(currentveh, angle);
  3530. SendClientMessage(playerid, WHITE, "Your vehicle has been fliped!");
  3531. return 1;
  3532. }
  3533.  
  3534. COMMAND:stats(playerid,params[])
  3535. {
  3536. new string[250], pDeaths, player1, player, h, m, s;
  3537.  
  3538. if(sscanf(params, "r", player))
  3539. {
  3540. player1 = playerid;
  3541. }
  3542. else
  3543. {
  3544. player1 = player;
  3545. }
  3546.  
  3547. if(IsPlayerConnected(player1))
  3548. {
  3549. TotalGameTime(player1, h, m, s);
  3550. if(PlayerInfo[player1][Deaths] == 0) { pDeaths = 1; }
  3551. else { pDeaths = PlayerInfo[player1][Deaths]; }
  3552. #if USE_VIP_SYSTEM == true
  3553. format(string, sizeof(string), "\n{FEFEFE}Stats of the player: %s\n\n{FEFEFE}Kills:\t\t%d\nDeaths:\t\t%d\nK/D:\t\t%0.2f\nScore:\t\t%d\nMoney:\t\t$%d\nVIP Level:\t%d\nHours:\t\t%d\nMinutes\t%d\nSeconds:\t%d\nRegister date:\t%s",GetName(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerScore(player1),GetPlayerMoney(player1),PlayerInfo[player1][VIPLevel],h,m,s,PlayerInfo[player1][RegDate]);
  3554. #else
  3555. format(string, sizeof(string), "\n{FEFEFE}Stats of the player: %s\n\n{FEFEFE}Kills:\t\t%d\nDeaths:\t\t%d\nK/D:\t\t%0.2f\nScore:\t\t%d\nMoney:\t\t$%d\nHours:\t\t%d\nMinutes\t%d\nSeconds:\t%d\nRegister date:\t%s",GetName(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerScore(player1),GetPlayerMoney(player1),h,m,s,PlayerInfo[player1][RegDate]);
  3556. #endif
  3557. ShowPlayerDialog(playerid, STATS_DIALOG, DIALOG_STYLE_MSGBOX, " ", string, "OK", "");
  3558. }
  3559. else
  3560. {
  3561. SendClientMessage(playerid, RED, "Player is not connected!");
  3562. }
  3563. return 1;
  3564. }
  3565.  
  3566. COMMAND:aka(playerid,params[])
  3567. {
  3568. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_aka)
  3569. {
  3570. new player;
  3571. if(sscanf(params, "r", player))
  3572. {
  3573. SendClientMessage(playerid, RED, "Usage: /aka <playerid>");
  3574. return 1;
  3575. }
  3576. new IP[16];
  3577. #if USE_MYSQL == true
  3578. GetPlayerIp(player, IP, sizeof(IP));
  3579. GetUsersByIp(playerid, IP);
  3580. #else
  3581. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
  3582. {
  3583. new string[256];
  3584. GetPlayerIp(player,IP,sizeof(IP));
  3585. format(string,sizeof(string),"Names: %s", dini_Get("/aka.txt",IP));
  3586. SendClientMessage(playerid,LIGHT_GREEN,string);
  3587. }
  3588. #endif
  3589. }
  3590. else
  3591. {
  3592. SendClientMessage(playerid, RED, NO_PERM);
  3593. }
  3594. return 1;
  3595. }
  3596. COMMAND:report(playerid,params[])
  3597. {
  3598. new player, reason[128];
  3599. if(sscanf(params, "rs[128]", player, reason))
  3600. {
  3601. return SendClientMessage(playerid,RED,"Usage: /report <playerid/part of nick> <reason>");
  3602. }
  3603. PlayerInfo[player][ReportCount]++;
  3604.  
  3605. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] == 0)
  3606. {
  3607. if(strlen(reason) < 4)
  3608. {
  3609. SendClientMessage(playerid, RED, "Please write more");
  3610. return 1;
  3611. }
  3612. new hour,minute,second, string[128];
  3613. gettime(hour,minute,second);
  3614. format(string, sizeof(string), "||NewReport|| %s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", GetName(playerid), playerid, GetName(player), player, reason, hour, minute, second);
  3615. AdminMSG(RED,string);
  3616. format(string, sizeof(string), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour, minute, second, GetName(playerid), playerid, GetName(player), player, reason);
  3617. for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
  3618. Reports[MAX_REPORTS-1] = string;
  3619. SendClientMessage(playerid,YELLOW, "Your report has been sent to online administrators.");
  3620. }
  3621. else
  3622. {
  3623. SendClientMessage(playerid, RED, "You cannot report this player");
  3624. }
  3625. return 1;
  3626. }
  3627.  
  3628. COMMAND:reports(playerid,params[])
  3629. {
  3630. #pragma unused params
  3631. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_reports)
  3632. {
  3633. new rReportCount;
  3634. for(new i = 1; i < MAX_REPORTS; i++)
  3635. {
  3636. if(strcmp(Reports[i], "<none>", true) != 0)
  3637. {
  3638. rReportCount++;
  3639. SendClientMessage(playerid,WHITE,Reports[i]);
  3640. }
  3641. }
  3642. if(rReportCount == 0)
  3643. {
  3644. SendClientMessage(playerid,WHITE,"There have been no reports");
  3645. }
  3646. }
  3647. else
  3648. {
  3649. SendClientMessage(playerid, RED, NO_PERM);
  3650. }
  3651. return 1;
  3652. }
  3653.  
  3654. COMMAND:warn(playerid,params[])
  3655. {
  3656. if(PlayerInfo[playerid][AdminLevel] >= LEVEL_warn)
  3657. {
  3658. new player, reason[128];
  3659. if(sscanf(params, "rs[128]", player, reason))
  3660. {
  3661. SendClientMessage(playerid,RED,"Usage: /warn <playerid/part of nick> <reason>");
  3662. return 1;
  3663. }
  3664.  
  3665. if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL)
  3666. {
  3667. SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this admin");
  3668. return 1;
  3669. }
  3670. if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid)
  3671. {
  3672. new string[128];
  3673. PlayerInfo[player][Warnings]++;
  3674. if(PlayerInfo[player][Warnings] == MAX_WARNINGS)
  3675. {
  3676. format(string, sizeof(string), "**\"%s\" has been kicked. (Reason: %s) (Warning: %d/%d)", GetName(player), reason, PlayerInfo[player][Warnings], MAX_WARNINGS);
  3677. SendClientMessageToAll(GREY, string);
  3678. PlayerInfo[player][KickCount]++;
  3679. #if PRINT_BYKICK == true
  3680. printf("[KICK]: %s has been kicked", GetName(playerid));
  3681. #endif
  3682. Kick(player);
  3683. }
  3684. else
  3685. {
  3686. format(string, sizeof(string), "**Administrator \"%s\" has given \"%s\" a kick warning. (Reason: %s) (Warning: %d/%d)", GetName(playerid), GetName(player), reason, PlayerInfo[player][Warnings], MAX_WARNINGS);
  3687. SendClientMessageToAll(YELLOW, string);
  3688. }
  3689. }
  3690. else
  3691. {
  3692. SendClientMessage(playerid, RED, "ERROR: Player is not connected or invalid");
  3693. }
  3694. }
  3695. else
  3696. {
  3697. SendClientMessage(playerid, RED, NO_PERM);
  3698. }
  3699. return 1;
  3700. }
  3701.  
  3702. //==============================================================================
  3703. //------------------------------------------------------------------------------
  3704. // Stocks
  3705. //------------------------------------------------------------------------------
  3706. //==============================================================================
  3707. stock ShowPlayerLoginDialog(playerid)
  3708. {
  3709. new string[256];
  3710. format(string, sizeof(string), ""white"Welcome back on "blue""#SERVER_NAME""white", "grey"%s"white"!\nThe name that you are using is registered.\n\nPlease enter the password:", GetName(playerid));
  3711. ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "");
  3712. return 1;
  3713. }
  3714.  
  3715. stock ShowPlayerRegisterDialog(playerid)
  3716. {
  3717. new string[256];
  3718. format(string, sizeof(string), ""white"Welcome on "blue""#SERVER_NAME""white","grey" %s!\n"white"Your name "grey" %s "white"is not registered.\n\nPlease enter a password for your new account:", GetName(playerid), GetName(playerid));
  3719. ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "Registration", string, "Register", "");
  3720. return 1;
  3721. }
  3722.  
  3723. stock GetUsersByIp(playerid, IP[])
  3724. {
  3725. new query[128];
  3726. format(query, sizeof(query), "SELECT * FROM `"#MYSQL_TABLE"` WHERE `LastIP` = '%s'", IP);
  3727. if(mysql_ping(gSQL))
  3728. {
  3729. mysql_query(query, _THREAD_GET_AKA, playerid, gSQL);
  3730. return 1;
  3731. }
  3732. return 0;
  3733. }
  3734.  
  3735. stock SavePlayer(playerid)
  3736. {
  3737. new h, m, s, Float:health, Float:armour, Float:POS[3];
  3738. TotalGameTime(playerid, h, m, s);
  3739. GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
  3740. GetPlayerHealth(playerid, health);
  3741. GetPlayerArmour(playerid, armour);
  3742.  
  3743. #if USE_MYSQL == true
  3744. new query[789];
  3745. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `XPos` = %.2f, `YPos` = %.2f, `ZPos` = %.2f, `AdminLevel` = %d, `VIPLevel` = %d, `WantedLevel` = %d, \
  3746. `Kills` = %d, `Deaths` = %d, `Money` = %d, `Score` = %d, `Health` = %.2f, `Armour` = %.2f, `Hours` = %d, `Minutes` = %d, `Seconds` = %d, `LastSkin` = %d, `KickCount` = %d, `SpawnCount` = %d, `ReportCount` = %d \
  3747. WHERE `PlayerName` = '%s'",
  3748. POS[0],
  3749. POS[1],
  3750. POS[2],
  3751. PlayerInfo[playerid][AdminLevel],
  3752. PlayerInfo[playerid][VIPLevel],
  3753. GetPlayerWantedLevel(playerid),
  3754. PlayerInfo[playerid][Kills],
  3755. PlayerInfo[playerid][Deaths],
  3756. GetPlayerMoney(playerid),
  3757. GetPlayerScore(playerid),
  3758. health,
  3759. armour,
  3760. h,
  3761. m,
  3762. s,
  3763. PlayerInfo[playerid][LastSkin],
  3764. PlayerInfo[playerid][KickCount],
  3765. PlayerInfo[playerid][SpawnCount],
  3766. PlayerInfo[playerid][ReportCount],
  3767. GetName(playerid));
  3768.  
  3769. if(mysql_ping(gSQL))
  3770. {
  3771. mysql_query(query, _THREAD_SAVE_PLAYER, 0, gSQL);
  3772. }
  3773. #else
  3774. new file[128];
  3775. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3776. dini_FloatSet(file, "XPos", POS[0]);
  3777. dini_FloatSet(file, "YPos", POS[1]);
  3778. dini_FloatSet(file, "ZPos", POS[2]);
  3779. dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
  3780. #if USE_VIP_SYSTEM == true
  3781. dini_IntSet(file, "VIPLevel", PlayerInfo[playerid][VIPLevel]);
  3782. #endif
  3783. dini_IntSet(file, "WantedLevel", GetPlayerWantedLevel(playerid));
  3784. dini_IntSet(file, "Kills", PlayerInfo[playerid][Kills]);
  3785. dini_IntSet(file, "Deaths", PlayerInfo[playerid][Deaths]);
  3786. dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  3787. dini_IntSet(file, "Score", GetPlayerScore(playerid));
  3788. dini_FloatSet(file, "Health", health);
  3789. dini_FloatSet(file, "Armour", armour);
  3790. dini_IntSet(file, "Hours", h);
  3791. dini_IntSet(file, "Minutes", m);
  3792. dini_IntSet(file, "Seconds", s);
  3793. dini_IntSet(file, "KickCount", PlayerInfo[playerid][KickCount]);
  3794. dini_IntSet(file, "LastSkin", PlayerInfo[playerid][LastSkin]);
  3795. dini_IntSet(file, "SpawnCount", PlayerInfo[playerid][SpawnCount]);
  3796. dini_IntSet(file, "ReportCount", PlayerInfo[playerid][ReportCount]);
  3797. dini_IntSet(file, "KickCount", PlayerInfo[playerid][KickCount]);
  3798. #endif
  3799. }
  3800.  
  3801. stock MySQLCheckAutoLogin(playerid, ip[])
  3802. {
  3803. new query[256];
  3804. format(query, sizeof(query), "SELECT `LastIP` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `LastIP` = '%s'", GetName(playerid), ip);
  3805. if(mysql_ping(gSQL))
  3806. {
  3807. mysql_query(query, _CHECK_AUTO_LOGIN, playerid, gSQL);
  3808. return 1;
  3809. }
  3810. return 0;
  3811. }
  3812.  
  3813. stock CreateAccount(playerid, password[])
  3814. {
  3815. new IP[16], Date[16], year, month, day;
  3816. getdate(year, month, day);
  3817. GetPlayerIp(playerid, IP, sizeof(IP));
  3818. format(Date, sizeof(Date), "%d/%d/%d", day, month, year);
  3819.  
  3820. #if USE_MYSQL == true
  3821. new query[300];
  3822. PlayerInfo[playerid][RegDate] = Date;
  3823. mysql_real_escape_string(password, password);
  3824. format(query, sizeof(query), "INSERT INTO `"#MYSQL_TABLE"` (`PlayerName`, `Hash`, `LastIP`, `Status`, `RegDate`) VALUES ('%s', MD5('%s'), '%s', 1, '%s')", GetName(playerid), password, IP, Date);
  3825. if(mysql_ping(gSQL))
  3826. {
  3827. mysql_query(query, _THREAD_CREATE_PLAYER, playerid, gSQL);
  3828. }
  3829. #else
  3830. new file[128];
  3831. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3832. dini_Create(file);
  3833. dini_IntSet(file, "Status", 1);
  3834. dini_Set(file, "Hash", MD5_Hash(password));
  3835. dini_Set(file, "LastIP", IP);
  3836. dini_Set(file, "RegDate", Date);
  3837. if(strlen(dini_Get("/aka.txt", IP)) == 0)
  3838. {
  3839. dini_Set("/aka.txt", IP, GetName(playerid));
  3840. }
  3841. else
  3842. {
  3843. new string[256];
  3844. format(string,sizeof(string),"%s,%s", dini_Get("/aka.txt", IP), GetName(playerid));
  3845. dini_Set("/aka.txt", IP, string);
  3846. }
  3847. SendClientMessage(playerid,LIGHT_GREEN,"Account successfully created. Welcome!");
  3848. PlayerInfo[playerid][Logged] = true;
  3849. PlayerInfo[playerid][RegDate] = Date;
  3850. SavePlayer(playerid);
  3851. #endif
  3852. }
  3853.  
  3854. stock CheckPlayerPassword(playerid, hash[])
  3855. {
  3856. #if USE_MYSQL == true
  3857. new query[256];
  3858. mysql_real_escape_string(hash, hash);
  3859. format(query, sizeof(query), "SELECT `Hash` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `Hash`= MD5('%s')", GetName(playerid), hash);
  3860. if(mysql_ping(gSQL))
  3861. {
  3862. mysql_query(query, _CHECK_PASSWORD, playerid, gSQL);
  3863. }
  3864. #else
  3865. new file[128];
  3866. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3867. if(!strcmp(dini_Get(file, "Hash"), MD5_Hash(hash), true))
  3868. {
  3869. LoadPlayer(playerid);
  3870. LogPlayerIn(playerid);
  3871. if(PlayerInfo[playerid][AdminLevel] > 0)
  3872. {
  3873. new string[128];
  3874. format(string,sizeof(string),"Successfully logged in. (Adminlevel %d)", PlayerInfo[playerid][AdminLevel]);
  3875. SendClientMessage(playerid,GREEN,string);
  3876. } else SendClientMessage(playerid,GREEN,"Successfully logged in!");
  3877. }
  3878. else
  3879. {
  3880. SendClientMessage(playerid,RED,"Login failed! Incorrect password");
  3881. PlayerInfo[playerid][FailLogin]++;
  3882. printf("LOGIN: %s has failed to login, Wrong password Attempt (%d)", GetName(playerid), PlayerInfo[playerid][FailLogin]);
  3883. if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
  3884. {
  3885. #if PRINT_BYKICK == true
  3886. printf("%s has been kicked (Failed Logins)",GetName(playerid));
  3887. #endif
  3888. Kick(playerid);
  3889. }else ShowPlayerLoginDialog(playerid);
  3890. }
  3891. #endif
  3892. return 1;
  3893. }
  3894.  
  3895. stock GivePlayerScore(playerid,amount)
  3896. {
  3897. SetPlayerScore(playerid,GetPlayerScore(playerid)+amount);
  3898. return 1;
  3899. }
  3900.  
  3901. stock ExistAccount(playerid)
  3902. {
  3903. #if USE_MYSQL == true
  3904. new query[128];
  3905. format(query, sizeof(query), "SELECT * FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
  3906. if(mysql_ping(gSQL))
  3907. {
  3908. mysql_query(query, _THREAD_ACCOUNT_EXIST, playerid, gSQL);
  3909. }
  3910. #else
  3911. new file[128];
  3912. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3913. if(dini_Exists(file))
  3914. {
  3915. if(IsPlayerDiniBanned(playerid))
  3916. {
  3917. new string[128];
  3918. format(string, sizeof(string), ""red"Your account has been banned!"white"\n\nBanned by:\t %s\nReason:\t %s\nBan Date:\t %s", dini_Get(file, "BannedBy"), dini_Get(file, "BanReason"), dini_Get(file, "BanDate"));
  3919. ShowPlayerDialog(playerid, BAN_DIALOG, DIALOG_STYLE_MSGBOX, " ", string, "OK", "");
  3920. KickEx(playerid);
  3921. }
  3922. else
  3923. {
  3924. #if USE_AUTO_LOGIN == true
  3925. new lastusedIP[16], IP[16];
  3926. GetPlayerIp(playerid, IP, sizeof(IP));
  3927. format(lastusedIP, sizeof(lastusedIP), "%s", dini_Get(file, "LastIP"));
  3928. if(!strcmp(IP, lastusedIP, true))
  3929. {
  3930. SendClientMessage(playerid, GREEN, "SERVER: You will get auto logged in now");
  3931. LoadPlayer(playerid);
  3932. LogPlayerIn(playerid);
  3933. SendClientMessage(playerid, GREEN, "You have been automatically logged in");
  3934. }else ShowPlayerLoginDialog(playerid);
  3935. #else
  3936. ShowPlayerLoginDialog(playerid);
  3937. #endif
  3938. }
  3939. }
  3940. else
  3941. {
  3942. ShowPlayerRegisterDialog(playerid);
  3943. }
  3944. #endif
  3945. return 1;
  3946. }
  3947.  
  3948. stock LogPlayerOut(playerid)
  3949. {
  3950. #if USE_MYSQL == true
  3951. new query[128];
  3952. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `LastSkin` = %d, `Status` = 0 WHERE `PlayerName` = '%s'", GetPlayerSkin(playerid), GetName(playerid));
  3953. if(mysql_ping(gSQL))
  3954. {
  3955. mysql_query(query, _THREAD_PLAYER_LOGOUT, playerid, gSQL);
  3956. }
  3957. #else
  3958. new file[128];
  3959. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3960. dini_IntSet(file, "Status", 0);
  3961. dini_IntSet(file, "LastSkin", GetPlayerSkin(playerid));
  3962. #endif
  3963. return 1;
  3964. }
  3965.  
  3966. stock LogPlayerIn(playerid)
  3967. {
  3968. new IP[16];
  3969. GetPlayerIp(playerid, IP, sizeof(IP));
  3970. #if USE_MYSQL == true
  3971. new query[128];
  3972. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `LastIP` = '%s', `Status` = 1 WHERE `PlayerName` = '%s'", IP, GetName(playerid));
  3973. if(mysql_ping(gSQL))
  3974. {
  3975. mysql_query(query, _THREAD_PLAYER_LOGIN, playerid, gSQL);
  3976. }
  3977. #else
  3978. new file[128];
  3979. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3980. dini_IntSet(file, "Status", 1);
  3981. dini_Set(file, "LastIP", IP);
  3982. #endif
  3983. return 1;
  3984. }
  3985.  
  3986. #if USE_MYSQL == false
  3987. stock IsPlayerDiniBanned(playerid)
  3988. {
  3989. new file[128];
  3990. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  3991. if(dini_Int(file, "Status") == 2) return true;
  3992. return false;
  3993. }
  3994. #else
  3995. stock LoadMySQLBanStat(playerid)
  3996. {
  3997. new query[256];
  3998. format(query,sizeof(query),"SELECT `BannedBy`, `BanReason`, `BanDate` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
  3999.  
  4000. if(mysql_ping(gSQL))
  4001. {
  4002. mysql_query(query, _FETCH_BAN_STAT, playerid, gSQL);
  4003. return 1;
  4004. }
  4005. return 0;
  4006. }
  4007.  
  4008. stock IsPlayerMySQLBanned(playerid)
  4009. {
  4010. new query[128];
  4011. format(query, sizeof(query), "SELECT `Status` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s' AND `Status` = 2", GetName(playerid));
  4012. if(mysql_ping(gSQL))
  4013. {
  4014. mysql_query(query, _THREAD_IS_BANNED, playerid, gSQL);
  4015. return 1;
  4016. }
  4017. return 0;
  4018. }
  4019. #endif
  4020.  
  4021. stock UpdatePlayerPass(playerid, newpass[])
  4022. {
  4023. #if USE_MYSQL == true
  4024. new query[128];
  4025. mysql_real_escape_string(newpass, newpass);
  4026. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Hash` = MD5('%s') WHERE `PlayerName` = '%s'", newpass, GetName(playerid));
  4027.  
  4028. if(mysql_ping(gSQL))
  4029. {
  4030. mysql_query(query, _UPDATE_PLAYER_PW, playerid, gSQL);
  4031. }
  4032. #else
  4033. new file[128];
  4034. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  4035. dini_Set(file, "Hash", newpass);
  4036. #endif
  4037. return 1;
  4038. }
  4039.  
  4040. stock CreateBan(playerid, adminname[], reason[])
  4041. {
  4042. new Date[16], year, month, day;
  4043. getdate(year, month, day);
  4044. format(Date, sizeof(Date), "%d/%d/%d", day, month, year);
  4045. #if USE_MYSQL == true
  4046. new query[256];
  4047. mysql_real_escape_string(reason, reason);
  4048. mysql_real_escape_string(adminname, adminname);
  4049. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Status` = 2, `BannedBy` = '%s', `BanReason` = '%s', `BanDate` = '%s' WHERE `PlayerName` = '%s'", adminname, reason, Date, GetName(playerid));
  4050. if(mysql_ping(gSQL))
  4051. {
  4052. mysql_query(query, _THREAD_BAN_USER, 0, gSQL);
  4053. }
  4054. #else
  4055. new file[128];
  4056. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  4057. dini_IntSet(file, "Status", 2);
  4058. dini_Set(file, "BannedBy", adminname);
  4059. dini_Set(file, "BanReason", reason);
  4060. dini_Set(file, "BanDate", Date);
  4061. #endif
  4062. return 1;
  4063. }
  4064.  
  4065. stock LoadPlayer(playerid)
  4066. {
  4067. #if LOAD_PLAYER_POS == true
  4068. SetPVarInt(playerid, "1stSpawn", 1);
  4069. #endif
  4070.  
  4071. #if USE_MYSQL == true
  4072. new query[634];
  4073. format(query,sizeof(query),"SELECT `XPos`,`YPos`,`ZPos`,`AdminLevel`,`VIPLevel`,`WantedLevel`,`Kills`,`Deaths`,`Money`,`Score`,`Health`,`Armour`,`Hours`,`Minutes`,`Seconds`,`KickCount`,`LastSkin`,`SpawnCount`,`ReportCount`,`RegDate` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
  4074. if(mysql_ping(gSQL))
  4075. {
  4076. mysql_query(query, _THREAD_LOAD_PLAYER, playerid, gSQL);
  4077. }
  4078. #else
  4079. new file[128], date[16];
  4080. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  4081. PlayerInfo[playerid][XPos] = dini_Float(file, "XPos");
  4082. PlayerInfo[playerid][YPos] = dini_Float(file, "YPos");
  4083. PlayerInfo[playerid][ZPos] = dini_Float(file, "ZPos");
  4084. PlayerInfo[playerid][Health] = dini_Float(file, "Health");
  4085. PlayerInfo[playerid][Armour] = dini_Float(file, "Armour");
  4086. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  4087. PlayerInfo[playerid][VIPLevel] = dini_Int(file, "VIPLevel");
  4088. SetPlayerWantedLevel(playerid, dini_Int(file, "WantedLevel"));
  4089. PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
  4090. PlayerInfo[playerid][Deaths] = dini_Int(file, "Deaths");
  4091. GivePlayerMoney(playerid, dini_Int(file, "Money"));
  4092. SetPlayerScore(playerid, dini_Int(file, "Score"));
  4093. PlayerInfo[playerid][Hours] = dini_Int(file, "Hours");
  4094. PlayerInfo[playerid][Minutes] = dini_Int(file, "Minutes");
  4095. PlayerInfo[playerid][Seconds] = dini_Int(file, "Seconds");
  4096. PlayerInfo[playerid][LastSkin] = dini_Int(file, "LastSkin");
  4097. PlayerInfo[playerid][KickCount] = dini_Int(file, "KickCount");
  4098. PlayerInfo[playerid][SpawnCount] = dini_Int(file, "SpawnCount");
  4099. PlayerInfo[playerid][ReportCount]= dini_Int(file, "ReportCount");
  4100. format(date, sizeof(date), "%s", dini_Get(file, "RegDate"));
  4101. PlayerInfo[playerid][RegDate] = date;
  4102. PlayerInfo[playerid][Logged] = true;
  4103. #endif
  4104.  
  4105. return 1;
  4106. }
  4107.  
  4108. #if USE_MYSQL == true
  4109. stock ConnectToDatabase()
  4110. {
  4111. gSQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
  4112. if(mysql_ping(gSQL) == 1)
  4113. {
  4114. printf("Successfully connected to MySQL server | %s", MYSQL_HOST);
  4115. }
  4116. else
  4117. {
  4118. printf("Cannot connect to MySQL Server | %s aborting...", MYSQL_HOST);
  4119. SendRconCommand("exit");
  4120. }
  4121. return 1;
  4122. }
  4123. stock MySQLBanUser(playerid, admin[], reason[])
  4124. {
  4125. new query[128], date[16], year, month, day;
  4126. getdate(year, month, day);
  4127. format(date, sizeof(date), "%d/%d/%d", day, month, year);
  4128. format(query, sizeof(query), "UPDATE `"#MYSQL_TABLE"` SET `Status` = 2, `BannedBy` = '%s', `BanReason` = '%s', `BanDate` = '%s' WHERE `PlayerName` = '%s'", admin, reason, date, GetName(playerid));
  4129. if(mysql_ping(gSQL))
  4130. {
  4131. mysql_query(query, _THREAD_BAN_USER, playerid, gSQL);
  4132. }
  4133. return 1;
  4134. }
  4135. #else
  4136. stock DiniBanPlayer(playerid, admin[], reason[])
  4137. {
  4138. new file[128], date[16], year, month, day;
  4139. getdate(year, month, day);
  4140. format(date, sizeof(date), "%d/%d/%d", day, month, year);
  4141. format(file, sizeof(file), "/%s/%s.ini", DINI_PATH, GetName(playerid));
  4142. dini_IntSet(file, "Status", 2);
  4143. dini_Set(file, "BannedBy", admin);
  4144. dini_Set(file, "BanReason", reason);
  4145. dini_Set(file, "BanDate", date);
  4146. Kick(player);
  4147. return 1;
  4148. }
  4149. #endif
  4150. stock KickEx(playerid)
  4151. {
  4152. SetTimerEx("Kick_Delay",1264,false,"d",playerid);
  4153. return 1;
  4154. }
  4155.  
  4156. public Kick_Delay(playerid)
  4157. {
  4158. Kick(playerid);
  4159. return 1;
  4160. }
  4161. stock GetName(playerid)
  4162. {
  4163. new name[MAX_PLAYER_NAME];
  4164. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  4165. return name;
  4166. }
  4167.  
  4168. TotalGameTime(playerid, &h=0, &m=0, &s=0)
  4169. {
  4170. PlayerInfo[playerid][TotalTime] = ( (gettime() - PlayerInfo[playerid][ConnectTime]) + (PlayerInfo[playerid][Hours]*60*60) + (PlayerInfo[playerid][Minutes]*60) + (PlayerInfo[playerid][Seconds]) );
  4171.  
  4172. h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
  4173. m = floatround(PlayerInfo[playerid][TotalTime] / 60, floatround_floor) % 60;
  4174. s = floatround(PlayerInfo[playerid][TotalTime] % 60, floatround_floor);
  4175.  
  4176. return PlayerInfo[playerid][TotalTime];
  4177. }
  4178.  
  4179. #if ENABLE_SPECATE == true
  4180. stock AdvanceSpectate(playerid)
  4181. {
  4182. if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
  4183. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
  4184. {
  4185. for(new x=PlayerInfo[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
  4186. {
  4187. if(x == MAX_PLAYERS) x = 0;
  4188. if(IsPlayerConnected(x) && x != playerid)
  4189. {
  4190. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
  4191. {
  4192. continue;
  4193. }
  4194. else
  4195. {
  4196. StartSpectate(playerid, x);
  4197. break;
  4198. }
  4199. }
  4200. }
  4201. }
  4202. return 1;
  4203. }
  4204. stock StartSpectate(playerid, specplayerid)
  4205. {
  4206. for(new x=0; x<MAX_PLAYERS; x++)
  4207. {
  4208. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
  4209. {
  4210. AdvanceSpectate(x);
  4211. }
  4212. }
  4213.  
  4214. SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
  4215. TogglePlayerSpectating(playerid, 1);
  4216.  
  4217. if(IsPlayerInAnyVehicle(specplayerid))
  4218. {
  4219. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
  4220. PlayerInfo[playerid][SpecID] = specplayerid;
  4221. PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
  4222. }
  4223. else
  4224. {
  4225. PlayerSpectatePlayer(playerid, specplayerid);
  4226. PlayerInfo[playerid][SpecID] = specplayerid;
  4227. PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
  4228. }
  4229. new string[100], Float:hp, Float:ar;
  4230. GetPlayerHealth(specplayerid, hp); GetPlayerArmour(specplayerid, ar);
  4231. format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~w~%s - id:%d~n~< sprint - jump >~n~hp:%0.1f ar:%0.1f $%d", GetName(specplayerid),specplayerid,hp,ar,GetPlayerMoney(specplayerid));
  4232. GameTextForPlayer(playerid,string,25000,3);
  4233. return 1;
  4234. }
  4235. stock StopSpectate(playerid)
  4236. {
  4237. TogglePlayerSpectating(playerid, 0);
  4238. PlayerInfo[playerid][SpecID] = INVALID_PLAYER_ID;
  4239. PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
  4240. GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
  4241. return 1;
  4242. }
  4243. stock ReverseSpectate(playerid)
  4244. {
  4245. if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
  4246. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
  4247. {
  4248. for(new x=PlayerInfo[playerid][SpecID]-1; x>=0; x--)
  4249. {
  4250. if(x == 0) x = MAX_PLAYERS;
  4251. if(IsPlayerConnected(x) && x != playerid)
  4252. {
  4253. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
  4254. {
  4255. continue;
  4256. }
  4257. else
  4258. {
  4259. StartSpectate(playerid, x);
  4260. break;
  4261. }
  4262. }
  4263. }
  4264. }
  4265. return 1;
  4266. }
  4267. #endif
  4268.  
  4269. ShowPlayerVehicleSpawnDialog(playerid)
  4270. {
  4271. ShowPlayerDialog(playerid, VEHICLE_DIALOG, DIALOG_STYLE_LIST, "Vehicle Spawn", ""white"Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service Vehicles\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nTrailers\nUnique Vehicles\nRC Vehicles", "Select", "Cancel" );
  4272. return 1;
  4273. }
  4274.  
  4275. CarSpawner(playerid,model)
  4276. {
  4277. new Float:x, Float:y, Float:z, Float:angle;
  4278. GetPlayerPos(playerid, x, y, z);
  4279. GetPlayerFacingAngle(playerid, angle);
  4280. new vehicleid = CreateVehicle(model, x, y, z, angle, -1, -1, -1);
  4281. PlayerInfo[playerid][Vehicle] = vehicleid;
  4282. SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
  4283. LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
  4284. SetVehicleNumberPlate(PlayerInfo[playerid][Vehicle], "NG-Stunting");
  4285. SetVehicleToRespawn(PlayerInfo[playerid][Vehicle]);
  4286. PutPlayerInVehicle(playerid, vehicleid, 0);
  4287. return 1;
  4288. }
  4289.  
  4290. //==============================================================================
  4291. //------------------------------------------------------------------------------
  4292. // Costum Publics
  4293. //------------------------------------------------------------------------------
  4294. //==============================================================================
  4295. #if USE_OPC_DELAY == true
  4296. public ExecCheckTimerForPlayer(playerid)
  4297. {
  4298. PlayerInfo[playerid][PingTimer] = SetTimerEx("CheckPlayerPing", PINGCHECK_TIME*1000, true, "d", playerid);
  4299. return 1;
  4300. }
  4301. #endif
  4302.  
  4303. public ConnectedPlayers()
  4304. {
  4305. new Connected;
  4306. for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
  4307. return Connected;
  4308. }
  4309.  
  4310. public Jail1(playerid)
  4311. {
  4312. TogglePlayerControllable(playerid,false);
  4313. new Float:x, Float:y, Float:z;
  4314. GetPlayerPos(playerid,x,y,z);
  4315. SetPlayerCameraPos(playerid,x+10,y,z+10);
  4316. SetPlayerCameraLookAt(playerid,x,y,z);
  4317. SetTimerEx("Jail2",1000,0,"d",playerid);
  4318. }
  4319.  
  4320. public Jail2(playerid)
  4321. {
  4322. new Float:x, Float:y, Float:z;
  4323. GetPlayerPos(playerid,x,y,z);
  4324. SetPlayerCameraPos(playerid,x+7,y,z+5);
  4325. SetPlayerCameraLookAt(playerid,x,y,z);
  4326. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
  4327. GameTextForPlayer(playerid,"~r~Busted By Admins",3000,3);
  4328. SetTimerEx("Jail3",1000,0,"d",playerid);
  4329. }
  4330.  
  4331. public Jail3(playerid)
  4332. {
  4333. new Float:x, Float:y, Float:z;
  4334. GetPlayerPos(playerid,x,y,z);
  4335. SetPlayerCameraPos(playerid,x+3,y,z);
  4336. SetPlayerCameraLookAt(playerid,x,y,z);
  4337. }
  4338.  
  4339. public JailPlayer(playerid)
  4340. {
  4341. TogglePlayerControllable(playerid,true);
  4342. SetPlayerPos(playerid,197.6661,173.8179,1003.0234);
  4343. SetPlayerInterior(playerid,3);
  4344. SetCameraBehindPlayer(playerid);
  4345. PlayerInfo[playerid][JailTimer] = SetTimerEx("UnjailPlayer",PlayerInfo[playerid][JailTime],0,"d",playerid);
  4346. PlayerInfo[playerid][Jailed] = true;
  4347. }
  4348.  
  4349. public UnjailPlayer(playerid)
  4350. {
  4351. KillTimer(PlayerInfo[playerid][JailTimer]);
  4352. PlayerInfo[playerid][JailTime] = 0;
  4353. PlayerInfo[playerid][Jailed] = false;
  4354. SetPlayerInterior(playerid,0);
  4355. SetPlayerPos(playerid, 0.0, 0.0, 0.0);
  4356. SpawnPlayer(playerid);
  4357. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  4358. GameTextForPlayer(playerid,"~g~Released ~n~From Jail",3000,3);
  4359. }
  4360.  
  4361. public unmute(playerid)
  4362. {
  4363. PlayerInfo[playerid][Muted] = false;
  4364. PlayerInfo[playerid][MuteTimer] = -1;
  4365. return 1;
  4366. }
  4367.  
  4368. public CheckPlayerPing(playerid)
  4369. {
  4370. #if IS_ADMIN_IMMUNE == true
  4371. if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
  4372. {
  4373. KillTimer(PlayerInfo[playerid][PingTimer]); //killing the ping timer for the admin so that it will not check again for that player
  4374. return 1; //returning 1 to close the function for the player
  4375. }
  4376. #endif
  4377.  
  4378. if(GetPlayerPing(playerid) >= MAX_PING)
  4379. {
  4380. PlayerInfo[playerid][PingExceeds]++;
  4381. if(PlayerInfo[playerid][PingExceeds] >= MAX_EXCEEDS)
  4382. {
  4383. #if SEND_MSG_BYKICK == true
  4384. new string[128];
  4385. format(string, sizeof(string), ""white"Info: "yellow"%s "white"has been kicked from the server. (Reason: High Ping: %d | Allowed %d)", GetName(playerid), GetPlayerPing(playerid), MAX_PING);
  4386. SendClientMessageToAll(RED, string);
  4387. #endif
  4388. KillTimer(PlayerInfo[playerid][PingTimer]);
  4389. #if PRINT_BYKICK == true
  4390. printf("[PING KICK]: %s has been kicked (ping: %d)", GetName(playerid), GetPlayerPing(playerid));
  4391. #endif
  4392. Kick(playerid);
  4393. }
  4394.  
  4395. #if SEND_PMSG_BYEXCEED == true
  4396. new pstring[128];
  4397. format(pstring, sizeof(pstring), ""white"Info: Your ping exceeded the limit of %d |Your ping: %d|", MAX_PING, GetPlayerPing(playerid));
  4398. SendClientMessage(playerid, RED, pstring);
  4399. #endif
  4400.  
  4401. #if SEND_ADM_BYEXCEED == true
  4402. new string[128];
  4403. format(string, sizeof(string), ""white"*** {FFE600}%s {FAFAFA}exceeded max ping limit of %d |Ping: %d|", GetName(playerid), MAX_PING, GetPlayerPing(playerid));
  4404. for(new i=0; i <= MAX_PLAYERS; i++)
  4405. {
  4406. if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
  4407. if(PlayerInfo[i][AdminLevel] >= 1)
  4408. {
  4409. SendClientMessage(i, RED, string);
  4410. }
  4411. }
  4412. #endif
  4413. }
  4414. return 1;
  4415. }
  4416.  
  4417. public VIPMSG(color,const string[])
  4418. {
  4419. for(new i = 0; i < MAX_PLAYERS; i++)
  4420. {
  4421. if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
  4422. if((PlayerInfo[i][VIPLevel] >= 1)) SendClientMessage(i, color, string);
  4423. }
  4424. return 1;
  4425. }
  4426.  
  4427. public AdminMSG(color,const string[])
  4428. {
  4429. for(new i = 0; i < MAX_PLAYERS; i++)
  4430. {
  4431. if((IsPlayerNPC(i)) || (!IsPlayerConnected(i))) continue;
  4432. if((PlayerInfo[i][AdminLevel] >= 1)) SendClientMessage(i, color, string);
  4433. }
  4434. return 1;
  4435. }
  4436.  
  4437. #if USE_RANDOM_MSGS == true
  4438. public RandomClientMessage()
  4439. {
  4440. new randommsg = random(sizeof(RandomMessages));
  4441. SendClientMessageToAll(BLUE, RandomMessages[randommsg]);
  4442. return 1;
  4443. }
  4444. #endif
Advertisement
Add Comment
Please, Sign In to add comment