Advertisement
carlosxtreme

Untitled

Nov 28th, 2020
1,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 175.76 KB | None | 0 0
  1. #include <a_samp>
  2. #include <core>
  3. #include <float>
  4. native WP_Hash(buffer[], len, const str[]);
  5. #include <zcmd>
  6. #include <sscanf2>
  7. #include <YSI\y_iterate> // foreach
  8.  
  9. #pragma dynamic 2934092
  10. #pragma tabsize 0
  11. //============================================================================//
  12.  
  13. //Variables, Defnes and other stuffs starts here.
  14.  
  15. stock st[90];
  16.  
  17. //Public Macro
  18. #define function:%0(%1)\
  19. forward %0(%1);\
  20. public %0(%1)
  21.  
  22. //Level Check Macro
  23. #define LevelCheck(%0,%1); \
  24. if(User[(%0)][accountAdmin] < %1 && !IsPlayerAdmin((%0)))\
  25. return format(st, 90, "[Error] You must be level %d to use this command.", (%1)),\
  26. SendClientMessage((%0), -1, st);
  27.  
  28. //Login Check Macro
  29. #define LoginCheck(%1) if(User[%1][accountLogged] == 0) return SendClientMessage(%1, COLOR_RED, "[Error] You must be logged in to use this command.")
  30.  
  31. //Do not change the file type to .ini, We uses SQLite.
  32. #define _DB_ "JakAdmin3/juser.db"
  33. //The location and folder has been changed on 3.3.
  34.  
  35. #define _LOG_ "JakAdmin3/Logs/"
  36. //The location and folder for the log has been also changed on 3.3.
  37.  
  38. new _God[MAX_PLAYERS];
  39. new reportmsg[4][136];
  40.  
  41. new SpecInt[MAX_PLAYERS][2];
  42. new Float:SpecPos[MAX_PLAYERS][4];
  43.  
  44. new VehicleNames[212][] = {
  45. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
  46. {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  47. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
  48. {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  49. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
  50. {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  51. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
  52. {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  53. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  54. {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  55. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
  56. {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  57. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
  58. {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  59. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
  60. {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  61. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
  62. {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  63. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
  64. {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  65. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
  66. {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  67. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
  68. {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  69. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
  70. {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  71. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
  72. {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
  73. {"Utility Trailer"}
  74. };
  75.  
  76. //Configuration
  77. #define VERSION "3.4"
  78.  
  79. #define ADMIN_SPEC_TYPE_NONE 0
  80. #define ADMIN_SPEC_TYPE_PLAYER 1
  81. #define ADMIN_SPEC_TYPE_VEHICLE 2
  82.  
  83. #define STARTING_SCORE 1
  84. //Starting score for registered player.
  85. #define STARTING_CASH 10000
  86. //Starting cash for registered player.
  87. #define MAX_RCON_WARNINGS 3
  88. //Max warnings for attempting to logged in RCON.
  89. //Change the starting score and starting cash.
  90. #define LOG true
  91. //Change to false if you want to disable making logs on the server (Such as saving kicks etc, ban messages).
  92. #define AUTO_LOGIN true
  93. //Change to false if you want to disable the auto-login system.
  94. #define REGISTER_DIALOG true
  95. //Change to false if you want to disable the register/login dialog.
  96. #define READ_COMMANDS true
  97. //Change to false if you want to disable reading all player commands.
  98. #define MAX_PING false
  99. //Change to false if you want to disable this system.
  100. #define ANTI_SWEAR true
  101. //Change to false if you want to disable the AntiSwear.
  102. #define ANTI_NAME true
  103. //Change to false if you want to disable the AntiName.
  104. #define ANTI_SPAWN true
  105. //Change to false if you want to disable.
  106. //Anti Spawn disables player from spawning if they aren't registered or logged in.
  107. #define ANTI_AD true
  108. //Change to false if you want to disable the anti ad.
  109. #define RconProtect true
  110. //Change to false if you want to disable the 2nd Rcon.
  111. #define AntiSpam true
  112. //Change to false if you want to disable the AntiSpam.
  113. #define VipSystem false
  114. //Change to false if you want to disable the VipSystem
  115.  
  116. new vipsys;
  117.  
  118. #if VipSystem == true
  119. #define VipCheck(%0,%1); \
  120. if(accountVip[(%0)] < %1)\
  121. return format(st, 90, "[Error] You must be VIP level %d to use this command.", (%1)),\
  122. SendClientMessage((%0), -1, st);
  123. #endif
  124.  
  125. enum PlayerInfo
  126. {
  127. accountID,
  128. accountName[24],
  129. accountIP[20],
  130. accountQuestion[129],
  131. accountAnswer[129],
  132. accountPassword[129],
  133. accountAdmin,
  134. accountKills,
  135. accountDeaths,
  136. accountScore,
  137. accountCash,
  138. accountLogged,
  139. WarnLog,
  140. accountDate[150],
  141. accountWarn,
  142. accountMuted,
  143. accountMuteSec,
  144. accountCMuted,
  145. accountCMuteSec,
  146. accountJail,
  147. accountJailSec,
  148. SpecID,
  149. SpecType,
  150. pCar,
  151. accountGame[3],
  152. pDuty,
  153. #if AntiSpam == true
  154. SpamCount,
  155. SpamTime
  156. #endif
  157. };
  158.  
  159. new User[MAX_PLAYERS][PlayerInfo],
  160. DB:Database,
  161. static_Warn[MAX_PLAYERS]
  162. ;
  163.  
  164. #if VipSystem == true
  165. new accountVip[MAX_PLAYERS];
  166. #endif
  167.  
  168. #if AntiSpam == true
  169. #define SPAM_MAX_MSGS 5 // Max Spam Messages
  170. #define SPAM_TIMELIMIT 8 // In seconds
  171. #endif
  172.  
  173. #if RconProtect == true
  174. #include <OPRL>
  175. //Includes the OPRL by Lordzy if 2nd_Rcon is set to true.
  176. #define RconPass "changeme"
  177. //Password for the 2nd Rcon, changeme to anything you want.
  178. new bool:_RCON[MAX_PLAYERS];
  179. new _RCONwarn[MAX_PLAYERS];
  180. #endif
  181.  
  182. #if ANTI_NAME == true
  183. new ForbidNames[][] =
  184. {
  185. {"Admin"},
  186. {"AssLicker"},
  187. {"Vip"},
  188. {"Hacker"},
  189. {"Justin_Bieber"}
  190. //Names here, Remember, the last stanza don't have ","
  191. };
  192. #endif
  193.  
  194. #if ANTI_SWEAR == true
  195. new Swears[][] =
  196. {
  197. {"dick"},
  198. {"pussy"},
  199. {"dildo"},
  200. {"adventure time gay"}
  201. //Bad Words here, Remember, the last stanza don't have ","
  202. };
  203. #endif
  204.  
  205. #if MAX_PING == true
  206. #define PING_EXCEED 1000
  207. //Maximum ping if the MAX_PING is set to true, if player exceeds it, He or SHE gets kicked.
  208. #define MAX_PING_WARN 3
  209. //Max ping warning from Ping Kick, once exceed, player gets kicked.
  210. #endif
  211.  
  212. //Dialog Begin is null, You can use it as a message displayer since it is not used.
  213. #define DIALOG_BEGIN 905
  214. //Change the dialog id of the DIALOG_BEGIN if it conflicts.
  215. #define DIALOG_REGISTER DIALOG_BEGIN+1
  216. #define DIALOG_LOGIN DIALOG_BEGIN+2
  217. #define DIALOG_COLORS DIALOG_BEGIN+3
  218. #define DIALOG_RCON DIALOG_BEGIN+4
  219. #define DIALOG_QUESTION DIALOG_BEGIN+5
  220. #define DIALOG_ANSWER DIALOG_BEGIN+6
  221. #define DIALOG_FORGET DIALOG_BEGIN+7
  222.  
  223. //Colors
  224.  
  225. #define white "{FFFFFF}"
  226. #define lightblue "{33CCFF}"
  227. #define grey "{AFAFAF}"
  228. #define orange "{FF8000}"
  229. #define black "{2C2727}"
  230. #define red "{FF0000}"
  231. #define yellow "{FFFF00}"
  232. #define green "{33CC33}"
  233. #define blue "{0080FF}"
  234. #define purple "{D526D9}"
  235. #define pink "{FF80FF}"
  236. #define brown "{A52A2A}"
  237.  
  238. #define COLOR_RED 0xFF0000C8
  239. #define COLOR_YELLOW 0xFFFF00AA
  240. #define COLOR_GREEN 0x33CC33C8
  241. #define COLOR_ORANGE 0xFF8000C8
  242. #define COLOR_WHITE 0xFFFFFFFF
  243. #define COLOR_PURPLE 0xD526D9FF
  244. #define COLOR_LIGHTGREEN 0x00FF00FF
  245. #define COLOR_PINK 0xFF80FFFF
  246. #define COLOR_LIGHTBLUE 0x33CCFFAA
  247. #define COLOR_GREY 0xAFAFAFAA
  248. #define COLOR_BLUE 0x0080FFC8
  249. #define COLOR_BROWN 0xA52A2AAA
  250. #define COLOR_BLACK 0x2C2727AA
  251.  
  252. main()
  253. {
  254. print("\n----------------------------------");
  255. print(" Bare Script\n");
  256. print("----------------------------------\n");
  257. }
  258.  
  259.  
  260. public OnPlayerCommandText(playerid, cmdtext[])
  261. {
  262. new idx;
  263. new cmd[256];
  264.  
  265. cmd = strtok(cmdtext, idx);
  266.  
  267. if(strcmp(cmd, "/yadayada", true) == 0) {
  268. return 1;
  269. }
  270.  
  271. return 0;
  272. }
  273.  
  274.  
  275. SetupPlayerForClassSelection(playerid)
  276. {
  277. SetPlayerInterior(playerid,14);
  278. SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  279. SetPlayerFacingAngle(playerid, 270.0);
  280. SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  281. SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  282. }
  283.  
  284. public OnPlayerRequestClass(playerid, classid)
  285. {
  286. SetupPlayerForClassSelection(playerid);
  287. return 1;
  288. }
  289.  
  290. public OnGameModeInit()
  291. {
  292.  
  293. new
  294. day,
  295. month,
  296. year,
  297. hour,
  298. sec,
  299. mins,
  300. result = GetTickCount()
  301. ;
  302.  
  303. getdate(year, month, day);
  304. gettime(hour, mins, sec);
  305.  
  306. /*
  307. Checks the JakAdmin3 and logs folder if exist, otherwise sends a print message.
  308. */
  309.  
  310. checkfolder();
  311.  
  312. /*
  313. Just so you know, even if the folders of JakAdmin3 is missing, nothing will happen except
  314. accounts won't save. We have also blocked the SaveLog function from overwriting files
  315. when the Logs folder is missing.
  316. */
  317.  
  318. if(checkfolderEx() == 1)
  319. {
  320. /*
  321. If CheckFolderEX returns 1 instead of 0 (Doesn't exist), proceed the daily route.
  322. */
  323. printf("\nJakAdmin %s (c), Copyright - 2016", VERSION);
  324. print("SA-MP 0.3.7 Stability Updates + few fixes on the script\n");
  325.  
  326. //Load the .DB file.
  327. loadb();
  328. printf("[JakAdmin3] Duration: %i ms", (GetTickCount() - result));
  329. printf("[JakAdmin3] Date: %02i/%02i/%02i | Time: %02d:%02d:%02d", day, month, year, hour, mins, sec);
  330. Config();
  331. print("\n");
  332.  
  333. //Syncing Timers
  334. SetTimer("SyncStats", 1000, true);
  335. //Ping Timer (if set to true)
  336. #if MAX_PING == true
  337. SetTimer("PingCheck", 1000, true);
  338. #endif
  339. //Punishment Timer Handler
  340. SetTimer("PunishmentHandle", 1000, true);
  341. //GamePlay
  342. SetTimer("GamePlay", 1000, true);
  343.  
  344. for(new i=0; i<4; i++)
  345. {
  346. format(reportmsg[i], 136, "None");
  347. }
  348.  
  349. foreach(new i : Player)
  350. {
  351. OnPlayerConnect(i);
  352. }
  353. }
  354. return 1;
  355. }
  356. public OnGameModeExit()
  357. {
  358. //Closing the .DB file.
  359. closedb();
  360.  
  361. foreach(new i : Player)
  362. {
  363. if(User[i][pCar] != -1)
  364. {
  365. DestroyVehicle(User[i][pCar]);
  366. }
  367. OnPlayerDisconnect(i, 1);
  368. User[i][accountLogged] = 0;
  369. }
  370. return 1;
  371. }
  372. function:PunishmentHandle()
  373. {
  374. new string[128+50];
  375.  
  376. foreach(new i : Player)
  377. {
  378. if(User[i][accountJail] == 1)
  379. {
  380. if(User[i][accountJailSec] >= 1)
  381. {
  382. User[i][accountJailSec] --;
  383. }
  384. else if(User[i][accountJailSec] == 0)
  385. {
  386. User[i][accountJail] = 0;
  387. format(string, sizeof(string), "** %s(ID:%d) has been unjailed from Admin's Jail.", pName(i), i);
  388. SendClientMessageToAll(COLOR_GREY, string);
  389. SpawnPlayer(i);
  390. }
  391. }
  392. if(User[i][accountMuted] == 1)
  393. {
  394. if(User[i][accountMuteSec] >= 1)
  395. {
  396. User[i][accountMuteSec] --;
  397. }
  398. else if(User[i][accountMuteSec] == 0)
  399. {
  400. User[i][accountMuted] = 0;
  401. format(string, sizeof(string), "** %s(ID:%d) has been unmuted from Admin's Mute.", pName(i), i);
  402. SendClientMessageToAll(COLOR_GREY, string);
  403. }
  404. }
  405. if(User[i][accountCMuted] == 1)
  406. {
  407. if(User[i][accountCMuteSec] >= 1)
  408. {
  409. User[i][accountCMuteSec] --;
  410. }
  411. else if(User[i][accountCMuteSec] == 0)
  412. {
  413. User[i][accountCMuted] = 0;
  414. format(string, sizeof(string), "** %s(ID:%d) has been unmuted from Admin's Command Mute.", pName(i), i);
  415. SendClientMessageToAll(COLOR_GREY, string);
  416. }
  417. }
  418. }
  419. return 1;
  420. }
  421.  
  422. #if MAX_PING == true
  423. function:PingCheck()
  424. {
  425. new
  426. string[130]
  427. ;
  428. foreach(new i : Player)
  429. {
  430. if(GetPlayerPing(i) > PING_EXCEED)
  431. {
  432. if(static_Warn[i] == MAX_PING_WARN)
  433. {
  434. format(string, sizeof(string), "** %s(ID:%d) has been automatically kicked by the reason [Reason: Exceeding Maximum Ping Limit] (Ping: %d | Maximum Ping: %d)", pName(i), i, GetPlayerPing(i), PING_EXCEED);
  435. SendClientMessageToAll(COLOR_GREY, string);
  436. KickDelay(i);
  437. return 1;
  438. }
  439. static_Warn[i] ++;
  440. format(string, sizeof(string), "** %s(ID:%d) has received a Ping Kick Warning (Ping: %d | Maximum Ping: %d) (Warnings: %d/%d)", pName(i), i, GetPlayerPing(i), PING_EXCEED, static_Warn[i], MAX_PING_WARN);
  441. SendClientMessageToAll(COLOR_YELLOW, string);
  442. }
  443. }
  444. return 1;
  445. }
  446. #endif
  447.  
  448. function:SyncStats()
  449. {
  450. foreach(new i : Player)
  451. {
  452. if(User[i][accountLogged] == 1)
  453. {
  454. User[i][accountCash] = GetPlayerMoney(i);
  455. User[i][accountScore] = GetPlayerScore(i);
  456. }
  457.  
  458. //Will be using for god too. (Improving it on the next version)
  459. if(_God[i] == 1)
  460. {
  461. SetPlayerHealth(i, 100000);
  462. }
  463. }
  464. return 1;
  465. }
  466.  
  467. function:GamePlay()
  468. {
  469. foreach(new playerid : Player)
  470. {
  471. if(User[playerid][accountLogged] == 1)
  472. {
  473. User[playerid][accountGame][0] += 1;
  474. if(User[playerid][accountGame][0] == 60)
  475. {
  476. User[playerid][accountGame][0] = 0;
  477. User[playerid][accountGame][1] += 1;
  478. if(User[playerid][accountGame][1] >= 59 && User[playerid][accountGame][0] == 0)
  479. {
  480. User[playerid][accountGame][1] = 0;
  481. User[playerid][accountGame][2] += 1;
  482. }
  483. }
  484. }
  485. }
  486. return 1;
  487. }
  488.  
  489. public OnPlayerConnect(playerid)
  490. {
  491. #if ANTI_NAME == true
  492. new string[128+40];
  493. for(new x = 0; x < sizeof(ForbidNames); x++)
  494. {
  495. if(!strcmp(pName(playerid), ForbidNames[x], true))
  496. {
  497. format(string, sizeof string, "** Player %s(ID:%d) has been kicked by the Server (Forbidden Name)", pName(playerid), playerid);
  498. SendClientMessageToAll(COLOR_GREY, string);
  499. printf(string);
  500. #if LOG == true
  501. SaveLog("kicklog.txt", string);
  502. #endif
  503. KickDelay(playerid);
  504. return 1;
  505. }
  506. }
  507. #endif
  508.  
  509. for(new x; x < _: PlayerInfo; ++x ) User[playerid][PlayerInfo: x] = 0;
  510. User[playerid][SpecID] = INVALID_PLAYER_ID;
  511.  
  512. #if RconProtect == true
  513. _RCON[playerid] = false;
  514. _RCONwarn[playerid] = 0;
  515. #endif
  516.  
  517. User[playerid][pDuty] = 0;
  518. User[playerid][pCar] = -1;
  519. #if AntiSpam == true
  520. User[playerid][SpamCount] = 0;
  521. User[playerid][SpamTime] = 0;
  522. #endif
  523.  
  524. #if VipSystem == true
  525. accountVip[playerid] = 0;
  526. #endif
  527.  
  528. _God[playerid] = 0;
  529.  
  530. GetPlayerName(playerid, User[playerid][accountName], MAX_PLAYER_NAME);
  531. GetPlayerIp(playerid, User[playerid][accountIP], 20);
  532.  
  533. static_Warn[playerid] = 0;
  534.  
  535. new
  536. bQuery[128+90],
  537. reason[128],
  538. admin[128],
  539. when[128],
  540. DBResult:jResult
  541. ;
  542. format(bQuery, 600, "SELECT * FROM `bans` WHERE `username` = '%s'", pName(playerid));
  543. jResult = db_query(Database, bQuery);
  544.  
  545. if(db_num_rows(jResult))
  546. {
  547. db_get_field_assoc(jResult, "banby", admin, 128);
  548. db_get_field_assoc(jResult, "banreason", reason, 128);
  549. db_get_field_assoc(jResult, "banwhen", when, 128);
  550.  
  551. ShowBan(playerid, admin, reason, when);
  552.  
  553. KickDelay(playerid);
  554. return 1;
  555. }
  556. db_free_result(jResult);
  557.  
  558. new
  559. Query[128+71],
  560. DBResult: Result
  561. ;
  562.  
  563. #if AUTO_LOGIN == true
  564. new fIP[20];
  565. #endif
  566.  
  567. #if AUTO_LOGIN == true
  568. format(Query, sizeof(Query), "SELECT `password`, `question`, `answer`, `IP` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
  569. Result = db_query(Database, Query);
  570. #else
  571. format(Query, sizeof(Query), "SELECT `password`, `question`, `answer` FROM `users` WHERE `username` = '%s'", DB_Escape(User[playerid][accountName]));
  572. Result = db_query(Database, Query);
  573. #endif
  574. if(db_num_rows(Result))
  575. {
  576. db_get_field_assoc(Result, "password", User[playerid][accountPassword], 129);
  577. db_get_field_assoc(Result, "question", User[playerid][accountQuestion], 129);
  578. db_get_field_assoc(Result, "answer", User[playerid][accountAnswer], 129);
  579. #if AUTO_LOGIN == true
  580. db_get_field_assoc(Result, "IP", fIP, 20);
  581. if(strcmp(fIP, User[playerid][accountIP], true) == 0)
  582. {
  583. SendClientMessage(playerid, -1, "You have been auto logged in.");
  584. LoginPlayer(playerid);
  585. }
  586. else
  587. {
  588. #if REGISTER_DIALOG == true
  589. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.", "Login", "Forget");
  590. #else
  591. SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
  592. #endif
  593. }
  594. #else
  595. #if REGISTER_DIALOG == true
  596. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Login", ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.", "Login", "Forget");
  597. #else
  598. SendClientMessage(playerid, COLOR_ORANGE, "LOGIN: /login [password] to login to your account.");
  599. #endif
  600. #endif
  601. }
  602. else
  603. {
  604. #if REGISTER_DIALOG == true
  605. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.", "Register", "Quit");
  606. #else
  607. SendClientMessage(playerid, COLOR_ORANGE, "REGISTER: /register [password] to register your account.");
  608. #endif
  609. }
  610. db_free_result(Result);
  611. return 1;
  612. }
  613.  
  614. public OnPlayerDisconnect(playerid, reason)
  615. {
  616. for(new x=0; x<MAX_PLAYERS; x++)
  617. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
  618. AdvanceSpectate(x);
  619.  
  620. if(User[playerid][pCar] != -1) EraseVeh(User[playerid][pCar]);
  621.  
  622. if(User[playerid][accountLogged] == 1)
  623. {
  624. //Saves the statistics to the .db.
  625. SaveData(playerid);
  626. }
  627. return 1;
  628. }
  629.  
  630. public OnPlayerSpawn(playerid)
  631. {
  632. if(User[playerid][accountJail] == 1)
  633. {
  634. SetTimerEx("JailPlayer", 3000, 0, "d", playerid);
  635. SendClientMessage(playerid, COLOR_RED, "PUNISHMENT: You cannot escape your punishment. You are still jailed, Hah!");
  636.  
  637. return 1;
  638. }
  639. return 1;
  640. }
  641.  
  642. function:JailPlayer(playerid)
  643. {
  644. new string[128];
  645.  
  646. SetPlayerPos(playerid, 197.6661, 173.8179, 1003.0234);
  647. SetPlayerInterior(playerid, 3);
  648. SetCameraBehindPlayer(playerid);
  649.  
  650. format(string, 200, "You have been placed in the jail for %d seconds.", User[playerid][accountJailSec]);
  651. SendClientMessage(playerid, COLOR_RED, string);
  652. return 1;
  653. }
  654.  
  655. public OnPlayerDeath(playerid, killerid, reason)
  656. {
  657. for(new x=0; x<MAX_PLAYERS; x++)
  658. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
  659. AdvanceSpectate(x);
  660.  
  661. User[playerid][accountDeaths] ++;
  662. if(killerid != INVALID_PLAYER_ID)
  663. {
  664. User[killerid][accountKills] ++;
  665. }
  666. return 1;
  667. }
  668.  
  669. public OnVehicleSpawn(vehicleid)
  670. {
  671. foreach(new i : Player)
  672. {
  673. if(vehicleid == User[i][pCar])
  674. {
  675. EraseVeh(vehicleid);
  676. User[i][pCar] = -1;
  677. }
  678. }
  679. return 1;
  680. }
  681.  
  682. public OnVehicleDeath(vehicleid, killerid)
  683. {
  684. return 1;
  685. }
  686.  
  687. public OnPlayerText(playerid, text[])
  688. {
  689. new string[128+50];
  690.  
  691. #if ANTI_AD == true
  692. if(strfind(text, ":", true) != -1)
  693. {
  694. new
  695. i_numcount,
  696. i_period,
  697. i_pos;
  698.  
  699. while(text[i_pos]) {
  700. if('0' <= text[i_pos] <= '9') i_numcount++;
  701. else if(text[i_pos] == '.') i_period++;
  702. i_pos++;
  703. }
  704. if(i_numcount >= 8 && i_period >= 3)
  705. {
  706. format(string, sizeof(string), "ALERT: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, text);
  707. foreach(new i : Player)
  708. {
  709. if(User[i][accountLogged] == 1)
  710. {
  711. if(User[i][accountAdmin] >= 1)
  712. {
  713. SendClientMessage(i, COLOR_RED, string);
  714. }
  715. }
  716. }
  717. SendClientMessage(playerid, -1, "Your chat has been sent.");
  718. return 0;
  719. }
  720. }
  721. #endif
  722.  
  723. if(User[playerid][accountMuted] == 1)
  724. {
  725. format(string, sizeof(string), "You are still muted, You can talk after %d seconds.", User[playerid][accountMuteSec]);
  726. SendClientMessage(playerid, COLOR_ORANGE, string);
  727. return 0;
  728. }
  729.  
  730. #if AntiSpam == true
  731. if((User[playerid][accountAdmin] == 0 && !IsPlayerAdmin(playerid)))
  732. {
  733. if(User[playerid][SpamCount] == 0) User[playerid][SpamTime] = TimeStamp();
  734.  
  735. User[playerid][SpamCount]++;
  736. if(TimeStamp() - User[playerid][SpamTime] > SPAM_TIMELIMIT)
  737. {
  738. User[playerid][SpamCount] = 0;
  739. User[playerid][SpamTime] = TimeStamp();
  740. }
  741. else if(User[playerid][SpamCount] == SPAM_MAX_MSGS)
  742. {
  743. format(string, sizeof(string), "** Player %s (ID:%d) has been automatically kicked by Server (Flood/Spam Protection)", pName(playerid), playerid);
  744. SendClientMessageToAll(COLOR_GREY, string);
  745. print(string);
  746. #if LOG == true
  747. SaveLog("kicklog.txt", string);
  748. #endif
  749. KickDelay(playerid);
  750. }
  751. else if(User[playerid][SpamCount] == SPAM_MAX_MSGS-1)
  752. {
  753. SendClientMessage(playerid, COLOR_RED, "WARNING: Anti Spam Warning! Next is a Kick!");
  754. return 0;
  755. }
  756. }
  757. #endif
  758.  
  759. #if ANTI_SWEAR == true
  760. for(new i = 0; i < sizeof(Swears); i++)
  761. {
  762. Cenzura(text, Swears[i]);
  763. }
  764. #endif
  765. return 1;
  766. }
  767.  
  768. //============================================================================//
  769. // ZCMD //
  770.  
  771. public OnPlayerCommandReceived(playerid, cmdtext[])
  772. {
  773. new string[128+50];
  774.  
  775. #if ANTI_AD == true
  776. if(strfind(cmdtext, ":", true) != -1)
  777. {
  778.  
  779. new
  780. i_numcount,
  781. i_period,
  782. i_pos;
  783.  
  784. while(cmdtext[i_pos]) {
  785. if('0' <= cmdtext[i_pos] <= '9') i_numcount++;
  786. else if(cmdtext[i_pos] == '.') i_period++;
  787. i_pos++;
  788. }
  789. if(i_numcount >= 8 && i_period >= 3)
  790. {
  791. format(string, sizeof(string), "ALERT: Player %s(ID: %d) may be server advertising: '%s'.", pName(playerid), playerid, cmdtext);
  792. foreach(new i : Player)
  793. {
  794. if(User[i][accountLogged] == 1)
  795. {
  796. if(User[i][accountAdmin] >= 1)
  797. {
  798. SendClientMessage(i, COLOR_RED, string);
  799. }
  800. }
  801. }
  802. SendClientMessage(playerid, -1, "Your command has been successfully sent.");
  803. return 0;
  804. }
  805. }
  806. #endif
  807.  
  808. if(User[playerid][accountCMuted] == 1)
  809. {
  810. format(string, sizeof(string), "You are still muted, You can use all the commands after %d seconds.", User[playerid][accountCMuteSec]);
  811. SendClientMessage(playerid, COLOR_ORANGE, string);
  812. return 0;
  813. }
  814.  
  815. #if READ_COMMANDS == true
  816. format(string, sizeof(string), "*** %s(ID:%d) : '%s'", pName(playerid), playerid, cmdtext);
  817. foreach(new i : Player)
  818. {
  819. if(User[i][accountAdmin] >= 1 && User[i][accountAdmin] > User[playerid][accountAdmin] && i != playerid)
  820. {
  821. SendClientMessage(i, COLOR_GREY, string);
  822. }
  823. }
  824. #endif
  825. return 1;
  826. }
  827.  
  828. #if VipSystem == true
  829.  
  830. //============================================================================//
  831. // VIP Level 1-3 //
  832. //============================================================================//
  833.  
  834. CMD:vcmds(playerid, params[])
  835. {
  836. new string[1246+200];
  837.  
  838. LoginCheck(playerid);
  839. VipCheck(playerid, 1);
  840.  
  841. if(accountVip[playerid] >= 1)
  842. {
  843. strcat(string, ""orange"• VIP Level 1\n");
  844. strcat(string, ""white"");
  845. strcat(string, "* /v /vgoto /vsay\n\n");
  846. strcat(string, ""orange"• VIP Level 2\n");
  847. strcat(string, ""white"");
  848. strcat(string, "* /vbike /vcar\n\n");
  849. strcat(string, ""orange"• VIP Level 3\n");
  850. strcat(string, ""white"");
  851. strcat(string, "* /vweaps /vgod\n\n");
  852. }
  853.  
  854. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""grey"VIP Commands", string, "Close", "");
  855. return 1;
  856. }
  857.  
  858. CMD:v(playerid, params[])
  859. {
  860. new
  861. string[140]
  862. ;
  863.  
  864. LoginCheck(playerid);
  865. VipCheck(playerid, 1);
  866.  
  867. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "[Error] /v [vip chat]");
  868.  
  869. format(string, sizeof( string ), "<!> VIP Chat %s: %s", pName(playerid), params);
  870.  
  871. #if LOG == true
  872. SaveLog("vipchat.txt", string);
  873. #endif
  874.  
  875. foreach(new i : Player)
  876. {
  877. if(User[i][accountLogged] == 1)
  878. {
  879. if(accountVip[i] >= 1)
  880. {
  881. SendClientMessage(i, COLOR_ORANGE, string);
  882. }
  883. }
  884. }
  885. return 1;
  886. }
  887.  
  888. //============================================================================//
  889. // VIP Level 1 //
  890. //============================================================================//
  891.  
  892. CMD:vgoto(playerid, params[])
  893. {
  894. LoginCheck(playerid);
  895. VipCheck(playerid, 1);
  896.  
  897. new id, string[128], Float:x, Float:y, Float:z;
  898.  
  899. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "[Error] /goto [playerid]");
  900. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not connected.");
  901. GetPlayerPos(id, x, y, z);
  902. SetPlayerInterior(playerid, GetPlayerInterior(id));
  903. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
  904. if(GetPlayerState(playerid) == 2)
  905. {
  906. SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
  907. LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
  908. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
  909. }
  910. else SetPlayerPos(playerid, x+2, y, z);
  911. format(string, sizeof(string), "You have been teleported to %s.", pName(id));
  912. SendClientMessage(playerid, COLOR_ORANGE, string);
  913. format(string, sizeof(string), "VIP %s has teleported to you.", pName(playerid));
  914. SendClientMessage(playerid, COLOR_ORANGE, string);
  915. return 1;
  916. }
  917.  
  918. CMD:vsay(playerid, params[])
  919. {
  920. LoginCheck(playerid);
  921. VipCheck(playerid, 1);
  922.  
  923. new
  924. string[128]
  925. ;
  926.  
  927. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /vsay [message as vsay]");
  928.  
  929. format(string, sizeof(string), "** VIP %s: %s", pName(playerid), params);
  930. SendClientMessageToAll(COLOR_ORANGE, string);
  931. return 1;
  932. }
  933.  
  934. //============================================================================//
  935. // VIP Level 2 //
  936. //============================================================================//
  937.  
  938. CMD:vbike(playerid, params[])
  939. {
  940. LoginCheck(playerid);
  941. VipCheck(playerid, 2);
  942.  
  943. if(User[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
  944. EraseVeh(User[playerid][pCar]);
  945. new VehicleID;
  946. new Float:X, Float:Y, Float:Z;
  947. new Float:Angle, int1;
  948. GetPlayerPos(playerid, X, Y, Z);
  949. GetPlayerFacingAngle(playerid, Angle);
  950. int1 = GetPlayerInterior(playerid);
  951. VehicleID = CreateVehicle(522, X+3,Y,Z, Angle, random(255), random(255), -1);
  952. LinkVehicleToInterior(VehicleID, int1);
  953. SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
  954. User[playerid][pCar] = VehicleID;
  955. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have spawned an NRG.");
  956. return 1;
  957. }
  958.  
  959. CMD:vcar(playerid, params[])
  960. {
  961. LoginCheck(playerid);
  962. VipCheck(playerid, 2);
  963.  
  964. if(User[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
  965. EraseVeh(User[playerid][pCar]);
  966. new VehicleID;
  967. new Float:X, Float:Y, Float:Z;
  968. new Float:Angle, int1;
  969. GetPlayerPos(playerid, X, Y, Z);
  970. GetPlayerFacingAngle(playerid, Angle);
  971. int1 = GetPlayerInterior(playerid);
  972. VehicleID = CreateVehicle(411, X+3,Y,Z, Angle, random(255), random(255), -1);
  973. LinkVehicleToInterior(VehicleID, int1);
  974. SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
  975. User[playerid][pCar] = VehicleID;
  976. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have spawned an Infernus.");
  977. return 1;
  978. }
  979.  
  980. //============================================================================//
  981. // VIP Level 3 //
  982. //============================================================================//
  983.  
  984. CMD:vgod(playerid, params[])
  985. {
  986. LoginCheck(playerid);
  987. VipCheck(playerid, 3);
  988.  
  989. if(_God[playerid] == 0)
  990. {
  991. //Removal of the weapons has been made.
  992. SendClientMessage(playerid, COLOR_GREEN, "God Mode On!");
  993. _God[playerid] = 1;
  994. }
  995. else if(_God[playerid] == 1)
  996. {
  997. _God[playerid] = 0;
  998. SendClientMessage(playerid, COLOR_RED, "God Mode Off!");
  999. SetPlayerHealth(playerid, 100.0);
  1000. }
  1001. return 1;
  1002. }
  1003.  
  1004. CMD:vweaps(playerid, params[])
  1005. {
  1006. LoginCheck(playerid);
  1007. VipCheck(playerid, 3);
  1008. GivePlayerWeapon(playerid, 30, 999999);
  1009. GivePlayerWeapon(playerid, 26, 999999);
  1010. GivePlayerWeapon(playerid, 8, 999999);
  1011.  
  1012. SendClientMessage(playerid, -1, "You have received the {FF8000}VIP weapons{FFFFFF}.");
  1013. return 1;
  1014. }
  1015.  
  1016. #endif
  1017.  
  1018. //============================================================================//
  1019. // Administrative Level 1-5 //
  1020. //============================================================================//
  1021.  
  1022. CMD:jacmds(playerid, params[])
  1023. {
  1024. new string[1246+200];
  1025.  
  1026. LoginCheck(playerid);
  1027. LevelCheck(playerid, 1);
  1028.  
  1029. if(User[playerid][accountAdmin] >= 1)
  1030. {
  1031. strcat(string, ""lightblue"• Admin Level 1\n");
  1032. strcat(string, ""white"");
  1033. strcat(string, "* /announce /kick /asay /a(Admin Chat) /settime /setweather /goto /ip /spawn /gotoco /flip /warn\n");
  1034. strcat(string, "* /remwarn /addnos /repair /reports /aduty /weaps\n\n");
  1035. }
  1036. if(User[playerid][accountAdmin] >= 2)
  1037. {
  1038. strcat(string, ""lightblue"• Admin Level 2\n");
  1039. strcat(string, ""white"");
  1040. strcat(string, "* /disarm /explode /setinterior /setworld /heal /armour /clearchat /setskin /mute /unmute /(un)jail\n");
  1041. strcat(string, "* /akill /spec(off) /car /carcolor /eject /setvhealth /givecar /muted /jailed (/un)jail /show\n");
  1042. strcat(string, "* /aweapons /jetpack /carpjob\n\n");
  1043. }
  1044. if(User[playerid][accountAdmin] >= 3)
  1045. {
  1046. strcat(string, ""lightblue"• Admin Level 3\n");
  1047. strcat(string, ""white"");
  1048. strcat(string, "* /setmoney /setscore /setcolor /slap /cname /(un)ban /giveweapon (/un)freeze /getall /bankrupt\n");
  1049. strcat(string, "* /armourall /god /teleplayer /destroycar /sethealth /setfstyle /healall /armourall /force\n");
  1050. strcat(string, "* /write /get /oban\n\n");
  1051. }
  1052. if(User[playerid][accountAdmin] >= 4)
  1053. {
  1054. strcat(string, ""lightblue"• Admin Level 4\n");
  1055. strcat(string, ""white"");
  1056. strcat(string, "* /saveallstats /cleardwindow /respawncars /setallweather /setalltime /giveallweapon\n");
  1057. strcat(string, "* /giveallcash /giveallscore /setallworld /setallinterior /kickall /disarmall /ejectall\n");
  1058. strcat(string, "* /mutecmd /unmutecmd /setallskin /fakedeath /cmdmuted /killall /slapall /explodeall\n");
  1059. strcat(string, "* /gmx\n\n");
  1060. }
  1061. if(User[playerid][accountAdmin] >= 5 || IsPlayerAdmin(playerid))
  1062. {
  1063. strcat(string, ""lightblue"• Admin Level 5\n");
  1064. strcat(string, ""white"");
  1065. #if VipSystem == false
  1066. strcat(string, "* /setlevel /fakechat /fakecmd /removeacc /makemegodadmin");
  1067. #else
  1068. strcat(string, "* /setlevel /fakechat /fakecmd /removeacc /makemegodadmin /setvip");
  1069. #endif
  1070. }
  1071.  
  1072. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""grey"Admin Commands", string, "Close", "");
  1073. return 1;
  1074. }
  1075.  
  1076. //============================================================================//
  1077. // Administrative Level One //
  1078. //============================================================================//
  1079.  
  1080. CMD:weaps(playerid, params[])
  1081. {
  1082. LoginCheck(playerid);
  1083. LevelCheck(playerid, 1);
  1084.  
  1085. new
  1086. id,
  1087. Count,
  1088. x,
  1089. string[128],
  1090. string2[64],
  1091. WeapName[24],
  1092. slot,
  1093. weap,
  1094. ammo
  1095. ;
  1096. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "[Error] /weaps [playerid]");
  1097. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1098. format(string2, sizeof(string2), "_______ [ %s(ID:%d) Weapons ] _______", pName(id), id);
  1099. SendClientMessage(playerid, COLOR_WHITE, string2);
  1100. for(slot = 0; slot < 14; slot++)
  1101. {
  1102. GetPlayerWeaponData(id, slot, weap, ammo);
  1103. if(ammo != 0 && weap != 0)
  1104. Count++;
  1105. }
  1106. if(Count < 1) return SendClientMessage(playerid, COLOR_RED, "Players has no equipped weapons!");
  1107. if(Count >= 1)
  1108. {
  1109. for (slot = 0; slot < 14; slot++)
  1110. {
  1111. GetPlayerWeaponData(id, slot, weap, ammo);
  1112. if(ammo != 0 && weap != 0)
  1113. {
  1114. GetWeaponName(weap, WeapName, sizeof(WeapName));
  1115. if(ammo == 65535 || ammo == 1)
  1116. format(string, sizeof(string), "%s%s (1)",string, WeapName);
  1117. else format(string, sizeof(string), "%s%s (%d)", string, WeapName, ammo);
  1118. x++;
  1119. if(x >= 5)
  1120. {
  1121. SendClientMessage(playerid, COLOR_YELLOW, string);
  1122. x = 0;
  1123. format(string, sizeof(string), "");
  1124. }
  1125. else format(string, sizeof(string), "%s, ", string);
  1126. }
  1127. }
  1128. if(x <= 4 && x > 0)
  1129. {
  1130. string[strlen(string)-3] = '.';
  1131. SendClientMessage(playerid, COLOR_YELLOW, string);
  1132. }
  1133. }
  1134. return 1;
  1135. }
  1136.  
  1137. CMD:aduty(playerid, params[])
  1138. {
  1139. LoginCheck(playerid);
  1140. LevelCheck(playerid, 1);
  1141.  
  1142. new
  1143. string[128]
  1144. ;
  1145.  
  1146. switch(User[playerid][pDuty])
  1147. {
  1148. case 0:
  1149. {
  1150. User[playerid][pDuty] = 1;
  1151. format(string, 128, "Admin %s(ID:%d) goes on \" Admin Mode \"", pName(playerid), playerid);
  1152. SendClientMessageToAll(COLOR_GREEN, string);
  1153. }
  1154. case 1:
  1155. {
  1156. User[playerid][pDuty] = 0;
  1157. format(string, 128, "Admin %s(ID:%d) goes back on \" Playing Mode \"", pName(playerid), playerid);
  1158. SendClientMessageToAll(COLOR_YELLOW, string);
  1159. }
  1160. }
  1161. return 1;
  1162. }
  1163.  
  1164. CMD:reports(playerid, params[])
  1165. {
  1166. LoginCheck(playerid);
  1167. LevelCheck(playerid, 1);
  1168.  
  1169. new string[1400], string2[136];
  1170. strcat(string, ""red"*** Report Send by the Players ***\n\n");
  1171. strcat(string, ""grey"");
  1172. for(new i=0; i<4; i++)
  1173. {
  1174. format(string2, sizeof string2, "(%d) %s\n", i, reportmsg[i]);
  1175. strcat(string, string2);
  1176. }
  1177.  
  1178. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"Reports", string, "Close", "");
  1179. return 1;
  1180. }
  1181.  
  1182. CMD:repair(playerid, params[])
  1183. {
  1184. LoginCheck(playerid);
  1185. LevelCheck(playerid, 1);
  1186.  
  1187. if(IsPlayerInAnyVehicle(playerid))
  1188. {
  1189. new VehicleID = GetPlayerVehicleID(playerid);
  1190. RepairVehicle(VehicleID);
  1191. GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~Vehicle ~g~Repaired!", 3000, 3);
  1192. SetVehicleHealth(VehicleID, 1000.0);
  1193. }
  1194. else
  1195. SendClientMessage(playerid, COLOR_RED, "[Error] You must be inside of the vehicle to use this command.");
  1196. return 1;
  1197. }
  1198.  
  1199. CMD:addnos(playerid, params[])
  1200. {
  1201. LoginCheck(playerid);
  1202. LevelCheck(playerid, 1);
  1203.  
  1204. if(IsPlayerInAnyVehicle(playerid))
  1205. {
  1206. switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
  1207. {
  1208. case 448,461,462,463,468,471,509,510,521,522,523,581,586,449: SendClientMessage(playerid, COLOR_RED, "[Error] You cannot add nos to this vehicle.");
  1209. }
  1210. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  1211. PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
  1212. }
  1213. else
  1214. SendClientMessage(playerid, COLOR_RED, "[Error] You must be inside of the vehicle to use this command.");
  1215. return 1;
  1216. }
  1217.  
  1218. CMD:warn(playerid, params[])
  1219. {
  1220. LoginCheck(playerid);
  1221. LevelCheck(playerid, 1);
  1222.  
  1223. new
  1224. string[128],
  1225. id,
  1226. reason[128]
  1227. ;
  1228.  
  1229. if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /warn [playerid] [reason]");
  1230. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1231. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot warn yourself.");
  1232. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1233.  
  1234. User[id][accountWarn] += 1;
  1235.  
  1236. format(string, sizeof(string), "Administrator %s(%d) warned %s(%d) for %s (Warnings: %d)", pName(playerid), playerid, pName(id), id, reason, User[id][accountWarn]);
  1237. SendClientMessageToAll(COLOR_YELLOW, string);
  1238. return 1;
  1239. }
  1240.  
  1241. CMD:remwarn(playerid, params[])
  1242. {
  1243. LoginCheck(playerid);
  1244. LevelCheck(playerid, 1);
  1245.  
  1246. new
  1247. string[130],
  1248. id
  1249. ;
  1250.  
  1251. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /remwarn [playerid]");
  1252. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1253. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot remove warn yourself.");
  1254. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1255. if(User[id][accountWarn] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player has no warnings.");
  1256. User[id][accountWarn] -= 1;
  1257.  
  1258. format(string, sizeof(string), "Administrator %s(%d) has removed %s(%d) warnings (Warnings Left: %i)", pName(playerid), playerid, pName(id), id, User[id][accountWarn]);
  1259. SendClientMessageToAll(COLOR_YELLOW, string);
  1260. return 1;
  1261. }
  1262.  
  1263. CMD:flip(playerid, params[])
  1264. {
  1265. LoginCheck(playerid);
  1266. LevelCheck(playerid, 1);
  1267.  
  1268. new id,
  1269. string[128],
  1270. Float:angle
  1271. ;
  1272.  
  1273. if(!sscanf(params, "u", id))
  1274. {
  1275. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1276. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1277. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not in a vehicle.");
  1278. GetVehicleZAngle(GetPlayerVehicleID(id), angle);
  1279. SetVehicleZAngle(GetPlayerVehicleID(id), angle);
  1280. format(string, sizeof(string), "You have flipped Player %s's vehicle.", pName(id));
  1281. SendClientMessage(playerid, COLOR_GREEN, string);
  1282. format(string, sizeof(string), "Administrator %s has flipped your vehicle.", pName(playerid));
  1283. SendClientMessage(id, COLOR_GREEN, string);
  1284. }
  1285. else
  1286. {
  1287. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error] You must be in a vehicle to use /flip.");
  1288. GetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
  1289. SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
  1290. SendClientMessage(playerid, COLOR_YELLOW, "Vehicle Flipped!");
  1291. SendClientMessage(playerid, -1, "Want to flip player's vehicle? Just do "orange"/flip [playerid]");
  1292. }
  1293. return 1;
  1294. }
  1295.  
  1296. CMD:gotoco(playerid, params[])
  1297. {
  1298. LoginCheck(playerid);
  1299. LevelCheck(playerid, 1);
  1300.  
  1301. new
  1302. Float: Pos[3],
  1303. string[128]
  1304. ;
  1305. if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2])) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /gotoco [x] [y] [z]");
  1306. if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
  1307. else SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  1308.  
  1309. format(string, sizeof string, "You have teleported to Coordinates %.1f %.1f %.1f", Pos[0], Pos[1], Pos[2]);
  1310. SendClientMessage(playerid, COLOR_YELLOW, string);
  1311. return 1;
  1312. }
  1313.  
  1314. CMD:ip(playerid, params[])
  1315. {
  1316. LoginCheck(playerid);
  1317. LevelCheck(playerid, 1);
  1318.  
  1319. new
  1320. id,
  1321. string[120]
  1322. ;
  1323. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /ip [playerid]");
  1324. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1325. format(string, 120, "> %s's IP: %s <", pName(id), getIP(id));
  1326. SendClientMessage(playerid, GetPlayerColor(id), string);
  1327. return 1;
  1328. }
  1329.  
  1330. CMD:spawn(playerid, params[])
  1331. {
  1332. LoginCheck(playerid);
  1333. LevelCheck(playerid, 1);
  1334.  
  1335. new
  1336. string[128],
  1337. id
  1338. ;
  1339.  
  1340. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /spawn [playerid]");
  1341. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1342. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1343. SetPlayerPos(id, 0.0, 0.0, 0.0);
  1344. SpawnPlayer(id);
  1345. format(string, sizeof(string), "You have respawned Player %s.", pName(id));
  1346. SendClientMessage(playerid, -1, string);
  1347. format(string, sizeof(string), "Administrator %s has respawned you.", pName(playerid));
  1348. SendClientMessage(id, COLOR_YELLOW, string);
  1349. return 1;
  1350. }
  1351.  
  1352. CMD:goto(playerid, params[])
  1353. {
  1354. LoginCheck(playerid);
  1355. LevelCheck(playerid, 1);
  1356.  
  1357. new
  1358. id,
  1359. string[130],
  1360. Float:x,
  1361. Float:y,
  1362. Float:z
  1363. ;
  1364. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /goto [playerid]");
  1365. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1366. GetPlayerPos(id, x, y, z);
  1367. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1368. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
  1369. if(GetPlayerState(playerid) == 2)
  1370. {
  1371. SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
  1372. LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(id));
  1373. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(id));
  1374. }
  1375. else SetPlayerPos(playerid, x+2, y, z);
  1376. format(string, sizeof(string), "You have been teleported to Player %s.", pName(id));
  1377. SendClientMessage(playerid, COLOR_GREEN, string);
  1378. format(string, sizeof(string), "Administrator %s has teleported to your location.", pName(playerid));
  1379. SendClientMessage(id, COLOR_GREEN, string);
  1380. return 1;
  1381. }
  1382.  
  1383. CMD:setweather(playerid, params[])
  1384. {
  1385. LoginCheck(playerid);
  1386. LevelCheck(playerid, 1);
  1387.  
  1388. new
  1389. string[130],
  1390. id,
  1391. weather
  1392. ;
  1393.  
  1394. if(sscanf(params, "ui", id, weather)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setweather [playerid] [0/45]");
  1395. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1396. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1397. if(weather < 0 || weather > 45) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Weather ID. (0/45)");
  1398. SetPlayerWeather(id, weather);
  1399. format(string, sizeof(string), "You have set %s's weather to weatherID %d", pName(id), weather);
  1400. SendClientMessage(playerid, COLOR_YELLOW, string);
  1401. format(string, sizeof(string), "Administrator %s has your weather to weatherID %d", pName(playerid), weather);
  1402. SendClientMessage(id, COLOR_YELLOW, string);
  1403. return 1;
  1404. }
  1405.  
  1406. CMD:settime(playerid, params[])
  1407. {
  1408. LoginCheck(playerid);
  1409. LevelCheck(playerid, 1);
  1410.  
  1411. new
  1412. string[130],
  1413. id,
  1414. time
  1415. ;
  1416.  
  1417. if(sscanf(params, "ui", id, time)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /settime [playerid] [0/23]");
  1418. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1419. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1420. if(time < 0 || time > 23) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Time. (0/23)");
  1421. SetPlayerTime(id, time, 0);
  1422. format(string, sizeof(string), "You have set %s's screen time to %d:00", pName(id), time);
  1423. SendClientMessage(id, COLOR_YELLOW, string);
  1424. format(string, sizeof(string), "Administrator %s has set your screen time to %d:00", pName(playerid), time);
  1425. SendClientMessage(id, COLOR_YELLOW, string);
  1426. return 1;
  1427. }
  1428.  
  1429. CMD:announce(playerid, params[])
  1430. {
  1431. LoginCheck(playerid);
  1432. LevelCheck(playerid, 1);
  1433. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /announce [message to all]");
  1434. GameTextForAll(params, 4000, 3);
  1435. return 1;
  1436. }
  1437.  
  1438. CMD:kick(playerid, params[])
  1439. {
  1440. LoginCheck(playerid);
  1441. LevelCheck(playerid, 1);
  1442.  
  1443. new
  1444. string[128],
  1445. id,
  1446. reason[128]
  1447. ;
  1448. if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /kick [playerid] [reason(Default: N/A)]");
  1449. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1450. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1451. format(string, sizeof(string), "** %s has been kicked by Adminstrator %s [Reason: %s]", pName(id), pName(playerid), reason);
  1452. SendClientMessageToAll(COLOR_GREY, string);
  1453.  
  1454. #if LOG == true
  1455. SaveLog("kicklog.txt", string);
  1456. #endif
  1457.  
  1458. KickDelay(id);
  1459. return 1;
  1460. }
  1461.  
  1462. CMD:asay(playerid, params[])
  1463. {
  1464. LoginCheck(playerid);
  1465. LevelCheck(playerid, 1);
  1466.  
  1467. new
  1468. string[128]
  1469. ;
  1470.  
  1471. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /asay [message as asay]");
  1472.  
  1473. format(string, sizeof(string), "** Admin %s: %s", pName(playerid), params);
  1474. SendClientMessageToAll(COLOR_GREEN, string);
  1475. return 1;
  1476. }
  1477.  
  1478. CMD:a(playerid, params[])
  1479. {
  1480. new
  1481. string[140]
  1482. ;
  1483.  
  1484. LoginCheck(playerid);
  1485. LevelCheck(playerid, 1);
  1486.  
  1487. if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "[Error] /a [admin chat]");
  1488.  
  1489. format(string, sizeof( string ), "<!> Admin Chat %s: %s", pName(playerid), params);
  1490.  
  1491. #if LOG == true
  1492. SaveLog("adminchat.txt", string);
  1493. #endif
  1494.  
  1495. foreach(new i : Player)
  1496. {
  1497. if(User[i][accountLogged] == 1)
  1498. {
  1499. if(User[i][accountAdmin] >= 1)
  1500. {
  1501. SendClientMessage(i, COLOR_YELLOW, string);
  1502. }
  1503. }
  1504. }
  1505. return 1;
  1506. }
  1507.  
  1508. //============================================================================//
  1509. // Administrative Level Two //
  1510. //============================================================================//
  1511.  
  1512. CMD:jetpack(playerid, params[])
  1513. {
  1514. LoginCheck(playerid);
  1515. LevelCheck(playerid, 2);
  1516.  
  1517. new
  1518. id,
  1519. string[130]
  1520. ;
  1521.  
  1522. if(!sscanf(params, "u", id))
  1523. {
  1524. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1525. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1526. SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
  1527. format(string, sizeof(string), "You have given Player %s(ID:%d) a jetpack.", pName(id), id);
  1528. SendClientMessage(playerid, COLOR_YELLOW, string);
  1529. format(string, sizeof(string), "Administrator %s(ID:%d) has given you a jetpack.", pName(playerid), playerid);
  1530. SendClientMessage(id, COLOR_YELLOW, string);
  1531. }
  1532. else
  1533. {
  1534. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
  1535. SendClientMessage(playerid, COLOR_YELLOW, "Jetpack Spawned!");
  1536. SendClientMessage(playerid, -1, "Want to give player a jetpack? Just do "orange"/jetpack [playerid]");
  1537. }
  1538. return 1;
  1539. }
  1540.  
  1541. CMD:aweapons(playerid, params[])
  1542. {
  1543. LoginCheck(playerid);
  1544. LevelCheck(playerid, 2);
  1545.  
  1546. GivePlayerWeapon(playerid, 24, 99999);
  1547. GivePlayerWeapon(playerid, 26, 99999);
  1548. GivePlayerWeapon(playerid, 29, 99999);
  1549. GivePlayerWeapon(playerid, 31, 99999);
  1550. GivePlayerWeapon(playerid, 33, 99999);
  1551. GivePlayerWeapon(playerid, 38, 99999);
  1552. GivePlayerWeapon(playerid, 9, 1);
  1553.  
  1554. SendClientMessage(playerid, COLOR_YELLOW, "Admin weapons received!");
  1555. return 1;
  1556. }
  1557.  
  1558. CMD:show(playerid, params[])
  1559. {
  1560. LoginCheck(playerid);
  1561. LevelCheck(playerid, 2);
  1562.  
  1563. new Player, Show[129];
  1564. if(sscanf(params, "us[129]", Player, Show)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /show [playerid] [text]");
  1565. if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1566. if(User[playerid][accountAdmin] < User[Player][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1567.  
  1568. GameTextForPlayer(Player, Show, 6000, 3);
  1569.  
  1570. new string[120];
  1571. format(string, sizeof(string), "Screen text sent to %s(ID:%d).", pName(Player), Player);
  1572. SendClientMessage(playerid, COLOR_YELLOW, string);
  1573. format(string, sizeof(string), "Administrator %s(ID:%d) has screen text you.", pName(playerid), playerid);
  1574. SendClientMessage(Player, COLOR_YELLOW, string);
  1575. return 1;
  1576. }
  1577.  
  1578. CMD:muted(playerid, params[])
  1579. {
  1580. new string[128], count = 0;
  1581.  
  1582. SendClientMessage(playerid, -1, "** "orange"Muted Players "white"**");
  1583. foreach(new i : Player)
  1584. {
  1585. if(User[i][accountLogged] == 1)
  1586. {
  1587. if(User[i][accountMuted] == 1)
  1588. {
  1589. format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountMuteSec]);
  1590. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1591. count++;
  1592. }
  1593. }
  1594. }
  1595. if(count == 0) return SendClientMessage(playerid, -1, "No muted players at the server.");
  1596. return 1;
  1597. }
  1598.  
  1599. CMD:jailed(playerid, params[])
  1600. {
  1601. new string[128], count = 0;
  1602.  
  1603. SendClientMessage(playerid, -1, "** "orange"Jailed Players "white"**");
  1604. foreach(new i : Player)
  1605. {
  1606. if(User[i][accountLogged] == 1)
  1607. {
  1608. if(User[i][accountJail] == 1)
  1609. {
  1610. format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountJailSec]);
  1611. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1612. count++;
  1613. }
  1614. }
  1615. }
  1616. if(count == 0) return SendClientMessage(playerid, -1, "No jailed players at the server.");
  1617. return 1;
  1618. }
  1619.  
  1620. CMD:setvhealth(playerid, params[])
  1621. {
  1622. LoginCheck(playerid);
  1623. LevelCheck(playerid, 2);
  1624.  
  1625. new
  1626. string[130],
  1627. id,
  1628. hp
  1629. ;
  1630.  
  1631. if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setvhealth [playerid] [health]");
  1632. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1633. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1634. new Float:hp2 = float(hp);
  1635.  
  1636. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player must be inside of a vehicle!");
  1637. SetVehicleHealth(GetPlayerVehicleID(id), hp2);
  1638.  
  1639. format(string, sizeof(string), "You have set Player's %s(ID:%d) vehicle health to %d", pName(id), id, floatround(hp2));
  1640. SendClientMessage(playerid, COLOR_YELLOW, string);
  1641. format(string, sizeof(string), "Admin %s(ID:%d) has set your vehicle health to %d", pName(playerid), playerid, floatround(hp2));
  1642. SendClientMessage(id, COLOR_YELLOW, string);
  1643. return 1;
  1644. }
  1645.  
  1646. CMD:eject(playerid, params[])
  1647. {
  1648. LoginCheck(playerid);
  1649. LevelCheck(playerid, 2);
  1650.  
  1651. new
  1652. string[130],
  1653. id
  1654. ;
  1655.  
  1656. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /eject [playerid]");
  1657. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1658. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1659. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player must be inside of the vehicle.");
  1660. RemovePlayerFromVehicle(id);
  1661. format(string, sizeof(string), "You have ejected %s(ID:%d) from his/HER vehicle", pName(id), id);
  1662. SendClientMessage(playerid, COLOR_YELLOW, string);
  1663. format(string, sizeof(string), "Admin %s(ID:%d) has ejected you from your vehicle.", pName(playerid), playerid);
  1664. SendClientMessage(id, COLOR_YELLOW, string);
  1665. return 1;
  1666. }
  1667.  
  1668. CMD:carpjob(playerid, params[])
  1669. {
  1670. LoginCheck(playerid);
  1671. LevelCheck(playerid, 2);
  1672.  
  1673. new
  1674. string[130],
  1675. id,
  1676. pjob
  1677. ;
  1678. if(sscanf(params, "ui", id, pjob)) return SendClientMessage(playerid, COLOR_RED, "[Error] /carpjob [playerid] [paintjob(0-3)]");
  1679. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1680. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1681. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player must be inside of a vehicle.");
  1682. if(pjob < 0 || pjob > 3) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Paintjob ID.");
  1683.  
  1684. format(string, sizeof(string), "You have changed the paintjob of %s(ID:%d)'s %s to '%d'", pName(id), id, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
  1685. SendClientMessage(playerid, COLOR_GREEN, string);
  1686. format(string, sizeof(string), "Admin %s(ID:%d) has changed the paintjob of your %s to '%d'", pName(playerid), playerid, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], pjob);
  1687. SendClientMessage(id, COLOR_YELLOW, string);
  1688. ChangeVehiclePaintjob(GetPlayerVehicleID(id), pjob);
  1689. return 1;
  1690. }
  1691.  
  1692. CMD:carcolor(playerid, params[])
  1693. {
  1694. LoginCheck(playerid);
  1695. LevelCheck(playerid, 2);
  1696.  
  1697. new
  1698. string[130],
  1699. id,
  1700. col1,
  1701. col2
  1702. ;
  1703. if(sscanf(params, "uiI(255)", id, col1, col2)) return SendClientMessage(playerid, COLOR_RED, "[Error] /carcolor [playerid] [colour1] [colour2(optional)]");
  1704. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1705. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1706. if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player must be inside of a vehicle.");
  1707.  
  1708. if(col2==255) col2=random(256);
  1709.  
  1710. format(string, sizeof(string), "You have changed the color of %s(ID:%d)'s %s to '%d,%d'", pName(id), id, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
  1711. SendClientMessage(playerid, COLOR_GREEN, string);
  1712. format(string, sizeof(string), "Admin %s(ID:%d) has changed the color of your %s to '%d,%d'", pName(playerid), playerid, VehicleNames[GetVehicleModel(GetPlayerVehicleID(id))-400], col1, col2);
  1713. SendClientMessage(id, COLOR_YELLOW, string);
  1714. ChangeVehicleColor(GetPlayerVehicleID(id), col1, col2);
  1715. return 1;
  1716. }
  1717.  
  1718. CMD:givecar(playerid, params[])
  1719. {
  1720. LoginCheck(playerid);
  1721. LevelCheck(playerid, 2);
  1722.  
  1723. new string[130],
  1724. vID[32],
  1725. id,
  1726. vVW,
  1727. vINT,
  1728. vid,
  1729. Float:x,
  1730. Float:y,
  1731. Float:z,
  1732. Float:ang,
  1733. vehicle,
  1734. col1,
  1735. col2
  1736. ;
  1737. if(sscanf(params, "us[32]I(255)I(255)", id, vID, col1, col2)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /givecar [playerid] [vehicleid(or name)] [color1(optional)] [color2(optional)]");
  1738. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1739. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1740. if(isnumeric(vID)) vid = strval(vID);
  1741. else vid = GetVehicleModelIDFromName(vID);
  1742. GetPlayerPos(id, x, y, z);
  1743. GetPlayerFacingAngle(id, ang);
  1744. if(vid < 400 || vid > 611) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Vehicle Model ID!");
  1745. if(IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "[Error] Player already have a vehicle.");
  1746.  
  1747. if(col1==255) col1=random(256);
  1748. if(col2==255) col2=random(256);
  1749.  
  1750. if(User[id][pCar] != -1 && !IsPlayerAdmin(id))
  1751. EraseVeh(User[id][pCar]);
  1752.  
  1753. vehicle = CreateVehicle(vid, x, y, z, 0, -1, -1, 0);
  1754. vVW = GetPlayerVirtualWorld(id);
  1755. vINT = GetPlayerInterior(id);
  1756. SetVehicleVirtualWorld(vehicle, vVW);
  1757. LinkVehicleToInterior(vehicle, vINT);
  1758. PutPlayerInVehicle(id, vehicle, 0);
  1759. User[id][pCar] = vehicle;
  1760. format(string, sizeof(string), "Admin %s(%d) has given you a \"%s\"(%i)", pName(playerid), playerid, VehicleNames[vid - 400], vid);
  1761. SendClientMessage(id, COLOR_YELLOW, string);
  1762. format(string, sizeof(string), "You have given %s(%d) a \"%s\"(%i)", pName(id), id, VehicleNames[vid - 400], vid);
  1763. SendClientMessage(playerid, COLOR_YELLOW, string);
  1764. return 1;
  1765. }
  1766.  
  1767. CMD:car(playerid, params[])
  1768. {
  1769. LoginCheck(playerid);
  1770. LevelCheck(playerid, 2);
  1771.  
  1772. new carID[50], car, colour1, colour2, string[128];
  1773. if(sscanf(params, "s[50]I(255)I(255)", carID, colour1, colour2)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /car [VehicleID(Name)] [Color1(Optional)] [Color2(Optional)]");
  1774. if(!isnumeric(carID)) car = GetVehicleModelIDFromName(carID);
  1775. else car = strval(carID);
  1776. if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Vehicle Model ID!");
  1777.  
  1778. if(colour1==255) colour1=random(256);
  1779. if(colour2==255) colour2=random(256);
  1780.  
  1781. if(User[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
  1782. EraseVeh(User[playerid][pCar]);
  1783. new VehicleID;
  1784. new Float:X, Float:Y, Float:Z;
  1785. new Float:Angle, int1;
  1786. GetPlayerPos(playerid, X, Y, Z);
  1787. GetPlayerFacingAngle(playerid, Angle);
  1788. int1 = GetPlayerInterior(playerid);
  1789. VehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
  1790. LinkVehicleToInterior(VehicleID, int1);
  1791. SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
  1792. User[playerid][pCar] = VehicleID;
  1793. format(string, sizeof(string), "You have spawned a \"%s\" (Model: %d) with color %d,%d", VehicleNames[car-400], car, colour1, colour2);
  1794. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1795. return 1;
  1796. }
  1797.  
  1798. CMD:spec(playerid, params[])
  1799. {
  1800. LoginCheck(playerid);
  1801. LevelCheck(playerid, 2);
  1802.  
  1803. new string[150], specplayerid;
  1804.  
  1805. if(sscanf(params, "u", specplayerid)) return SendClientMessage(playerid, COLOR_RED, "[Error] /spec [playerid]");
  1806. if(specplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1807. if(User[playerid][accountAdmin] < User[specplayerid][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1808. if(specplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot spectate yourself.");
  1809. if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && User[specplayerid][SpecID] != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player is spectating someone.");
  1810. if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not spawned.");
  1811. GetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
  1812. GetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
  1813. SpecInt[playerid][0] = GetPlayerInterior(playerid);
  1814. SpecInt[playerid][1] = GetPlayerVirtualWorld(playerid);
  1815. StartSpectate(playerid, specplayerid);
  1816. format(string, sizeof(string), "Now Spectating: %s (ID: %d)", pName(specplayerid), specplayerid);
  1817. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1818. SendClientMessage(playerid, -1, "Press SHIFT for Advance Spectating and SPACE for backward spectating.");
  1819. return 1;
  1820. }
  1821.  
  1822. CMD:specoff(playerid, params[])
  1823. {
  1824. LoginCheck(playerid);
  1825. LevelCheck(playerid, 2);
  1826.  
  1827. if(User[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
  1828. {
  1829. StopSpectate(playerid);
  1830. SetTimerEx("PosAfterSpec", 3000, 0, "d", playerid);
  1831. SendClientMessage(playerid, COLOR_LIGHTBLUE, "No longer spectating.");
  1832. }
  1833. else return SendClientMessage(playerid, COLOR_RED, "[Error] You are not spectating anyone.");
  1834. return 1;
  1835. }
  1836.  
  1837. CMD:akill(playerid, params[])
  1838. {
  1839. LoginCheck(playerid);
  1840. LevelCheck(playerid, 2);
  1841.  
  1842. new
  1843. string[150],
  1844. reason[128],
  1845. id
  1846. ;
  1847.  
  1848. if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /akill [playerid] [reason(Default: None)]");
  1849. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1850. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1851.  
  1852. if(_God[id] == 1)
  1853. {
  1854. _God[id] = 0;
  1855. }
  1856.  
  1857. SetPlayerHealth(id, 0.0);
  1858. format(string, sizeof(string), "** %s(%d) has been killed by Administrator %s(%d) (Reason: %s)", pName(id), id, pName(playerid), playerid, reason);
  1859. SendClientMessageToAll(COLOR_GREY, string);
  1860. return 1;
  1861. }
  1862.  
  1863. CMD:jail(playerid, params[])
  1864. {
  1865. LoginCheck(playerid);
  1866. LevelCheck(playerid, 2);
  1867.  
  1868. new id, sec, reason[128], string[250];
  1869. if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /jail [playerid] [seconds] [reason]");
  1870. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1871. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1872. if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot jail lower than 30 seconds.");
  1873. if(User[id][accountJail] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error] Player already jailed.");
  1874. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  1875.  
  1876. SetCameraBehindPlayer(id);
  1877. SetPlayerPos(id, 197.6661, 173.8179, 1003.0234);
  1878. SetPlayerInterior(id, 3);
  1879.  
  1880. format(string, sizeof(string), "** %s(%d) has been jailed by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
  1881. SendClientMessageToAll(COLOR_GREY, string);
  1882. SendClientMessage(id, COLOR_ORANGE, "You have been jailed by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
  1883.  
  1884. #if LOG == true
  1885. format(string, sizeof(string), "%s has been jailed by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
  1886. SaveLog("jail.txt", string);
  1887. #endif
  1888.  
  1889. User[id][accountJail] = 1, User[id][accountJailSec] = sec;
  1890. return 1;
  1891. }
  1892.  
  1893. CMD:unjail(playerid, params[])
  1894. {
  1895. LoginCheck(playerid);
  1896. LevelCheck(playerid, 2);
  1897.  
  1898. new id, reason[128], string[250];
  1899. if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /unjail [playerid] [reason]");
  1900. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1901. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1902. if(User[id][accountJail] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not in jailed.");
  1903. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  1904.  
  1905. format(string, sizeof(string), "** %s(%d) has been unjailed by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
  1906. SendClientMessageToAll(COLOR_GREY, string);
  1907. SendClientMessage(id, COLOR_ORANGE, "You have been released from jail by an Admin.");
  1908.  
  1909. #if LOG == true
  1910. format(string, sizeof(string), "%s has been unjailed by %s for %s", pName(id), pName(playerid), reason);
  1911. SaveLog("jail.txt", string);
  1912. #endif
  1913.  
  1914. User[id][accountJail] = 0, User[id][accountJailSec] = 0;
  1915. SpawnPlayer(id);
  1916. return 1;
  1917. }
  1918.  
  1919. CMD:mute(playerid, params[])
  1920. {
  1921. LoginCheck(playerid);
  1922. LevelCheck(playerid, 2);
  1923.  
  1924. new id, sec, reason[128], string[128+50];
  1925. if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /mute [playerid] [seconds] [reason]");
  1926. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1927. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1928. if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot mute lower than 30 seconds.");
  1929. if(User[id][accountMuted] == 1) return SendClientMessage(playerid,COLOR_RED, "[Error] Player already muted.");
  1930. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  1931.  
  1932. format(string, sizeof(string), "** %s(%d) has been muted by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
  1933. SendClientMessageToAll(COLOR_GREY, string);
  1934. SendClientMessage(id, COLOR_ORANGE, "You have been muted by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
  1935.  
  1936. #if LOG == true
  1937. format(string, sizeof(string), "%s has been muted by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
  1938. SaveLog("mute.txt", string);
  1939. #endif
  1940.  
  1941. User[id][accountMuted] = 1, User[id][accountMuteSec] = sec;
  1942. return 1;
  1943. }
  1944.  
  1945. CMD:unmute(playerid, params[])
  1946. {
  1947. LoginCheck(playerid);
  1948. LevelCheck(playerid, 2);
  1949.  
  1950. new id, reason[128], string[250];
  1951. if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /unmute [playerid] [reason]");
  1952. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1953. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  1954. if(User[id][accountMuted] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not muted.");
  1955. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  1956.  
  1957. format(string, sizeof(string), "* %s(%d) has been unmuted by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
  1958. SendClientMessageToAll(COLOR_GREY, string);
  1959. SendClientMessage(id, COLOR_ORANGE, "You have been unmuted by an Admin.");
  1960.  
  1961. #if LOG == true
  1962. format(string, sizeof(string), "%s has been unmuted by %s", pName(id), pName(playerid));
  1963. SaveLog("mute.txt", string);
  1964. #endif
  1965.  
  1966. User[id][accountMuted] = 0, User[id][accountMuteSec] = 0;
  1967. return 1;
  1968. }
  1969.  
  1970. CMD:setskin(playerid, params[])
  1971. {
  1972. new
  1973. string[128+40],
  1974. id,
  1975. skin
  1976. ;
  1977.  
  1978. LoginCheck(playerid);
  1979. LevelCheck(playerid, 2);
  1980.  
  1981. if(sscanf(params, "ui", id, skin)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setskin [playerid] [skin(0-311)]");
  1982. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  1983. if(skin < 0 || skin == 74 || skin > 311) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid skinID.");
  1984.  
  1985. format(string, 128, "You have set Player "orange"%s "white"skinID to "grey"%d", pName(id), skin);
  1986. SendClientMessage(playerid, -1, string);
  1987.  
  1988. format(string, 128, "Administrator "orange"%s "white"has set your skinID to "grey"%d", pName(playerid), skin);
  1989. SendClientMessage(id, -1, string);
  1990.  
  1991. SetPlayerSkin(id, skin);
  1992. return 1;
  1993. }
  1994.  
  1995. CMD:clearchat(playerid, params[])
  1996. {
  1997. LoginCheck(playerid);
  1998. LevelCheck(playerid, 2);
  1999.  
  2000. new
  2001. string[128]
  2002. ;
  2003.  
  2004. for(new i=0; i<100; i++)
  2005. {
  2006. SendClientMessageToAll(-1, " ");
  2007. }
  2008.  
  2009. format(string, sizeof string, "Administrator "orange"%s "white"has cleared the chat.", pName(playerid));
  2010. SendClientMessageToAll(-1, string);
  2011. return 1;
  2012. }
  2013.  
  2014. CMD:heal(playerid, params[])
  2015. {
  2016. LoginCheck(playerid);
  2017. LevelCheck(playerid, 2);
  2018.  
  2019. new
  2020. id,
  2021. string[130]
  2022. ;
  2023.  
  2024. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /heal [playerid]");
  2025. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2026.  
  2027. SetPlayerHealth(id, 100.0);
  2028. format(string, sizeof(string), "You have given Player %s a full pack of health.", pName(id));
  2029. SendClientMessage(playerid, COLOR_YELLOW, string);
  2030. format(string, sizeof(string), "Administrator %s has given you a full pack of health.", pName(playerid));
  2031. SendClientMessage(id, COLOR_YELLOW, string);
  2032. return 1;
  2033. }
  2034.  
  2035. CMD:armour(playerid, params[])
  2036. {
  2037. LoginCheck(playerid);
  2038. LevelCheck(playerid, 2);
  2039.  
  2040. new
  2041. id,
  2042. string[130]
  2043. ;
  2044.  
  2045. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /armour [playerid]");
  2046. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2047.  
  2048. SetPlayerArmour(id, 100.0);
  2049. format(string, sizeof(string), "You have given %s an armour.", pName(id));
  2050. SendClientMessage(playerid, COLOR_YELLOW, string);
  2051. format(string, sizeof(string), "Administrator %s has given you a full armour.", pName(playerid));
  2052. SendClientMessage(id, COLOR_YELLOW, string);
  2053. return 1;
  2054. }
  2055.  
  2056. CMD:setinterior(playerid, params[])
  2057. {
  2058. LoginCheck(playerid);
  2059. LevelCheck(playerid, 2);
  2060.  
  2061. new
  2062. string[130],
  2063. id,
  2064. interior
  2065. ;
  2066.  
  2067. if(sscanf(params, "ui", id, interior)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setinterior [playerid] [interior]");
  2068. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2069. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2070. SetPlayerInterior(id, interior);
  2071. format(string, sizeof(string), "Administrator %s has set your interior to %d.", pName(playerid), interior);
  2072. SendClientMessage(id, COLOR_ORANGE, string);
  2073. format(string, sizeof(string), "You have set Player %s's interior to %d.", pName(id), interior);
  2074. SendClientMessage(playerid, COLOR_ORANGE, string);
  2075. return 1;
  2076. }
  2077.  
  2078. CMD:setworld(playerid, params[])
  2079. {
  2080. LoginCheck(playerid);
  2081. LevelCheck(playerid, 2);
  2082.  
  2083. new
  2084. string[130],
  2085. id,
  2086. vw
  2087. ;
  2088.  
  2089. if(sscanf(params, "ui", id, vw)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setworld [playerid] [virtual world]");
  2090. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2091. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2092. SetPlayerVirtualWorld(id, vw);
  2093. format(string, sizeof(string), "Administrator %s has set your virtual world to %d.", pName(playerid), vw);
  2094. SendClientMessage(id, COLOR_ORANGE, string);
  2095. format(string, sizeof(string), "You have set Player %s's virtual world to %d.", pName(id), vw);
  2096. SendClientMessage(playerid, COLOR_ORANGE, string);
  2097. return 1;
  2098. }
  2099.  
  2100. CMD:explode(playerid, params[])
  2101. {
  2102. LoginCheck(playerid);
  2103. LevelCheck(playerid, 2);
  2104.  
  2105. new string[128],
  2106. id,
  2107. Float:x,
  2108. Float:y,
  2109. Float:z,
  2110. reason[128]
  2111. ;
  2112.  
  2113. if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /explode [playerid] [reason(Default: N/A)]");
  2114. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2115. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2116.  
  2117. GetPlayerPos(id, x, y, z);
  2118. format(string, sizeof(string), "** %s(%d) has been exploded by Administrator %s [Reason: %s]", pName(id), id, pName(playerid), reason);
  2119. SendClientMessageToAll(COLOR_GREY, string);
  2120.  
  2121. #if LOG == true
  2122. SaveLog("explode.txt", string);
  2123. #endif
  2124.  
  2125. CreateExplosion(x, y, z, 7, 1.00);
  2126. return 1;
  2127. }
  2128.  
  2129. CMD:disarm(playerid, params[])
  2130. {
  2131. LoginCheck(playerid);
  2132. LevelCheck(playerid, 2);
  2133.  
  2134. new
  2135. string[130],
  2136. id
  2137. ;
  2138.  
  2139. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /disarm [playerid]");
  2140. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2141. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2142. ResetPlayerWeapons(id);
  2143. format(string, sizeof(string), "You have removed Player %s's guns.", pName(id));
  2144. SendClientMessage(playerid, COLOR_YELLOW, string);
  2145. format(string, sizeof(string), "Administrator %s has removed your guns.", pName(playerid));
  2146. SendClientMessage(id, COLOR_YELLOW, string);
  2147. return 1;
  2148. }
  2149.  
  2150. //============================================================================//
  2151. // Administrative Level Three //
  2152. //============================================================================//
  2153.  
  2154. CMD:get(playerid, params[])
  2155. {
  2156. LoginCheck(playerid);
  2157. LevelCheck(playerid, 3);
  2158.  
  2159. new
  2160. id,
  2161. string[130],
  2162. Float:x,
  2163. Float:y,
  2164. Float:z
  2165. ;
  2166. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /get [playerid]");
  2167.  
  2168. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2169. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot teleport yourself to yourself.");
  2170. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2171.  
  2172. GetPlayerPos(playerid, x, y, z);
  2173. SetPlayerInterior(id, GetPlayerInterior(playerid));
  2174. SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
  2175.  
  2176. if(GetPlayerState(id) == 2)
  2177. {
  2178. new VehicleID = GetPlayerVehicleID(id);
  2179. SetVehiclePos(VehicleID, x+3, y, z);
  2180. LinkVehicleToInterior(VehicleID, GetPlayerInterior(playerid));
  2181. SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(playerid));
  2182. }
  2183. else SetPlayerPos(id, x+2, y, z);
  2184.  
  2185. format(string, sizeof(string), "You have been teleported to Admin %s(ID:%d) location.", pName(playerid), playerid);
  2186. SendClientMessage(id, COLOR_YELLOW, string);
  2187. format(string, sizeof(string), "You have teleported %s(ID:%d) to your location.", pName(id), id);
  2188. SendClientMessage(playerid, COLOR_YELLOW, string);
  2189. return 1;
  2190. }
  2191.  
  2192. CMD:write(playerid, params[])
  2193. {
  2194. LoginCheck(playerid);
  2195. LevelCheck(playerid, 3);
  2196.  
  2197. new
  2198. Colour,
  2199. string[130]
  2200. ;
  2201. if(sscanf(params, "is[128]", Colour, params))
  2202. return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /write [color] [text]") &&
  2203. SendClientMessage(playerid, COLOR_GREY, "Colors: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
  2204. if(Colour > 9) return SendClientMessage(playerid, COLOR_GREY, "Colors: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
  2205.  
  2206. if(Colour == 0) { format(string,sizeof(string),"%s",params); SendClientMessageToAll(COLOR_BLACK,string);return 1;}
  2207. else if(Colour == 1) {
  2208. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_WHITE,string); return 1;}
  2209. else if(Colour == 2) {
  2210. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_RED,string); return 1;}
  2211. else if(Colour == 3) {
  2212. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_ORANGE,string); return 1;}
  2213. else if(Colour == 4) {
  2214. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_YELLOW,string); return 1;}
  2215. else if(Colour == 5) {
  2216. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_GREEN,string); return 1;}
  2217. else if(Colour == 6) {
  2218. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_BLUE,string); return 1;}
  2219. else if(Colour == 7) {
  2220. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_PURPLE,string); return 1;}
  2221. else if(Colour == 8) {
  2222. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_BROWN,string); return 1;}
  2223. else if(Colour == 9) {
  2224. format(string,sizeof(string),"%s",params);SendClientMessageToAll(COLOR_PINK,string); return 1;}
  2225. return 1;
  2226. }
  2227.  
  2228. CMD:force(playerid, params[])
  2229. {
  2230. LoginCheck(playerid);
  2231. LevelCheck(playerid, 3);
  2232.  
  2233. new
  2234. string[130],
  2235. id
  2236. ;
  2237.  
  2238. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /force [playerid]");
  2239. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2240. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2241.  
  2242. format(string, sizeof(string), "You have force Player %s(ID:%d) to goto class selection.", pName(id), id);
  2243. SendClientMessage(playerid, COLOR_YELLOW, string);
  2244.  
  2245. format(string, sizeof(string), "Admin %s(ID:%d) force you to goto class selection.", pName(playerid), playerid);
  2246. SendClientMessage(id, COLOR_YELLOW, string);
  2247.  
  2248. SetPlayerHealth(id, 0.0);
  2249. ForceClassSelection(id);
  2250. return 1;
  2251. }
  2252.  
  2253. CMD:healall(playerid, params[])
  2254. {
  2255. LoginCheck(playerid);
  2256. LevelCheck(playerid, 3);
  2257.  
  2258. new
  2259. string[130]
  2260. ;
  2261.  
  2262. foreach(new i : Player)
  2263. {
  2264. if(i != playerid)
  2265. {
  2266. SetPlayerHealth(i, 100.0);
  2267. }
  2268. }
  2269. format(string, sizeof(string), "Admin %s(ID:%d) has heal all players.", pName(playerid), playerid);
  2270. SendClientMessageToAll(COLOR_YELLOW, string);
  2271. return 1;
  2272. }
  2273.  
  2274. CMD:setfstyle(playerid, params[])
  2275. {
  2276. LoginCheck(playerid);
  2277. LevelCheck(playerid, 3);
  2278.  
  2279. new
  2280. string[128],
  2281. id,
  2282. fstyle,
  2283. style[50]
  2284. ;
  2285.  
  2286. if(sscanf(params, "ui", id, fstyle)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setfstyle [playerid] [styles]") &&
  2287. SendClientMessage(playerid, COLOR_GREY, "Styles: [0]Normal, [1]Boxing, [2]Kungfu, [3]Kneehead, [4]Grabkick, [5]Elbow");
  2288. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2289. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2290. if(fstyle > 5) return SendClientMessage(playerid, COLOR_RED, "[Error] Inavlid Fighting Style.");
  2291.  
  2292. switch(fstyle)
  2293. {
  2294. case 0:
  2295. {
  2296. SetPlayerFightingStyle(id, 4);
  2297. style = "Normal";
  2298. }
  2299. case 1:
  2300. {
  2301. SetPlayerFightingStyle(id, 5);
  2302. style = "Boxing";
  2303. }
  2304. case 2:
  2305. {
  2306. SetPlayerFightingStyle(id, 6);
  2307. style = "Kung Fu";
  2308. }
  2309. case 3:
  2310. {
  2311. SetPlayerFightingStyle(id, 7);
  2312. style = "Kneehead";
  2313. }
  2314. case 4:
  2315. {
  2316. SetPlayerFightingStyle(id, 15);
  2317. style = "Grabkick";
  2318. }
  2319. case 5:
  2320. {
  2321. SetPlayerFightingStyle(id, 16);
  2322. style = "Elbow";
  2323. }
  2324. }
  2325. format(string, sizeof(string), "You have set %s(ID:%d) fighting style to '%s'", pName(id), id, style);
  2326. SendClientMessage(playerid, COLOR_YELLOW, string);
  2327. format(string, sizeof(string), "Admin %s(ID:%d) has set your fighting style to '%s'", pName(playerid), playerid, style);
  2328. SendClientMessage(id, COLOR_YELLOW, string);
  2329. return 1;
  2330. }
  2331.  
  2332. CMD:sethealth(playerid, params[])
  2333. {
  2334. LoginCheck(playerid);
  2335. LevelCheck(playerid, 3);
  2336.  
  2337. new
  2338. string[130],
  2339. id,
  2340. hp
  2341. ;
  2342.  
  2343. if(sscanf(params, "ud", id, hp)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /sethealth [playerid] [heatlh]");
  2344. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2345. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2346.  
  2347. new Float:hp2 = float(hp);
  2348.  
  2349. SetPlayerHealth(id, hp2);
  2350.  
  2351. format(string, sizeof(string), "You have set Player %s(ID:%d) health to %d", pName(id), id, floatround(hp2));
  2352. SendClientMessage(playerid, COLOR_YELLOW, string);
  2353. format(string, sizeof(string), "Admin %s(ID:%d) has set your health to %d", pName(playerid), playerid, floatround(hp2));
  2354. SendClientMessage(id, COLOR_YELLOW, string);
  2355. return 1;
  2356. }
  2357.  
  2358. CMD:setarmour(playerid, params[])
  2359. {
  2360. LoginCheck(playerid);
  2361. LevelCheck(playerid, 3);
  2362.  
  2363. new
  2364. string[130],
  2365. id,
  2366. armour
  2367. ;
  2368.  
  2369. if(sscanf(params, "ud", id, armour)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setarmour [playerid] [armour]");
  2370. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2371. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2372.  
  2373. new Float:ar = float(armour);
  2374. SetPlayerArmour(id, ar);
  2375.  
  2376. format(string, sizeof(string), "You have set Player %s(ID:%d) armour to %d", pName(id), id, floatround(ar));
  2377. SendClientMessage(playerid, COLOR_YELLOW, string);
  2378. format(string, sizeof(string), "Admin %s(ID:%d) has set your armour to %d", pName(playerid), playerid, floatround(ar));
  2379. SendClientMessage(id, COLOR_YELLOW, string);
  2380. return 1;
  2381. }
  2382.  
  2383. CMD:destroycar(playerid, params[])
  2384. {
  2385. LoginCheck(playerid);
  2386. LevelCheck(playerid, 3);
  2387. DelVehicle(GetPlayerVehicleID(playerid));
  2388. return 1;
  2389. }
  2390.  
  2391. CMD:teleplayer(playerid, params[])
  2392. {
  2393. LoginCheck(playerid);
  2394. LevelCheck(playerid, 3);
  2395.  
  2396. new
  2397. string[128],
  2398. id,
  2399. id2,
  2400. Float:x,
  2401. Float:y,
  2402. Float:z
  2403. ;
  2404. if(sscanf(params, "uu", id, id2)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /teleplayer [playerid] to [playerid2]");
  2405. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2406. if(User[playerid][accountAdmin] < User[id2][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2407. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2408. if(id2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2409. if(id == playerid && id2 == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot teleport yourself to yourself!");
  2410. GetPlayerPos(id2, x, y, z);
  2411. format(string, sizeof(string), "You have teleported Player %s(%d) to Player %s(%d)", pName(id), id, pName(id2), id2);
  2412. SendClientMessage(playerid, COLOR_YELLOW, string);
  2413. format(string, sizeof(string), "You have been teleported to Player %s(%d) by Admin %s(%d)", pName(id2), id2, pName(playerid), playerid);
  2414. SendClientMessage(id, COLOR_YELLOW, string);
  2415. format(string, sizeof(string), "Admin %s(%d) has port %s(%d) to you", pName(playerid), playerid, pName(id), id);
  2416. SendClientMessage(id2, COLOR_YELLOW, string);
  2417. SetPlayerInterior(id, GetPlayerInterior(id2));
  2418. SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(id2));
  2419. if(GetPlayerState(id) == 2)
  2420. {
  2421. SetVehiclePos(GetPlayerVehicleID(id), x+3, y, z);
  2422. LinkVehicleToInterior(GetPlayerVehicleID(id), GetPlayerInterior(id2));
  2423. SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(id2));
  2424. }
  2425. else SetPlayerPos(id, x+2, y, z);
  2426. return 1;
  2427. }
  2428.  
  2429. CMD:god(playerid, params[])
  2430. {
  2431. LoginCheck(playerid);
  2432. LevelCheck(playerid, 3);
  2433.  
  2434. if(_God[playerid] == 0)
  2435. {
  2436. //Removal of the weapons has been made.
  2437. SendClientMessage(playerid, COLOR_GREEN, "God Mode On!");
  2438. _God[playerid] = 1;
  2439. }
  2440. else if(_God[playerid] == 1)
  2441. {
  2442. _God[playerid] = 0;
  2443. SendClientMessage(playerid, COLOR_RED, "God Mode Off!");
  2444. SetPlayerHealth(playerid, 100.0);
  2445. }
  2446. return 1;
  2447. }
  2448.  
  2449. CMD:armourall(playerid, params[])
  2450. {
  2451. LoginCheck(playerid);
  2452. LevelCheck(playerid, 3);
  2453.  
  2454. new
  2455. string[130]
  2456. ;
  2457. foreach(new i : Player)
  2458. {
  2459. if(i != playerid)
  2460. {
  2461. SetPlayerArmour(i, 100.0);
  2462. }
  2463. }
  2464. format(string, sizeof(string), "Admin %s(ID:%d) has given everyone an armour.", pName(playerid), playerid);
  2465. SendClientMessageToAll(COLOR_YELLOW, string);
  2466. return 1;
  2467. }
  2468.  
  2469. CMD:bankrupt(playerid, params[])
  2470. {
  2471. LoginCheck(playerid);
  2472. LevelCheck(playerid, 3);
  2473.  
  2474. new
  2475. id,
  2476. string[130]
  2477. ;
  2478.  
  2479. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /bankrupt [playerid]");
  2480. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2481. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2482.  
  2483. ResetPlayerMoney(id);
  2484.  
  2485. format(string, sizeof(string), "Admin %s(ID:%d) has taken all your cash in-hand.", pName(playerid), playerid);
  2486. SendClientMessage(id, COLOR_YELLOW, string);
  2487. format(string, sizeof(string), "You have taken all the money in hand of Player %s(%d).", pName(id), id);
  2488. SendClientMessage(playerid, COLOR_YELLOW, string);
  2489. return 1;
  2490. }
  2491.  
  2492. CMD:getall(playerid, params[])
  2493. {
  2494. LoginCheck(playerid);
  2495. LevelCheck(playerid, 3);
  2496.  
  2497. new Float:x,
  2498. Float:y,
  2499. Float:z,
  2500. string[130],
  2501. interior = GetPlayerInterior(playerid)
  2502. ;
  2503.  
  2504. GetPlayerPos(playerid, x, y, z);
  2505. foreach(new i : Player)
  2506. {
  2507. if(i != playerid)
  2508. {
  2509. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2510. SetPlayerPos(i, x+(playerid/4)+1, y+(playerid/4), z);
  2511. SetPlayerInterior(i, interior);
  2512. SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  2513. }
  2514. }
  2515.  
  2516. format(string, sizeof(string), "Admin %s(ID:%d) has teleported all players to his or HER position!", pName(playerid), playerid);
  2517. SendClientMessageToAll(COLOR_YELLOW, string);
  2518. return 1;
  2519. }
  2520.  
  2521. CMD:freeze(playerid, params[])
  2522. {
  2523. LoginCheck(playerid);
  2524. LevelCheck(playerid, 3);
  2525.  
  2526. new
  2527. string[130],
  2528. id,
  2529. reason[128]
  2530. ;
  2531. if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /freeze [playerid] [reason]");
  2532. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2533. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot freeze yourself.");
  2534. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2535.  
  2536. TogglePlayerControllable(id, false);
  2537.  
  2538. format(string, sizeof(string), "You have frozen Player %s(%d) (Reason: %s)", pName(id), id, reason);
  2539. SendClientMessage(playerid, COLOR_YELLOW, string);
  2540. format(string, sizeof(string), "Administrator %s(ID:%d) has frozen you (Reason: %s)", pName(playerid), playerid, reason);
  2541. SendClientMessage(id, COLOR_YELLOW, string);
  2542. return 1;
  2543. }
  2544.  
  2545. CMD:unfreeze(playerid, params[])
  2546. {
  2547. LoginCheck(playerid);
  2548. LevelCheck(playerid, 3);
  2549.  
  2550. new
  2551. string[128],
  2552. id
  2553. ;
  2554.  
  2555. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /unfreeze [playerid]");
  2556. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2557. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot unfreeze yourself.");
  2558. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2559.  
  2560. TogglePlayerControllable(id, true);
  2561.  
  2562. format(string, sizeof(string), "You have unfrozen Player %s(%d)", pName(id), id);
  2563. SendClientMessage(playerid, COLOR_YELLOW, string);
  2564. format(string, sizeof(string), "Admin %s(%d) has unfrozen you.", pName(playerid), playerid);
  2565. SendClientMessage(id, COLOR_YELLOW, string);
  2566. return 1;
  2567. }
  2568.  
  2569. CMD:giveweapon(playerid, params[])
  2570. {
  2571. LoginCheck(playerid);
  2572. LevelCheck(playerid, 3);
  2573.  
  2574. new
  2575. id,
  2576. ammo,
  2577. wID[32],
  2578. weap,
  2579. WeapName[32],
  2580. string[130]
  2581. ;
  2582.  
  2583. if(sscanf(params, "us[32]i", id, wID, ammo)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /giveweapon [playerid] [weaponid(or weapon name)] [ammo]");
  2584. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2585. if(ammo <= 0 || ammo > 99999) ammo = 500;
  2586. if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
  2587. else weap = strval(wID);
  2588. if(!IsValidWeapon(weap)) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Weapon ID.");
  2589. GetWeaponName(weap, WeapName, 32);
  2590.  
  2591. format(string, sizeof(string), "You gave a %s(%d) with %d rounds of ammunation to %s.", WeapName, weap, ammo, pName(id));
  2592. SendClientMessage(playerid, COLOR_YELLOW, string);
  2593. format(string,sizeof(string),"Administrator %s has given you a %s(%d) with %d rounds of ammunation.", pName(playerid), WeapName, weap, ammo);
  2594. SendClientMessage(id, COLOR_YELLOW, string);
  2595. GivePlayerWeapon(id, weap, ammo);
  2596. return 1;
  2597. }
  2598.  
  2599. CMD:unban(playerid, params[])
  2600. {
  2601. LoginCheck(playerid);
  2602. LevelCheck(playerid, 3);
  2603.  
  2604. new
  2605. string[150],
  2606. Account[24],
  2607. DBResult:Result,
  2608. Query[129],
  2609. fIP[30]
  2610. ;
  2611. if(sscanf(params, "s[24]", Account)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /unban [account name]");
  2612. format(Query, 129, "SELECT * FROM `bans` WHERE `username` = '%s'", Account);
  2613. Result = db_query(Database, Query);
  2614.  
  2615. if(db_num_rows(Result))
  2616. {
  2617. db_get_field_assoc(Result, "ip", fIP, 30);
  2618.  
  2619. format(Query, 129, "DELETE FROM `bans` WHERE `username` = '%s'", Account);
  2620. Result = db_query(Database, Query);
  2621. db_free_result(Result);
  2622.  
  2623. format(string, sizeof string, "Administrator %s has unbanned %s.", pName(playerid), Account);
  2624. SendClientMessageToAll(COLOR_YELLOW, string);
  2625. print(string);
  2626.  
  2627. #if LOG == true
  2628. SaveLog("banlog.txt", string);
  2629. #endif
  2630. }
  2631. else
  2632. {
  2633. db_free_result(Result);
  2634. SendClientMessage(playerid, COLOR_RED, "[Error] Player is not in the banned database.");
  2635. return 1;
  2636. }
  2637. return 1;
  2638. }
  2639.  
  2640. CMD:ban(playerid, params[])
  2641. {
  2642. LoginCheck(playerid);
  2643. LevelCheck(playerid, 3);
  2644.  
  2645. new
  2646. string[128],
  2647. id,
  2648. reason[128],
  2649. when[128],
  2650. ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years
  2651. ;
  2652.  
  2653. gettime(ban_hr, ban_min, ban_sec);
  2654. getdate(ban_years, ban_month, ban_days);
  2655.  
  2656. if(sscanf(params, "uS(No Reason)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /ban [playerid] [reason(Default: No Reason)]");
  2657. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2658. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command to yourself.");
  2659. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2660.  
  2661. format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
  2662.  
  2663. format(string, sizeof(string), "** %s(ID:%d) has been banned by Administrator %s(%d) (Reason: %s)", pName(id), id, pName(playerid), playerid, reason);
  2664. SendClientMessageToAll(COLOR_GREY, string);
  2665. printf(string);
  2666. #if LOG == true
  2667. SaveLog("banlog.txt", string);
  2668. #endif
  2669. format(string, sizeof(string), "You have banned %s(%d) for %s.", pName(id), id, reason);
  2670. SendClientMessage(playerid, COLOR_YELLOW, string);
  2671. format(string, sizeof(string), "You have been banned by Administrator %s(%d) (Reason: %s)", pName(playerid), playerid, reason);
  2672. SendClientMessage(id, COLOR_YELLOW, string);
  2673. BanAccount(id, pName(playerid), reason);
  2674. ShowBan(id, pName(playerid), reason, when);
  2675. KickDelay(id);
  2676. return 1;
  2677. }
  2678.  
  2679. CMD:oban(playerid, params[])
  2680. {
  2681. LoginCheck(playerid);
  2682. LevelCheck(playerid, 3);
  2683.  
  2684. new
  2685. string[150],
  2686. name[24],
  2687. reason[128],
  2688. Query[256],
  2689. admin,
  2690. ip[20],
  2691. DBResult:Result,
  2692. ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years
  2693. ;
  2694.  
  2695. gettime(ban_hr, ban_min, ban_sec);
  2696. getdate(ban_years, ban_month, ban_days);
  2697.  
  2698. if(sscanf(params, "s[24]s[128]", name, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /oban [name in the data] [reason]");
  2699. foreach(new i : Player)
  2700. {
  2701. if(strcmp(pName(i), name, true) == 0)
  2702. {
  2703. SendClientMessage(playerid, COLOR_RED, "[Error] Player that you are trying to banned is online, /ban instead.");
  2704. return 1;
  2705. }
  2706. }
  2707. format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(name));
  2708. Result = db_query(Database, Query);
  2709. if(db_num_rows(Result))
  2710. {
  2711. db_get_field_assoc(Result, "admin", Query, 6);
  2712. admin = strval(Query);
  2713. db_get_field_assoc(Result, "IP", ip, 20);
  2714.  
  2715. if(User[playerid][accountAdmin] < admin)
  2716. {
  2717. SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on high ranking admin.");
  2718.  
  2719. #if LOG == true
  2720. format(string, sizeof(string), "%s has attempted to offline banned %s but failed for %s", pName(playerid), name, reason);
  2721. SaveLog("admin.txt", string);
  2722. #endif
  2723. return 1;
  2724. }
  2725.  
  2726. BanAccountEx(name, ip, pName(playerid), reason);
  2727.  
  2728. format(string, sizeof(string), "** %s has been offine banned by Administrator %s(%d) (Reason: %s)", name, pName(playerid), playerid, reason);
  2729. SendClientMessageToAll(COLOR_GREY, string);
  2730. printf(string);
  2731. #if LOG == true
  2732. SaveLog("banlog.txt", string);
  2733. #endif
  2734. }
  2735. else
  2736. {
  2737. SendClientMessage(playerid, COLOR_RED, "[Error] There is no such thing players in the server database.");
  2738. }
  2739. db_free_result(Result);
  2740. return 1;
  2741. }
  2742.  
  2743. CMD:cname(playerid, params[])
  2744. {
  2745. LoginCheck(playerid);
  2746. LevelCheck(playerid, 3);
  2747.  
  2748. new
  2749. string[128],
  2750. id,
  2751. newname[24]
  2752. ;
  2753.  
  2754. if(sscanf(params, "us[24]", id, newname)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /cname [playerid] [new name]");
  2755. if(strlen(newname) < 3 || strlen(newname) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Name Length.");
  2756. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2757. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2758.  
  2759. /*
  2760. DO NOT PLACE THESE CODES BELOW SETPLAYERNAME OR IT WILL BUGGED OUT.
  2761. */
  2762. //Saves the datas you current have on that account.
  2763. SaveData(id);
  2764. //Logs you out.
  2765. User[id][accountLogged] = false;
  2766.  
  2767. #if LOG == true
  2768. format(string, sizeof string, "Administrator %s has set %s's name to %s", pName(playerid), pName(id), newname);
  2769. SaveLog("account.txt", string);
  2770. #endif
  2771.  
  2772. format(string, sizeof(string), "You have set \"%s's\" name to \"%s\".", pName(id), newname); SendClientMessage(playerid, COLOR_YELLOW, string);
  2773. format(string, sizeof(string), "Administrator \"%s\" has set your name to \"%s\".", pName(playerid), newname); SendClientMessage(id, COLOR_YELLOW, string);
  2774. SetPlayerName(id, newname);
  2775.  
  2776. SendClientMessage(id, -1, "You have been logged out from your current account, Reconnecting to the server...");
  2777.  
  2778. //Reads all the codes from the callback OnPlayerConnect.
  2779. SetPlayerScore(id, 0);
  2780. ResetPlayerMoney(id);
  2781. OnPlayerConnect(id);
  2782. return 1;
  2783. }
  2784.  
  2785. CMD:slap(playerid, params[])
  2786. {
  2787. LoginCheck(playerid);
  2788. LevelCheck(playerid, 3);
  2789.  
  2790. new
  2791. Float:x,
  2792. Float:y,
  2793. Float:z,
  2794. Float:health,
  2795. string[128],
  2796. id,
  2797. reason[128]
  2798. ;
  2799.  
  2800. if(sscanf(params, "uS(N/A)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /slap [playerid] [reason(Default: N/A)]");
  2801. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2802. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2803. GetPlayerPos(id, x, y, z);
  2804. GetPlayerHealth(id, health);
  2805. SetPlayerHealth(id, health-25);
  2806. SetPlayerPos(id, x, y, z+5);
  2807. PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
  2808. PlayerPlaySound(id, 1190, 0.0, 0.0, 0.0);
  2809. format(string, sizeof(string), "** %s(%d) has been slapped by Administrator %s [Reason: %s]", pName(id), id, pName(playerid), reason);
  2810. SendClientMessageToAll(COLOR_GREY, string);
  2811. return 1;
  2812. }
  2813.  
  2814. CMD:setcolor(playerid, params[])
  2815. {
  2816. LoginCheck(playerid);
  2817. LevelCheck(playerid, 3);
  2818.  
  2819. new id;
  2820. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setcolor [playerid]");
  2821. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2822. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2823.  
  2824. SetPVarInt(playerid, "_Colors_", id);
  2825.  
  2826. ShowPlayerDialog(playerid, DIALOG_COLORS, DIALOG_STYLE_LIST, ""orange"Colors", ""black"Black\n"white"White\n"red"Red\n"orange"Orange\n"yellow"Yellow\n"green"Green\n"blue"Blue\n"purple"Purple\n"brown"Brown\n"pink"Pink", "Set", "Cancel");
  2827. return 1;
  2828. }
  2829.  
  2830. CMD:setmoney(playerid, params[])
  2831. {
  2832. LoginCheck(playerid);
  2833. LevelCheck(playerid, 3);
  2834.  
  2835. new
  2836. id,
  2837. string[128],
  2838. amount
  2839. ;
  2840.  
  2841. if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setmoney [playerid] [cash]");
  2842. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2843. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2844.  
  2845. ResetPlayerMoney(id);
  2846. GivePlayerMoney(id, amount);
  2847. format(string, sizeof(string), "You have set %s's cash to $%i.", pName(id), amount);
  2848. SendClientMessage(playerid, COLOR_YELLOW, string);
  2849. format(string, sizeof(string), "Administrator %s has set your cash to $%i.", pName(playerid), amount);
  2850. SendClientMessage(id, COLOR_YELLOW, string);
  2851.  
  2852. #if LOG == true
  2853. format(string, sizeof string, "Administrator %s has set %s's cash to $%i", pName(playerid), pName(id), amount);
  2854. SaveLog("set.txt", string);
  2855. #endif
  2856. return 1;
  2857. }
  2858.  
  2859. CMD:setscore(playerid, params[])
  2860. {
  2861. LoginCheck(playerid);
  2862. LevelCheck(playerid, 3);
  2863.  
  2864. new
  2865. id,
  2866. string[128],
  2867. amount
  2868. ;
  2869.  
  2870. if(sscanf(params, "ui", id, amount)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setscore [playerid] [score]");
  2871. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  2872. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2873.  
  2874. SetPlayerScore(id, amount);
  2875. format(string, sizeof(string), "You have set %s's score to %i.", pName(id), amount);
  2876. SendClientMessage(playerid, COLOR_YELLOW, string);
  2877. format(string, sizeof(string), "Administrator %s has set your score to %i.", pName(playerid), amount);
  2878. SendClientMessage(id, COLOR_YELLOW, string);
  2879.  
  2880. #if LOG == true
  2881. format(string, sizeof string, "Administrator %s has set %s's score to %i", pName(playerid), pName(id), amount);
  2882. SaveLog("set.txt", string);
  2883. #endif
  2884. return 1;
  2885. }
  2886.  
  2887. //============================================================================//
  2888. // Administrative Level Four //
  2889. //============================================================================//
  2890.  
  2891. CMD:gmx(playerid, params[])
  2892. {
  2893. new
  2894. string[128],
  2895. time
  2896. ;
  2897.  
  2898. LoginCheck(playerid);
  2899. LevelCheck(playerid, 4);
  2900.  
  2901. if(sscanf(params, "I(0)", time)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /gmx [Restart Timer(optional)") &&
  2902. SendClientMessage(playerid, -1, "Note: You can leave the parameter for a fast restart, no timers.");
  2903.  
  2904. if(time < 10 && time !=0) return SendClientMessage(playerid, COLOR_RED, "[Error] Restart Time shouldn't go below ten.");
  2905.  
  2906. if(time >= 10)
  2907. {
  2908. format(string, sizeof(string), "Admin %s(ID:%d) has announced a server restart which will end in %d seconds.", pName(playerid), playerid, time);
  2909. SendClientMessageToAll(COLOR_YELLOW, string);
  2910.  
  2911. SetTimer("RestartTimer", 1000*time, false);
  2912. }
  2913. else
  2914. {
  2915. format(string, sizeof(string), "Admin %s(ID:%d) has restarted the server.", pName(playerid), playerid);
  2916. SendClientMessageToAll(COLOR_YELLOW, string);
  2917.  
  2918. SendRconCommand("gmx");
  2919. }
  2920. return 1;
  2921. }
  2922.  
  2923. function:RestartTimer()
  2924. {
  2925. SendClientMessageToAll(COLOR_YELLOW, "Restart Time has been reached, Restarting the server now.");
  2926. return SendRconCommand("gmx");
  2927. }
  2928.  
  2929. CMD:fakedeath(playerid, params[])
  2930. {
  2931. new
  2932. string[128],
  2933. id,
  2934. killerid,
  2935. weapid
  2936. ;
  2937.  
  2938. LoginCheck(playerid);
  2939. LevelCheck(playerid, 4);
  2940.  
  2941. if(sscanf(params, "uui", killerid, id, weapid)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /fakedeath [killer] [victim] [weapon]");
  2942. if(killerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] KillerID not connected.");
  2943. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] VictimID not connected.");
  2944. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2945. if(User[playerid][accountAdmin] < User[killerid][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  2946. if(id == playerid && killerid == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You can't be KillerID and VictimID at the same time.");
  2947. if(!IsValidWeapon(weapid)) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Weapon ID.");
  2948.  
  2949. SendDeathMessage(killerid, id, weapid);
  2950.  
  2951. format(string, sizeof(string), "Fake Death Sent. [ Victim: %s(%d) | Suspect: %s(%d) | WeaponID: %i ]", pName(id), id, pName(killerid), killerid, weapid);
  2952. SendClientMessage(playerid, COLOR_YELLOW, string);
  2953. return 1;
  2954. }
  2955.  
  2956. CMD:setallskin(playerid, params[])
  2957. {
  2958. new string[128+40], skin;
  2959.  
  2960. LoginCheck(playerid);
  2961. LevelCheck(playerid, 4);
  2962.  
  2963. if(sscanf(params, "i", skin)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setallskin [skin(0-311)]");
  2964. if(skin < 0 || skin == 74 || skin > 311) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid skinID.");
  2965.  
  2966. foreach(new i : Player)
  2967. {
  2968. SetPlayerSkin(i, skin);
  2969. }
  2970.  
  2971. format(string, sizeof(string), "Admin %s(ID:%d) has set everyones skin to %d.", pName(playerid), playerid, skin);
  2972. SendClientMessageToAll(COLOR_YELLOW, string);
  2973. return 1;
  2974. }
  2975.  
  2976. CMD:cmdmuted(playerid, params[])
  2977. {
  2978. new string[128], count = 0;
  2979.  
  2980. SendClientMessage(playerid, -1, "** "orange"Command Muted Players "white"**");
  2981. foreach(new i : Player)
  2982. {
  2983. if(User[i][accountLogged] == 1)
  2984. {
  2985. if(User[i][accountCMuted] == 1)
  2986. {
  2987. format(string, sizeof(string), "(%d) %s - Seconds left %d", i, pName(i), User[i][accountCMuteSec]);
  2988. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  2989. count++;
  2990. }
  2991. }
  2992. }
  2993. if(count == 0) return SendClientMessage(playerid, -1, "No command muted players at the server.");
  2994. return 1;
  2995. }
  2996.  
  2997. CMD:mutecmd(playerid, params[])
  2998. {
  2999. LoginCheck(playerid);
  3000. LevelCheck(playerid, 4);
  3001.  
  3002. new id, sec, reason[128], string[250];
  3003. if(sscanf(params, "uiS(None)[128]", id, sec, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /mutecmd [playerid] [seconds] [reason]");
  3004. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3005. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  3006. if(sec < 30) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot mute lower than 30 seconds.");
  3007. if(User[id][accountCMuted] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error] Player already muted from using the commands.");
  3008. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  3009.  
  3010. format(string, sizeof(string), "** %s(%d) has been muted from using commands by Administrator %s(%d) for %d seconds [%s]", pName(id), id, pName(playerid), playerid, sec, reason);
  3011. SendClientMessageToAll(COLOR_GREY, string);
  3012. SendClientMessage(id, COLOR_ORANGE, "You have been muted from using commands by an Admin, Press a screenshot (F8) and make a complaint on the forums, if you want to.");
  3013.  
  3014. #if LOG == true
  3015. format(string, sizeof(string), "%s has been muted from using commands by %s (%d seconds, reason %s)", pName(id), pName(playerid), sec, reason);
  3016. SaveLog("mute.txt", string);
  3017. #endif
  3018.  
  3019. User[id][accountCMuted] = 1, User[id][accountCMuteSec] = sec;
  3020. return 1;
  3021. }
  3022.  
  3023. CMD:unmutecmd(playerid, params[])
  3024. {
  3025. LoginCheck(playerid);
  3026. LevelCheck(playerid, 4);
  3027.  
  3028. new id, reason[128], string[250];
  3029. if(sscanf(params, "uS(None)[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /unmutecmd [playerid] [reason]");
  3030. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3031. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  3032. if(User[id][accountCMuted] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not muted from using the commands.");
  3033. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on yourself.");
  3034.  
  3035. format(string, sizeof(string), "* %s(%d) has been unmuted from using commands by Administrator %s(%d) for %s", pName(id), id, pName(playerid), playerid, reason);
  3036. SendClientMessageToAll(COLOR_GREY, string);
  3037. SendClientMessage(id, COLOR_ORANGE, "You have been unmuted from using commands by an Admin.");
  3038.  
  3039. #if LOG == true
  3040. format(string, sizeof(string), "%s has been unmuted from using commands by %s", pName(id), pName(playerid));
  3041. SaveLog("mute.txt", string);
  3042. #endif
  3043.  
  3044. User[id][accountCMuted] = 0, User[id][accountCMuteSec] = 0;
  3045. return 1;
  3046. }
  3047.  
  3048. CMD:setallinterior(playerid, params[])
  3049. {
  3050. LoginCheck(playerid);
  3051. LevelCheck(playerid, 4);
  3052.  
  3053. new
  3054. id,
  3055. string[130]
  3056. ;
  3057. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setallinterior [interior]");
  3058. foreach(new i : Player)
  3059. {
  3060. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3061. SetPlayerInterior(i, id);
  3062. }
  3063. format(string, sizeof(string), "Admin %s(ID:%d) has set all players interior to \"%d\"", pName(playerid), playerid, id);
  3064. SendClientMessageToAll(COLOR_YELLOW, string);
  3065. return 1;
  3066. }
  3067.  
  3068. CMD:explodeall(playerid, params[])
  3069. {
  3070. LoginCheck(playerid);
  3071. LevelCheck(playerid, 4);
  3072.  
  3073. new
  3074. string[130],
  3075. Float:x,
  3076. Float:y,
  3077. Float:z
  3078. ;
  3079.  
  3080. foreach(new i : Player)
  3081. {
  3082. if(i != playerid)
  3083. {
  3084. GetPlayerPos(i, x, y, z);
  3085. CreateExplosion(x, y, z, 7, 1.00);
  3086. }
  3087. }
  3088.  
  3089. format(string, sizeof(string), "Admin %s(ID:%d) has exploded all players.", pName(playerid), playerid);
  3090. SendClientMessageToAll(COLOR_YELLOW, string);
  3091. printf(string);
  3092. return 1;
  3093. }
  3094.  
  3095. CMD:killall(playerid, params[])
  3096. {
  3097. LoginCheck(playerid);
  3098. LevelCheck(playerid, 4);
  3099.  
  3100. new
  3101. string[130]
  3102. ;
  3103.  
  3104. foreach(new i : Player)
  3105. {
  3106. if(i != playerid)
  3107. {
  3108. if(_God[i] == 1)
  3109. {
  3110. _God[i] = 0;
  3111. }
  3112. SetPlayerHealth(i, 0.0);
  3113. }
  3114. }
  3115.  
  3116. format(string, sizeof(string), "Admin %s(ID:%d) has killed all players.", pName(playerid), playerid);
  3117. SendClientMessageToAll(COLOR_YELLOW, string);
  3118. printf(string);
  3119. return 1;
  3120. }
  3121.  
  3122. CMD:slapall(playerid, params[])
  3123. {
  3124. LoginCheck(playerid);
  3125. LevelCheck(playerid, 4);
  3126.  
  3127. new
  3128. string[130],
  3129. Float:x,
  3130. Float:y,
  3131. Float:z,
  3132. Float:health
  3133. ;
  3134.  
  3135. foreach(new i : Player)
  3136. {
  3137. if(i != playerid)
  3138. {
  3139. GetPlayerPos(i, x, y, z);
  3140. GetPlayerHealth(i, health);
  3141. SetPlayerHealth(i, health-25);
  3142. SetPlayerPos(i, x, y, z+5);
  3143. PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
  3144. PlayerPlaySound(i, 1190, 0.0, 0.0, 0.0);
  3145. }
  3146. }
  3147.  
  3148. format(string, sizeof(string), "Admin %s(ID:%d) has slapped all players.", pName(playerid), playerid);
  3149. SendClientMessageToAll(COLOR_YELLOW, string);
  3150. printf(string);
  3151. return 1;
  3152. }
  3153.  
  3154. CMD:kickall(playerid, params[])
  3155. {
  3156. LoginCheck(playerid);
  3157. LevelCheck(playerid, 4);
  3158.  
  3159. new
  3160. string[130]
  3161. ;
  3162.  
  3163. foreach(new i : Player)
  3164. {
  3165. if(i != playerid)
  3166. {
  3167. KickDelay(i);
  3168. }
  3169. }
  3170.  
  3171. format(string, sizeof(string), "Admin %s(ID:%d) has kicked all players.", pName(playerid), playerid);
  3172. SendClientMessageToAll(COLOR_YELLOW, string);
  3173. printf(string);
  3174. #if LOG == true
  3175. SaveLog("kicklog.txt", string);
  3176. #endif
  3177. return 1;
  3178. }
  3179.  
  3180. CMD:ejectall(playerid, params[])
  3181. {
  3182. LoginCheck(playerid);
  3183. LevelCheck(playerid, 4);
  3184.  
  3185. new
  3186. string[128]
  3187. ;
  3188.  
  3189. foreach(new i : Player)
  3190. {
  3191. if(IsPlayerInAnyVehicle(i))
  3192. {
  3193. RemovePlayerFromVehicle(i);
  3194. }
  3195. }
  3196. format(string, sizeof(string), "Admin %s(ID:%d) has eject all players from their vehicle.", pName(playerid), playerid);
  3197. SendClientMessageToAll(COLOR_YELLOW, string);
  3198. return 1;
  3199. }
  3200.  
  3201. CMD:disarmall(playerid, params[])
  3202. {
  3203. LoginCheck(playerid);
  3204. LevelCheck(playerid, 4);
  3205.  
  3206. new
  3207. string[128]
  3208. ;
  3209.  
  3210. foreach(new i : Player)
  3211. {
  3212. ResetPlayerWeapons(i);
  3213. }
  3214. format(string, sizeof(string), "Admin %s(ID:%d) has remove all players weapon.", pName(playerid), playerid);
  3215. SendClientMessageToAll(COLOR_YELLOW, string);
  3216. return 1;
  3217. }
  3218.  
  3219. CMD:setallworld(playerid, params[])
  3220. {
  3221. LoginCheck(playerid);
  3222. LevelCheck(playerid, 4);
  3223.  
  3224. new
  3225. id,
  3226. string[130]
  3227. ;
  3228. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setallworld [world]");
  3229. foreach(new i : Player)
  3230. {
  3231. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3232. SetPlayerVirtualWorld(i, id);
  3233. }
  3234. format(string, sizeof(string), "Admin %s(ID:%d) has set all players virtual world to \"%d\"", pName(playerid), playerid, id);
  3235. SendClientMessageToAll(COLOR_YELLOW, string);
  3236. return 1;
  3237. }
  3238.  
  3239. CMD:giveallscore(playerid, params[])
  3240. {
  3241. LoginCheck(playerid);
  3242. LevelCheck(playerid, 4);
  3243.  
  3244. new
  3245. id,
  3246. string[130]
  3247. ;
  3248. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /giveallscore [score]");
  3249. foreach(new i : Player)
  3250. {
  3251. if(i != playerid)
  3252. {
  3253. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3254. SetPlayerScore(i, GetPlayerScore(i) + id);
  3255. }
  3256. }
  3257.  
  3258. format(string, sizeof(string), "Admin %s(ID:%d) has given all players score \"%d\"", pName(playerid), playerid, id);
  3259. SendClientMessageToAll(COLOR_YELLOW, string);
  3260. return 1;
  3261. }
  3262.  
  3263. CMD:giveallcash(playerid, params[])
  3264. {
  3265. LoginCheck(playerid);
  3266. LevelCheck(playerid, 4);
  3267.  
  3268. new
  3269. id,
  3270. string[130]
  3271. ;
  3272. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /giveallcash [money]");
  3273. foreach(new i : Player)
  3274. {
  3275. if(i != playerid)
  3276. {
  3277. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3278. GivePlayerMoney(i, id);
  3279. }
  3280. }
  3281.  
  3282. format(string, sizeof(string), "Admin %s(ID:%d) has given all players cash \"$%d\"", pName(playerid), playerid, id);
  3283. SendClientMessageToAll(COLOR_YELLOW, string);
  3284. return 1;
  3285. }
  3286.  
  3287. CMD:setalltime(playerid, params[])
  3288. {
  3289. LoginCheck(playerid);
  3290. LevelCheck(playerid, 4);
  3291.  
  3292. new
  3293. id,
  3294. string[128]
  3295. ;
  3296.  
  3297. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setalltime [time(0-23)]");
  3298. if(id < 0 || id > 23) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Time Hour (0-23).");
  3299. foreach(new i : Player)
  3300. {
  3301. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3302. SetPlayerTime(i, id, 0);
  3303. }
  3304.  
  3305. format(string, sizeof(string), "Admin %s(ID:%d) has set all players time to \"%d:00\"", pName(playerid), playerid, id);
  3306. SendClientMessageToAll(COLOR_YELLOW, string);
  3307. return 1;
  3308. }
  3309.  
  3310. CMD:setallweather(playerid, params[])
  3311. {
  3312. LoginCheck(playerid);
  3313. LevelCheck(playerid, 4);
  3314.  
  3315. new
  3316. id,
  3317. string[128]
  3318. ;
  3319. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setallweather [weather(0-45)]");
  3320. if(id < 0 || id > 45) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Weather ID! (0-45)");
  3321. foreach(new i : Player)
  3322. {
  3323. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  3324. SetPlayerWeather(i, id);
  3325. }
  3326. format(string, sizeof(string), "Admin %s(ID:%d) has set all players weather to \"%d\"", pName(playerid), playerid, id);
  3327. SendClientMessageToAll(COLOR_YELLOW, string);
  3328. return 1;
  3329. }
  3330.  
  3331. CMD:respawncars(playerid, params[])
  3332. {
  3333. LoginCheck(playerid);
  3334. LevelCheck(playerid, 4);
  3335.  
  3336. SendClientMessage(playerid, COLOR_GREEN, "You have successfully Respawned all Vehicles!");
  3337. GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned!", 3000, 3);
  3338. for(new cars=0; cars<MAX_VEHICLES; cars++)
  3339. {
  3340. if(!VehicleOccupied(cars))
  3341. {
  3342. SetVehicleToRespawn(cars);
  3343. }
  3344. }
  3345. return 1;
  3346. }
  3347.  
  3348. CMD:cleardwindow(playerid, params[])
  3349. {
  3350. LoginCheck(playerid);
  3351. LevelCheck(playerid, 4);
  3352.  
  3353. new
  3354. string[128]
  3355. ;
  3356.  
  3357. format(string, sizeof(string), "Administrator "orange"%s "white"has cleared the Death Window!", pName(playerid));
  3358. SendClientMessageToAll(-1, string);
  3359. for(new i = 0; i < 20; i++) SendDeathMessage(6000, 5005, 255);
  3360. return 1;
  3361. }
  3362.  
  3363. CMD:saveallstats(playerid, params[])
  3364. {
  3365. LoginCheck(playerid);
  3366. LevelCheck(playerid, 4);
  3367.  
  3368. new
  3369. string[130]
  3370. ;
  3371.  
  3372. format(string, sizeof string, "Administrator "orange"%s "white"has saved all player's data.", pName(playerid));
  3373. SendClientMessageToAll(-1, string);
  3374. foreach(new i : Player)
  3375. {
  3376. if(User[i][accountLogged] == 1)
  3377. {
  3378. SaveData(i);
  3379. }
  3380. }
  3381.  
  3382. #if LOG == true
  3383. format(string, sizeof string, "Administrator %s has saved all player's data.", pName(playerid));
  3384. SaveLog("account.txt", string);
  3385. #endif
  3386. return 1;
  3387. }
  3388.  
  3389. CMD:giveallweapon(playerid, params[])
  3390. {
  3391. LoginCheck(playerid);
  3392. LevelCheck(playerid, 4);
  3393.  
  3394. new
  3395. ammo,
  3396. wID[32],
  3397. weap,
  3398. WeapName[32],
  3399. string[130]
  3400. ;
  3401. if(sscanf(params, "s[32]i", wID, ammo)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /giveallweapon [weaponid(or name)] [ammo]");
  3402. if(ammo <= 0 || ammo > 99999) ammo = 500;
  3403. if(!isnumeric(wID)) weap = GetWeaponIDFromName(wID);
  3404. else weap = strval(wID);
  3405. if(!IsValidWeapon(weap)) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Weapon ID");
  3406. GetWeaponName(weap, WeapName, 32);
  3407. foreach(new i : Player)
  3408. {
  3409. GivePlayerWeapon(i, weap, ammo);
  3410. format(string, sizeof string, "~g~%s for all!", WeapName);
  3411. GameTextForPlayer(i, string, 2500, 3);
  3412. }
  3413. format(string,sizeof(string), "Admin %s(ID:%d) has given all players a %s(%d) with %d rounds of ammo.", pName(playerid), playerid, WeapName, weap, ammo);
  3414. SendClientMessageToAll(COLOR_YELLOW, string);
  3415. return 1;
  3416. }
  3417.  
  3418. //============================================================================//
  3419. // Administrative Level Five //
  3420. //============================================================================//
  3421.  
  3422. CMD:makemegodadmin(playerid, params[])
  3423. {
  3424. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error] Only RCON can use this command.");
  3425. else
  3426. {
  3427. User[playerid][accountAdmin] = 5;
  3428. SendClientMessage(playerid, COLOR_GREEN, "You have set your administrative rank to level 5.");
  3429. }
  3430. return 1;
  3431. }
  3432.  
  3433. CMD:removeacc(playerid, params[])
  3434. {
  3435. LoginCheck(playerid);
  3436. LevelCheck(playerid, 5);
  3437.  
  3438. new
  3439. Account[MAX_PLAYER_NAME],
  3440. Reason[100],
  3441. string[128]
  3442. ;
  3443. if(sscanf(params, "s[24]s[100]", Account, Reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /removeacc [account name] [reason]");
  3444. if(DataExist(Account))
  3445. {
  3446. if(!strcmp(pName(playerid), Account, false))
  3447. return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot delete your own account!");
  3448.  
  3449. foreach(new i : Player)
  3450. {
  3451. if(strcmp(Account, pName(i), true) == 0)
  3452. {
  3453. SendClientMessage(playerid, COLOR_RED, "[Error] Player is online, fail to delete the account.");
  3454. return 1;
  3455. }
  3456. }
  3457.  
  3458. new Query[128+50];
  3459. format(Query, 100, "DELETE FROM `users` WHERE `username` = '%s'", Account);
  3460. db_query(Database, Query);
  3461. db_free_result(db_query(Database, Query));
  3462.  
  3463. format(string, 128, "Admin %s(ID: %d) has deleted %s's account [Reason: %s]", pName(playerid), playerid, Account, Reason);
  3464. SendClientMessageToAll(COLOR_YELLOW, string);
  3465. SaveLog("account.txt", string);
  3466.  
  3467. format(string, 128, "You have deleted %s's account [Reason: %s]", Account, Reason);
  3468. SendClientMessage(playerid, COLOR_YELLOW, string);
  3469. }
  3470. else
  3471. {
  3472. SendClientMessage(playerid, COLOR_RED, "[Error] Account does not exist in the database!");
  3473. }
  3474. return 1;
  3475. }
  3476.  
  3477. CMD:fakecmd(playerid, params[])
  3478. {
  3479. new
  3480. string[128],
  3481. id,
  3482. cmdtext[128]
  3483. ;
  3484.  
  3485. LoginCheck(playerid);
  3486. LevelCheck(playerid, 5);
  3487.  
  3488. if(sscanf(params, "us[128]", id, cmdtext)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /fakecmd [playerid] [command]");
  3489. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3490. if(strfind(params, "/", false) != -1)
  3491. {
  3492. CallRemoteFunction("OnPlayerCommandText", "is", id, cmdtext);
  3493. format(string, sizeof(string), "Fake command sent to %s with %s", pName(id), cmdtext);
  3494. SendClientMessage(playerid, COLOR_YELLOW, string);
  3495. }
  3496. else return SendClientMessage(playerid, COLOR_RED, "[Error] Add '/' before putting the command name to avoid the command unknown error.");
  3497. return 1;
  3498. }
  3499.  
  3500. CMD:fakechat(playerid, params[])
  3501. {
  3502. LoginCheck(playerid);
  3503. LevelCheck(playerid, 5);
  3504.  
  3505. new
  3506. string[130],
  3507. id,
  3508. text[128]
  3509. ;
  3510.  
  3511. if(sscanf(params, "us[128]", id, text)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /fakechat [playerid] [text]");
  3512. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3513. format(string, sizeof(string), "You have faked chat %s with %s", pName(id), text);
  3514. SendClientMessage(playerid, COLOR_YELLOW, string);
  3515. SendPlayerMessageToAll(id, text);
  3516. return 1;
  3517. }
  3518.  
  3519. CMD:setlevel(playerid, params[])
  3520. {
  3521. new
  3522. string[128],
  3523. id,
  3524. level
  3525. ;
  3526.  
  3527. LoginCheck(playerid);
  3528. LevelCheck(playerid, 5);
  3529.  
  3530. if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setlevel [playerid] [level(0/5)]");
  3531. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3532. if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_RED, "[Error] Levels shouldn't go below zero and shouldn't go above five.");
  3533. if(level == User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] Player is already in that level.");
  3534. if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not logged in.");
  3535.  
  3536. if(User[id][accountAdmin] < level)
  3537. {
  3538. format(string, 128, "You have been promoted to level %d by %s.", level, pName(playerid));
  3539. SendClientMessage(id, COLOR_YELLOW, string);
  3540. format(string, 128, "You have promoted %s to level %d.", pName(id), level);
  3541. SendClientMessage(playerid, COLOR_YELLOW, string);
  3542. }
  3543. else if(User[id][accountAdmin] > level)
  3544. {
  3545. format(string, 128, "You have been demoted to level %d by %s.", level, pName(playerid));
  3546. SendClientMessage(id, COLOR_YELLOW, string);
  3547. format(string, 128, "You have demoted %s to level %d.", pName(id), level);
  3548. SendClientMessage(playerid, COLOR_YELLOW, string);
  3549. }
  3550.  
  3551. User[id][accountAdmin] = level;
  3552.  
  3553. #if LOG == true
  3554. format(string, sizeof string, "Administrator %s has set %s's administrative level to %d", pName(playerid), pName(id), level);
  3555. SaveLog("account.txt", string);
  3556. #endif
  3557.  
  3558. SaveData(id); //Saving the whole data - Neater version than previously.
  3559. return 1;
  3560. }
  3561.  
  3562. #if VipSystem == true
  3563. CMD:setvip(playerid, params[])
  3564. {
  3565. new
  3566. string[128],
  3567. id,
  3568. level
  3569. ;
  3570.  
  3571. LoginCheck(playerid);
  3572. LevelCheck(playerid, 5);
  3573.  
  3574. if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /setvip [playerid] [level(0/3)]");
  3575. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3576. if(level < 0 || level > 3) return SendClientMessage(playerid, COLOR_RED, "[Error] Levels shouldn't go below zero and shouldn't go above three.");
  3577. if(level == accountVip[id]) return SendClientMessage(playerid, COLOR_RED, "[Error] Player is already in that level.");
  3578. if(User[id][accountLogged] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not logged in.");
  3579.  
  3580. if(accountVip[id] < level)
  3581. {
  3582. format(string, 128, "You have been promoted to VIP level %d by %s.", level, pName(playerid));
  3583. SendClientMessage(id, COLOR_YELLOW, string);
  3584. format(string, 128, "You have promoted %s to VIP level %d.", pName(id), level);
  3585. SendClientMessage(playerid, COLOR_YELLOW, string);
  3586. }
  3587. else if(accountVip[id] > level)
  3588. {
  3589. format(string, 128, "You have been demoted to VIP level %d by %s.", level, pName(playerid));
  3590. SendClientMessage(id, COLOR_YELLOW, string);
  3591. format(string, 128, "You have demoted %s to VIP level %d.", pName(id), level);
  3592. SendClientMessage(playerid, COLOR_YELLOW, string);
  3593. }
  3594.  
  3595. accountVip[id] = level;
  3596.  
  3597. #if LOG == true
  3598. format(string, sizeof string, "Administrator %s has set %s's vip level to %d", pName(playerid), pName(id), level);
  3599. SaveLog("account.txt", string);
  3600. #endif
  3601.  
  3602. SaveData(id); //Saving the whole data - Neater version than previously.
  3603. return 1;
  3604. }
  3605. #endif
  3606.  
  3607. //============================================================================//
  3608. // Administrative Level Zero //
  3609. //============================================================================//
  3610.  
  3611. CMD:admins(playerid, params[])
  3612. {
  3613. new string[128], count = 0;
  3614.  
  3615. SendClientMessage(playerid, -1, "** "orange"Online Administrators "white"**");
  3616. foreach(new i : Player)
  3617. {
  3618. if(User[i][accountLogged] == 1)
  3619. {
  3620. if(User[i][accountAdmin] >= 1)
  3621. {
  3622. format(string, sizeof(string), "(%d) %s - Level %d Admin", i, pName(i), User[i][accountAdmin]);
  3623. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  3624. count++;
  3625. }
  3626. }
  3627. }
  3628. if(count == 0) return SendClientMessage(playerid, -1, "No administrators online at the server.");
  3629. return 1;
  3630. }
  3631.  
  3632. CMD:jcredits(playerid, params[])
  3633. {
  3634. SendClientMessage(playerid, COLOR_GREEN, "JaKe's Administration System "VERSION" Credits to:");
  3635. SendClientMessage(playerid, -1, "_Jake_, Y_Less, DracoBlue, Zeex, Zher0, Lordzy");
  3636. SendClientMessage(playerid, COLOR_YELLOW, "Ranveer, Samp_India, Ashirwad, Sonic, Adham, MaxFranky and others who helped us.");
  3637. return 1;
  3638. }
  3639.  
  3640. CMD:savestats(playerid, params[])
  3641. {
  3642. LoginCheck(playerid);
  3643.  
  3644. if(!DataExist(pName(playerid))) return SendClientMessage(playerid, COLOR_RED, "[Error] You do not have account.");
  3645.  
  3646. SaveData(playerid);
  3647.  
  3648. SendClientMessage(playerid, COLOR_GREEN, "ACCOUNT: Your account statistics has been saved manually.");
  3649. return 1;
  3650. }
  3651.  
  3652. CMD:jcmds(playerid, params[])
  3653. {
  3654. new string[1246];
  3655.  
  3656. LoginCheck(playerid);
  3657.  
  3658. strcat(string, ""orange"");
  3659. strcat(string, "Listing all available commands of JakAdmin 3.4.\n\n");
  3660.  
  3661. strcat(string, ""grey"");
  3662. strcat(string, "/stats /cpass /register /login /report /admins /jcredits /savestats");
  3663.  
  3664. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""orange"Player Commands", string, "Close", "");
  3665. return 1;
  3666. }
  3667.  
  3668. CMD:report(playerid, params[])
  3669. {
  3670. new id, reason[128], string[136];
  3671. if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /report [playerid] [reason]");
  3672. if(strlen(reason) <= 4) return SendClientMessage(playerid, COLOR_RED, "[Error] Reason length shouldn't go lower than four.");
  3673. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3674. if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot report yourself.");
  3675. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  3676. new r_hr, r_min, r_sec, r_m, r_d, r_y;
  3677. getdate(r_y, r_m, r_d);
  3678. gettime(r_hr, r_min, r_sec);
  3679.  
  3680. reportmsg[3] = reportmsg[2];
  3681. reportmsg[2] = reportmsg[1];
  3682. reportmsg[1] = reportmsg[0];
  3683.  
  3684. format(string, sizeof(string), "(%02d/%02d/%d - %02d:%02d:%02d) %s(ID:%d) has reported %s(ID:%d) for %s", r_m, r_d, r_y, r_hr, r_min, r_sec, pName(playerid), playerid, pName(id), id, reason);
  3685. reportmsg[0] = string;
  3686.  
  3687. format(string, sizeof(string), "REPORT: %s(ID:%d) has reported %s(ID:%d) for %s", pName(playerid), playerid, pName(id), id, reason);
  3688. SendAdmin(COLOR_RED, string);
  3689.  
  3690. foreach(new i : Player)
  3691. {
  3692. if(User[i][accountLogged] == 1)
  3693. {
  3694. if(User[i][accountAdmin] >= 1)
  3695. {
  3696. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  3697. }
  3698. }
  3699. }
  3700.  
  3701. format(string, sizeof(string), "Your complaint against %s(ID:%d) %s has been sent to Online Admins.", pName(id), id, reason);
  3702. SendClientMessage(playerid, COLOR_YELLOW, string);
  3703. return 1;
  3704. }
  3705.  
  3706. CMD:register(playerid, params[])
  3707. {
  3708. if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error] You are logged in and registered already.");
  3709.  
  3710. if(!DataExist(pName(playerid)))
  3711. {
  3712. new
  3713. string[128],
  3714. password[24],
  3715. hashpass[129]
  3716. ;
  3717.  
  3718. if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /register [password]");
  3719. if(!IsValidPassword(password)) return SendClientMessage(playerid, COLOR_RED, "[Error] Invalid Password Symbols.");
  3720. if(strlen(password) < 4 || strlen(password) > 20) return SendClientMessage(playerid, COLOR_RED, "[Error] Password length shouldn't go below 4 and shouldn't go higher 20.");
  3721.  
  3722. WP_Hash(hashpass, 129, password);
  3723.  
  3724. SetPlayerScore(playerid, STARTING_SCORE);
  3725. GivePlayerMoney(playerid, STARTING_CASH);
  3726.  
  3727. //Time = Hours, Time2 = Minutes, Time3 = Seconds
  3728. new time, time2, time3;
  3729. gettime(time, time2, time3);
  3730. new date, date2, date3;
  3731. //Date = Month, Date2 = Day, Date3 = Year
  3732. getdate(date3, date, date2);
  3733.  
  3734. format(User[playerid][accountDate], 150, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);
  3735.  
  3736. new
  3737. query[750+1000]
  3738. ;
  3739. format(query, sizeof(query),
  3740. "INSERT INTO `users` (`username`, `IP`, `joindate`, `password`, `admin`, `kills`, `deaths`, `score`, `money`, `warn`, `mute`, `mutesec`, `cmute`, `cmutesec`, `jail`, `jailsec`, `hours`, `minutes`, `seconds`, `question`, `answer`, `vip`) VALUES ('%s','%s','%s','%s',0,0,0,%d,%d,0,0,0,0,0,0,0,0,0,0,'%s','%s',0)",\
  3741. DB_Escape(pName(playerid)),
  3742. DB_Escape(User[playerid][accountIP]),
  3743. DB_Escape(User[playerid][accountDate]),
  3744. DB_Escape(hashpass),
  3745. User[playerid][accountScore],
  3746. User[playerid][accountCash],
  3747. DB_Escape(User[playerid][accountQuestion]),
  3748. DB_Escape(User[playerid][accountAnswer])
  3749. );
  3750. db_query(Database, query);
  3751.  
  3752. User[playerid][accountLogged] = true;
  3753.  
  3754. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  3755.  
  3756. new
  3757. count,
  3758. DBResult: result
  3759. ;
  3760. result = db_query(Database, "SELECT * FROM `users`");
  3761. count = db_num_rows(result);
  3762. db_free_result(result);
  3763.  
  3764. User[playerid][accountID] = count;
  3765. SendClientMessage(playerid, -1, "You have successfully registered from the database.");
  3766. format(string, sizeof(string), "You are now handling accountID %i from the JakAdmin3 system.", count);
  3767. SendClientMessage(playerid, COLOR_ORANGE, string);
  3768.  
  3769. SendClientMessage(playerid, COLOR_YELLOW, "Proceeding to the Security Question.");
  3770.  
  3771. ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"Welcome to JakAdmin3's security question, Where you'll setup your account's security question.\nYou can use the Security Question incase you forgot your password, you can rely on it 100 percent.\n\nPut your question below:", "Setup", "");
  3772. }
  3773. else
  3774. {
  3775. SendClientMessage(playerid, COLOR_RED, "[Error] You already have an account, /login instead.");
  3776. }
  3777. return 1;
  3778. }
  3779.  
  3780. CMD:login(playerid, params[])
  3781. {
  3782. if(User[playerid][accountLogged] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error] You are logged in already.");
  3783.  
  3784. if(DataExist(pName(playerid)))
  3785. {
  3786. new
  3787. hashp[129],
  3788. string[900],
  3789. password[24]
  3790. ;
  3791.  
  3792. if(sscanf(params, "s[24]", password)) return SendClientMessage(playerid, COLOR_RED, "[Error] /login [password]");
  3793.  
  3794. if(strcmp(password, "forget", true) == 0)
  3795. {
  3796. format(string, sizeof(string), ""grey"You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.", User[playerid][accountQuestion]);
  3797. ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
  3798. return 1;
  3799. }
  3800.  
  3801. WP_Hash(hashp, 129, password);
  3802. if(!strcmp(hashp, User[playerid][accountPassword], false))
  3803. {
  3804. LoginPlayer(playerid);
  3805. }
  3806. else
  3807. {
  3808. User[playerid][WarnLog]++;
  3809.  
  3810. if(User[playerid][WarnLog] == 3)
  3811. {
  3812. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server having too much wrong passwords!\nTry again, Reconnect (/q then join to the server again.)", "Close", "");
  3813. KickDelay(playerid);
  3814. return 1;
  3815. }
  3816.  
  3817. format(string, sizeof(string), "Invalid password! - %d out of 3 Warning Log Tires.", User[playerid][WarnLog]);
  3818. SendClientMessage(playerid, COLOR_RED, string);
  3819.  
  3820. SendClientMessage(playerid, -1, "LOGIN: Try again, /login [password].");
  3821. }
  3822. }
  3823. else
  3824. {
  3825. SendClientMessage(playerid, COLOR_RED, "[Error] You do not have an account, /register first.");
  3826. }
  3827. return 1;
  3828. }
  3829.  
  3830. CMD:cpass(playerid, params[])
  3831. {
  3832. LoginCheck(playerid);
  3833.  
  3834. new OldPass[129], NewPass[129], string[128];
  3835. if(sscanf(params, "s[24]s[24]", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /cpass [old pass] [new pass]");
  3836. if(strlen(NewPass) < 4 || strlen(NewPass) > 20)
  3837. return SendClientMessage(playerid, COLOR_RED, "[Error] New password length shouldn't go below four and shouldn't go below twenty.");
  3838.  
  3839. new Query[300], DBResult:Result, Buf[129];
  3840. WP_Hash(Buf, 129, OldPass);
  3841. format(Query, 300, "SELECT `userid` FROM `users` WHERE `username` = '%s' AND `password` = '%s'", User[playerid][accountName], Buf);
  3842. Result = db_query(Database, Query);
  3843.  
  3844. format(string, sizeof string, "Player %s has changed his/her password.", pName(playerid));
  3845. SaveLog("account.txt", string);
  3846.  
  3847. if(Result)
  3848. {
  3849. if(db_num_rows(Result))
  3850. {
  3851. db_free_result(Result);
  3852. WP_Hash(Buf, 129, NewPass);
  3853. format(Query, 300, "UPDATE `users` SET `password` = '%s' WHERE `username` = '%s'", DB_Escape(Buf), DB_Escape(User[playerid][accountName]));
  3854. db_query(Database, Query);
  3855.  
  3856. format(string, 128, "Your password has been changed to '"orange"%s"white"'", NewPass);
  3857. SendClientMessage(playerid, -1, string);
  3858. }
  3859. else
  3860. {
  3861. db_free_result(Result);
  3862. return SendClientMessage(playerid, COLOR_RED, "[Error] Old Password doesn't match on the current password!");
  3863. }
  3864. }
  3865. return 1;
  3866. }
  3867.  
  3868. CMD:stats(playerid, params[])
  3869. {
  3870. LoginCheck(playerid);
  3871.  
  3872. new id;
  3873. if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "<!> [Error] /stats [playerid]");
  3874. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[Error] Player not connected.");
  3875. if(User[playerid][accountAdmin] < User[id][accountAdmin]) return SendClientMessage(playerid, COLOR_RED, "[Error] You cannot use this command on higher admin.");
  3876.  
  3877. ShowStatistics(playerid, id); //Show the statistics to yourself.
  3878. return 1;
  3879. }
  3880.  
  3881. // //
  3882. //============================================================================//
  3883.  
  3884. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  3885. {
  3886. return 1;
  3887. }
  3888.  
  3889. public OnPlayerExitVehicle(playerid, vehicleid)
  3890. {
  3891. return 1;
  3892. }
  3893.  
  3894. public OnPlayerStateChange(playerid, newstate, oldstate)
  3895. {
  3896. new vehicleid = GetPlayerVehicleID(playerid);
  3897.  
  3898. if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  3899. {
  3900. foreach(new x : Player)
  3901. {
  3902. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE)
  3903. {
  3904. TogglePlayerSpectating(x, 1);
  3905. PlayerSpectatePlayer(x, playerid);
  3906. User[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
  3907. }
  3908. }
  3909. }
  3910.  
  3911. if(newstate == PLAYER_STATE_PASSENGER)
  3912. {
  3913. foreach(new x : Player)
  3914. {
  3915. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
  3916. {
  3917. TogglePlayerSpectating(x, 1);
  3918. PlayerSpectateVehicle(x, vehicleid);
  3919. User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
  3920. }
  3921. }
  3922. }
  3923.  
  3924. if(newstate == PLAYER_STATE_DRIVER)
  3925. {
  3926. foreach(new x : Player)
  3927. {
  3928. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
  3929. {
  3930. TogglePlayerSpectating(x, 1);
  3931. PlayerSpectateVehicle(x, vehicleid);
  3932. User[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
  3933. }
  3934. }
  3935. }
  3936. return 1;
  3937. }
  3938.  
  3939. public OnPlayerRequestSpawn(playerid)
  3940. {
  3941. #if ANTI_SPAWN == true
  3942. if(User[playerid][accountLogged] == 0)
  3943. {
  3944. SendClientMessage(playerid, COLOR_RED, "[Error] You need to login or register to spawn.");
  3945. return 0;
  3946. }
  3947. #endif
  3948. return 1;
  3949. }
  3950.  
  3951. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  3952. {
  3953. foreach(new x : Player)
  3954. {
  3955. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid && User[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER)
  3956. {
  3957. SetPlayerInterior(x,newinteriorid);
  3958. }
  3959. }
  3960. return 1;
  3961. }
  3962.  
  3963. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  3964. {
  3965. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
  3966. {
  3967. if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
  3968. else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
  3969. }
  3970. return 1;
  3971. }
  3972.  
  3973. #if RconProtect == true
  3974. public OnPlayerRconLogin(playerid)
  3975. {
  3976. if(_RCON[playerid] == false)
  3977. {
  3978. SendClientMessage(playerid, COLOR_YELLOW, "The server has 2nd Rcon, Protected by JakAdmin");
  3979. ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by JakAdmin3\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
  3980. }
  3981. return 1;
  3982. }
  3983. #endif
  3984.  
  3985. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  3986. {
  3987. switch( dialogid )
  3988. {
  3989. #if RconProtect == true
  3990. case DIALOG_RCON:
  3991. {
  3992. new
  3993. string[130]
  3994. ;
  3995. if(!response)
  3996. {
  3997. format(string, sizeof(string), "** Player %s(ID:%d) has been automatically kicked by the Server (Attempting to logged in RCON)", pName(playerid), playerid);
  3998. SendClientMessageToAll(COLOR_GREY, string);
  3999. print(string);
  4000. #if LOG == true
  4001. SaveLog("rcon.txt", string);
  4002. #endif
  4003. return KickDelay(playerid);
  4004. }
  4005. if(response)
  4006. {
  4007. if(!strcmp(RconPass, inputtext) && !(!strlen(inputtext)))
  4008. {
  4009. format(string, sizeof(string), "** Player %s(ID:%d) has accessed the RCON Protection successfully!", pName(playerid), playerid);
  4010. SendAdmin(COLOR_GREY, string);
  4011. print(string);
  4012. #if LOG == true
  4013. SaveLog("rcon.txt", string);
  4014. #endif
  4015.  
  4016. _RCON[playerid] = true;
  4017.  
  4018. GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~g~Authorized ~w~Access!~n~~y~Welcome Administrator!", 3000, 3);
  4019. }
  4020. else
  4021. {
  4022. if(_RCONwarn[playerid] == MAX_RCON_WARNINGS+1)
  4023. {
  4024. format(string, sizeof(string), "** Player %s(ID:%d) has been kicked by the Server (Attempting to logged in RCON)", pName(playerid), playerid);
  4025. SendClientMessageToAll(COLOR_GREY, string);
  4026. print(string);
  4027. #if LOG == true
  4028. SaveLog("kicklog.txt", string);
  4029. #endif
  4030. KickDelay(playerid);
  4031. return 1;
  4032. }
  4033. _RCONwarn[playerid] ++;
  4034. format(string, sizeof(string), "You have been warned for incorrect 2nd RCON Password (Warnings: %i/%i)", _RCONwarn[playerid], MAX_RCON_WARNINGS);
  4035. SendClientMessage(playerid, COLOR_GREY, string);
  4036. ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_PASSWORD, ""green"2nd RCON Password", ""grey"The RCON password is protected by JakAdmin3\nPlease type the 2nd RCON Password to access the RCON.", "Access", "Kick");
  4037. }
  4038. }
  4039. }
  4040. #endif
  4041.  
  4042. case DIALOG_QUESTION:
  4043. {
  4044. if(!response)
  4045. {
  4046. ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"Welcome to JakAdmin3's security question, Where you'll setup your account's security question.\nYou can use the Security Question incase you forgot your password, you can rely on it 100 percent.\n\nPut your question below:", "Setup", "");
  4047. }
  4048. else
  4049. {
  4050. if(strlen(inputtext) < 6 || strlen(inputtext) > 90)
  4051. {
  4052. ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"Welcome to JakAdmin3's security question, Where you'll setup your account's security question.\nYou can use the Security Question incase you forgot your password, you can rely on it 100 percent.\nERROR: Your question shouldn't go below six length and shouldn't go above ninety.\n\nPut your question below:", "Setup", "");
  4053. return 1;
  4054. }
  4055.  
  4056. format(User[playerid][accountQuestion], 129, "%s", inputtext);
  4057.  
  4058. SendClientMessage(playerid, -1, "Security Question has been set up, Proceeding to Security Answer.");
  4059.  
  4060. SaveData(playerid);
  4061.  
  4062. ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\n\nPut your security answer below:", "Setup", "");
  4063. }
  4064. }
  4065.  
  4066. case DIALOG_ANSWER:
  4067. {
  4068. if(!response)
  4069. {
  4070. ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\n\nPut your security answer below:", "Setup", "");
  4071. }
  4072. else
  4073. {
  4074. if(strlen(inputtext) < 2 || strlen(inputtext) > 90)
  4075. {
  4076. ShowPlayerDialog(playerid, DIALOG_ANSWER, DIALOG_STYLE_INPUT, ""lightblue"Security Answer", ""grey"You have setup the Security Question, Now setup your security answer.\nERROR: Your security answer length shouldn't go below two and shouldn't go above ninety.\n\nPut your security answer below:", "Setup", "");
  4077. return 1;
  4078. }
  4079.  
  4080. new hashanswer[129];
  4081. WP_Hash(hashanswer, 129, inputtext);
  4082. format(User[playerid][accountAnswer], 129, "%s", hashanswer);
  4083.  
  4084. SendClientMessage(playerid, COLOR_GREEN, "Security Question setting up is done, Once you've forgotten your account's password on login, Press forgot.");
  4085.  
  4086. SaveData(playerid);
  4087. }
  4088. }
  4089.  
  4090. case DIALOG_REGISTER:
  4091. {
  4092. new
  4093. string[128],
  4094. hashpass[129]
  4095. ;
  4096. if(response)
  4097. {
  4098. if(!IsValidPassword(inputtext))
  4099. {
  4100. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Invalid Password Symbols.", "Register", "Quit");
  4101. return 0;
  4102. }
  4103. if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
  4104. {
  4105. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Register", ""grey"Welcome to the Server!\nYour account doesn't exist on our database, Please insert your password below.\n\nTIPS: Make the password long so no one can hack it.\nERROR: Password length shouldn't go below 4 and shouldn't go higher 20.", "Register", "Quit");
  4106. return 0;
  4107. }
  4108.  
  4109. WP_Hash(hashpass, 129, inputtext);
  4110.  
  4111. SetPlayerScore(playerid, STARTING_SCORE);
  4112. GivePlayerMoney(playerid, STARTING_CASH);
  4113.  
  4114. //Time = Hours, Time2 = Minutes, Time3 = Seconds
  4115. new time, time2, time3;
  4116. gettime(time, time2, time3);
  4117. new date, date2, date3;
  4118. //Date = Month, Date2 = Day, Date3 = Year
  4119. getdate(date3, date, date2);
  4120.  
  4121. format(User[playerid][accountDate], 150, "%02d/%02d/%d %02d:%02d:%02d", date, date2, date3, time, time2, time3);
  4122.  
  4123. format(User[playerid][accountQuestion], 129, "What?");
  4124. format(User[playerid][accountAnswer], 129, "Yes");
  4125.  
  4126. new
  4127. query[750+1000]
  4128. ;
  4129. format(query, sizeof(query),
  4130. "INSERT INTO `users` (`username`, `IP`, `joindate`, `password`, `admin`, `kills`, `deaths`, `score`, `money`, `warn`, `mute`, `mutesec`, `cmute`, `cmutesec`, `jail`, `jailsec`, `hours`, `minutes`, `seconds`, `question`, `answer`, `vip`) VALUES ('%s','%s','%s','%s',0,0,0,%d,%d,0,0,0,0,0,0,0,0,0,0,'%s','%s',0)",\
  4131. DB_Escape(pName(playerid)),
  4132. DB_Escape(User[playerid][accountIP]),
  4133. DB_Escape(User[playerid][accountDate]),
  4134. DB_Escape(hashpass),
  4135. User[playerid][accountScore],
  4136. User[playerid][accountCash],
  4137. DB_Escape(User[playerid][accountQuestion]),
  4138. DB_Escape(User[playerid][accountAnswer])
  4139. );
  4140. db_query(Database, query);
  4141.  
  4142. User[playerid][accountLogged] = true;
  4143.  
  4144. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  4145.  
  4146. new
  4147. count,
  4148. DBResult: result
  4149. ;
  4150. result = db_query(Database, "SELECT * FROM `users`");
  4151. count = db_num_rows(result);
  4152. db_free_result(result);
  4153.  
  4154. User[playerid][accountID] = count;
  4155. SendClientMessage(playerid, -1, "You have successfully registered from the database.");
  4156. format(string, sizeof(string), "You are now handling accountID %i from the JakAdmin3 system.", count);
  4157. SendClientMessage(playerid, COLOR_ORANGE, string);
  4158. SendClientMessage(playerid, COLOR_YELLOW, "Proceeding to the Security Question.");
  4159.  
  4160. ShowPlayerDialog(playerid, DIALOG_QUESTION, DIALOG_STYLE_INPUT, ""lightblue"Security Question", ""grey"Welcome to JakAdmin3's security question, Where you'll setup your account's security question.\nYou can use the Security Question incase you forgot your password, you can rely on it 100 percent.\n\nPut your question below:", "Setup", "");
  4161. }
  4162. else
  4163. {
  4164. KickDelay(playerid);
  4165. }
  4166. }
  4167. case DIALOG_LOGIN:
  4168. {
  4169. new
  4170. hashp[129],
  4171. string[900]
  4172. ;
  4173. if(response)
  4174. {
  4175. WP_Hash(hashp, 129, inputtext);
  4176. if(!strcmp(hashp, User[playerid][accountPassword], false))
  4177. {
  4178. LoginPlayer(playerid);
  4179. }
  4180. else
  4181. {
  4182. User[playerid][WarnLog]++;
  4183.  
  4184. if(User[playerid][WarnLog] == 3)
  4185. {
  4186. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""lightblue"Kicked", ""grey"You have been kicked from the server having too much wrong passwords!\nTry again, Reconnect (/q then join to the server again.)", "Close", "");
  4187. KickDelay(playerid);
  4188. return 0;
  4189. }
  4190.  
  4191. format(string, sizeof(string), "Invalid password! - %d out of 3 Warning Log Tires.", User[playerid][WarnLog]);
  4192. SendClientMessage(playerid, COLOR_RED, string);
  4193.  
  4194. format(string, sizeof(string), ""grey"Welcome back to the server!\nYour account exists on our database, Please insert your account's password below.\n\nTIPS: If you do not own the account, Please /q and find another username.\nERROR: Wrong password (%d/3 Warnings Log)", User[playerid][WarnLog]);
  4195.  
  4196. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""lightblue"JakAdmin3 - Login", string, "Login", "Forget");
  4197. }
  4198. }
  4199. else
  4200. {
  4201. format(string, sizeof(string), ""grey"You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.", User[playerid][accountQuestion]);
  4202. ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
  4203. }
  4204. }
  4205.  
  4206. case DIALOG_FORGET:
  4207. {
  4208. if(!response)
  4209. {
  4210. KickDelay(playerid);
  4211. }
  4212. else
  4213. {
  4214. new hashanswer[129];
  4215. WP_Hash(hashanswer, 129, inputtext);
  4216.  
  4217. if(strcmp(User[playerid][accountAnswer], hashanswer, true) == 0)
  4218. {
  4219. LoginPlayer(playerid);
  4220. SendClientMessage(playerid, -1, "Access granted.");
  4221. }
  4222. else
  4223. {
  4224. new string[900];
  4225. format(string, sizeof(string), ""grey"You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\n%s\n\nAnswer?\nPress Quit if you are willing to quit.\n\nERROR: Wrong Answer on the question.", User[playerid][accountQuestion]);
  4226. ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, ""lightblue"Security Question", string, "Answer", "Quit");
  4227. }
  4228. }
  4229. }
  4230.  
  4231. case DIALOG_COLORS:
  4232. {
  4233. new string[120], id = GetPVarInt(playerid, "_Colors_");
  4234.  
  4235. switch( response )
  4236. {
  4237. case 0:
  4238. {
  4239. DeletePVar(playerid, "_Colors_");
  4240. SendClientMessage(playerid, -1, "Colour setting has been cancelled.");
  4241. }
  4242. case 1:
  4243. {
  4244. switch( listitem )
  4245. {
  4246. case 0:
  4247. {
  4248. format(string, sizeof(string), "Administrator %s has set your name color to Black", pName(playerid));
  4249. SendClientMessage(id, COLOR_YELLOW, string);
  4250. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4251. SendClientMessage(playerid, COLOR_YELLOW, string);
  4252. SetPlayerColor(id, COLOR_BLACK);
  4253. DeletePVar(playerid, "_Colors_");
  4254. }
  4255. case 1:
  4256. {
  4257. format(string, sizeof(string), "Administrator %s has set your name color to White", pName(playerid));
  4258. SendClientMessage(id, COLOR_YELLOW, string);
  4259. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4260. SendClientMessage(playerid, COLOR_YELLOW, string);
  4261. SetPlayerColor(id, COLOR_WHITE);
  4262. DeletePVar(playerid, "_Colors_");
  4263. }
  4264. case 2:
  4265. {
  4266. format(string, sizeof(string), "Administrator %s has set your name color to Red", pName(playerid));
  4267. SendClientMessage(id, COLOR_YELLOW, string);
  4268. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4269. SendClientMessage(playerid, COLOR_YELLOW, string);
  4270. SetPlayerColor(id, COLOR_RED);
  4271. DeletePVar(playerid, "_Colors_");
  4272. }
  4273. case 3:
  4274. {
  4275. format(string, sizeof(string), "Administrator %s has set your name color to Orange", pName(playerid));
  4276. SendClientMessage(id, COLOR_YELLOW, string);
  4277. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4278. SendClientMessage(playerid, COLOR_YELLOW, string);
  4279. SetPlayerColor(id, COLOR_ORANGE);
  4280. DeletePVar(playerid, "_Colors_");
  4281. }
  4282. case 4:
  4283. {
  4284. format(string, sizeof(string), "Administrator %s has set your name color to Yellow", pName(playerid));
  4285. SendClientMessage(id, COLOR_YELLOW, string);
  4286. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4287. SendClientMessage(playerid, COLOR_YELLOW, string);
  4288. SetPlayerColor(id, COLOR_YELLOW);
  4289. DeletePVar(playerid, "_Colors_");
  4290. }
  4291. case 5:
  4292. {
  4293. format(string, sizeof(string), "Administrator %s has set your name color to Green", pName(playerid));
  4294. SendClientMessage(id, COLOR_YELLOW, string);
  4295. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4296. SendClientMessage(playerid, COLOR_YELLOW, string);
  4297. SetPlayerColor(id, COLOR_GREEN);
  4298. DeletePVar(playerid, "_Colors_");
  4299. }
  4300. case 6:
  4301. {
  4302. format(string, sizeof(string), "Administrator %s has set your name color to Blue", pName(playerid));
  4303. SendClientMessage(id, COLOR_YELLOW, string);
  4304. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4305. SendClientMessage(playerid, COLOR_YELLOW, string);
  4306. SetPlayerColor(id, COLOR_BLUE);
  4307. DeletePVar(playerid, "_Colors_");
  4308. }
  4309. case 7:
  4310. {
  4311. format(string, sizeof(string), "Administrator %s has set your name color to Purple", pName(playerid));
  4312. SendClientMessage(id, COLOR_YELLOW, string);
  4313. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4314. SendClientMessage(playerid, COLOR_YELLOW, string);
  4315. SetPlayerColor(id, COLOR_PURPLE);
  4316. DeletePVar(playerid, "_Colors_");
  4317. }
  4318. case 8:
  4319. {
  4320. format(string, sizeof(string), "Administrator %s has set your name color to Brown", pName(playerid));
  4321. SendClientMessage(id, COLOR_YELLOW, string);
  4322. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4323. SendClientMessage(playerid, COLOR_YELLOW, string);
  4324. SetPlayerColor(id, COLOR_BROWN);
  4325. DeletePVar(playerid, "_Colors_");
  4326. }
  4327. case 9:
  4328. {
  4329. format(string, sizeof(string), "Administrator %s has set your name color to Pink", pName(playerid));
  4330. SendClientMessage(id, COLOR_YELLOW, string);
  4331. format(string, sizeof(string), "Color Name for Player %s has been set.", pName(id));
  4332. SendClientMessage(playerid, COLOR_YELLOW, string);
  4333. SetPlayerColor(id, COLOR_PINK);
  4334. DeletePVar(playerid, "_Colors_");
  4335. }
  4336. }
  4337. }
  4338. }
  4339. }
  4340. }
  4341. return 1;
  4342. }
  4343.  
  4344. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  4345. {
  4346. new string[128+50];
  4347.  
  4348. format(string, sizeof(string), "You are now viewing '%s' statistics.", pName(clickedplayerid));
  4349. SendClientMessage(playerid, COLOR_YELLOW, string);
  4350.  
  4351. ShowStatistics(playerid, clickedplayerid);
  4352. return 1;
  4353. }
  4354.  
  4355. //============================================================================//
  4356.  
  4357. //Stock and functions starts here.
  4358.  
  4359. stock pName(playerid)
  4360. {
  4361. new GetName[24];
  4362. GetPlayerName(playerid, GetName, 24);
  4363. return GetName;
  4364. }
  4365.  
  4366. function:ShowStatistics(playerid, playerid2)
  4367. {
  4368. if(playerid2 == INVALID_PLAYER_ID) return 1; //Do not proceed.
  4369.  
  4370. new string[1000], string2[256];
  4371.  
  4372. format(string2, 256, ""white"•••••• Player Statistics for %s (%d) ••••••\n\n", pName(playerid2), playerid2);
  4373. strcat(string, string2);
  4374. strcat(string, ""grey"");
  4375. format(string2, 556, "UserID [ %d ]\n", User[playerid2][accountID]); strcat(string, string2);
  4376. format(string2, 556, "Registered [ %s ]\n", User[playerid2][accountDate]); strcat(string, string2);
  4377. format(string2, 556, "Playing Hours [ %02d:%02d:%02d ]\n", User[playerid2][accountGame][2], User[playerid2][accountGame][1], User[playerid2][accountGame][0]); strcat(string, string2);
  4378. format(string2, 556, "Admin Level [ %d ]\n", User[playerid2][accountAdmin]); strcat(string, string2);
  4379. format(string2, 556, "Score [ %d ]\n", User[playerid2][accountScore]); strcat(string, string2);
  4380. format(string2, 556, "Cash [ $%d ]\n", User[playerid2][accountCash]); strcat(string, string2);
  4381. format(string2, 556, "Kills [ %d ]\n", User[playerid2][accountKills]); strcat(string, string2);
  4382. format(string2, 556, "Deaths [ %d ]\n", User[playerid2][accountDeaths]); strcat(string, string2);
  4383. new Float:ratio = (float(User[playerid2][accountKills])/float(User[playerid2][accountDeaths]));
  4384. format(string2, 556, "Ratio (K/D) [ %.3f ]", ratio); strcat(string, string2);
  4385. format(string2, 256, "\n\n"white"•••••• Player Statistics for %s (%d) ••••••", pName(playerid2), playerid2);
  4386. strcat(string, string2);
  4387.  
  4388. format(string2, 556, "%s", pName(playerid2));
  4389. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, string2, string, "Close", "");
  4390. return 1;
  4391. }
  4392.  
  4393. function:KickMe(playerid)
  4394. {
  4395. return Kick(playerid);
  4396. }
  4397.  
  4398. stock KickDelay(playerid)
  4399. {
  4400. SetTimerEx("KickMe", 2000, false, "d", playerid);
  4401. return 1;
  4402. }
  4403.  
  4404. stock loadb()
  4405. {
  4406. Database = db_open(_DB_);
  4407. db_query(Database,
  4408. "CREATE TABLE IF NOT EXISTS `users`\
  4409. (`userid` INTEGER PRIMARY KEY AUTOINCREMENT, `username` TEXT, `IP` TEXT, `joindate` TEXT, `password` TEXT, `admin` NUMERIC, `kills` NUMERIC, `deaths` NUMERIC, `score` NUMERIC, `money` NUMERIC, `warn` NUMERIC, `mute` NUMERIC, `mutesec` NUMERIC, `cmute` NUMERIC, `cmutesec` NUMERIC, `jail` NUMERIC, `jailsec` NUMERIC, `hours` NUMERIC, `minutes` NUMERIC, `seconds` NUMERIC, `question` TEXT, `answer` TEXT, `vip` NUMERIC)");
  4410.  
  4411. db_query(Database,
  4412. "CREATE TABLE IF NOT EXISTS `bans` (`username` TEXT, `ip` TEXT, `banby` TEXT, `banreason` TEXT, `banwhen` TEXT)");
  4413.  
  4414. print("[JakAdmin3] "_DB_" loading...");
  4415. return 1;
  4416. }
  4417. stock closedb()
  4418. {
  4419. print("[JakAdmin3] "_DB_" closing...");
  4420. return db_close(Database);
  4421. }
  4422.  
  4423. stock SaveData(playerid)
  4424. {
  4425. new
  4426. Query[700+1000]
  4427. ;
  4428.  
  4429. format(Query, sizeof(Query), "UPDATE `users` SET `IP` = '%s', `admin` = %d, `kills` = %d, `deaths` = %d, `score` = %d, `money` = %d, `warn` = %d, `mute` = %d, `mutesec` = %d, `cmute` = %d, `cmutesec` = %d, `jail` = %d, `jailsec` = %d, `hours` = %d, `minutes` = %d, `seconds` = %d, `question` = '%s', `answer` = '%s' WHERE `username` = '%s'",
  4430. DB_Escape(User[playerid][accountIP]),
  4431. User[playerid][accountAdmin],
  4432. User[playerid][accountKills],
  4433. User[playerid][accountDeaths],
  4434. User[playerid][accountScore],
  4435. User[playerid][accountCash],
  4436. User[playerid][accountWarn],
  4437. User[playerid][accountMuted],
  4438. User[playerid][accountMuteSec],
  4439. User[playerid][accountCMuted],
  4440. User[playerid][accountCMuteSec],
  4441. User[playerid][accountJail],
  4442. User[playerid][accountJailSec],
  4443. User[playerid][accountGame][2],
  4444. User[playerid][accountGame][1],
  4445. User[playerid][accountGame][0],
  4446. DB_Escape(User[playerid][accountQuestion]),
  4447. DB_Escape(User[playerid][accountAnswer]),
  4448. DB_Escape(User[playerid][accountName])
  4449. );
  4450. db_query(Database, Query);
  4451. db_free_result(db_query(Database, Query));
  4452. return 1;
  4453. }
  4454.  
  4455. stock getIP(playerid)
  4456. {
  4457. new twerp[20];
  4458. GetPlayerIp(playerid, twerp, 20);
  4459. return twerp;
  4460. }
  4461.  
  4462. stock isnumeric(const string[])
  4463. {
  4464. for (new i = 0, j = strlen(string); i < j; i++)
  4465. {
  4466. if (string[i] > '9' || string[i] < '0') return 0;
  4467. }
  4468. return 1;
  4469. }
  4470.  
  4471. stock GetWeaponIDFromName(WeaponName[])
  4472. {
  4473. if(strfind("molotov", WeaponName, true) != -1) return 18;
  4474. for(new i = 0; i <= 46; i++)
  4475. {
  4476. switch(i)
  4477. {
  4478. case 0,19,20,21,44,45: continue;
  4479. default:
  4480. {
  4481. new name[32]; GetWeaponName(i,name,32);
  4482. if(strfind(name,WeaponName,true) != -1) return i;
  4483. }
  4484. }
  4485. }
  4486. return -1;
  4487. }
  4488.  
  4489. function:LoginPlayer(playerid)
  4490. {
  4491. new
  4492. Query[900],
  4493. DBResult:Result,
  4494. string[128+40]
  4495. ;
  4496. format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s'", DB_Escape(pName(playerid)));
  4497. Result = db_query(Database, Query);
  4498. if(db_num_rows(Result))
  4499. {
  4500. db_get_field_assoc(Result, "userid", Query, 7);
  4501. User[playerid][accountID] = strval(Query);
  4502.  
  4503. db_get_field_assoc(Result, "score", Query, 20);
  4504. User[playerid][accountScore] = strval(Query);
  4505. SetPlayerScore(playerid, User[playerid][accountScore]);
  4506.  
  4507. db_get_field_assoc(Result, "money", Query, 20);
  4508. User[playerid][accountCash] = strval(Query);
  4509. GivePlayerMoney(playerid, User[playerid][accountCash]);
  4510.  
  4511. db_get_field_assoc(Result, "kills", Query, 20);
  4512. User[playerid][accountKills] = strval(Query);
  4513.  
  4514. db_get_field_assoc(Result, "deaths", Query, 20);
  4515. User[playerid][accountDeaths] = strval(Query);
  4516.  
  4517. db_get_field_assoc(Result, "admin", Query, 7);
  4518. User[playerid][accountAdmin] = strval(Query);
  4519.  
  4520. db_get_field_assoc(Result, "joindate", Query, 150);
  4521. format(User[playerid][accountDate], 150, "%s", Query);
  4522.  
  4523. db_get_field_assoc(Result, "warn", Query, 5);
  4524. User[playerid][accountWarn] = strval(Query);
  4525.  
  4526. db_get_field_assoc(Result, "mute", Query, 5);
  4527. User[playerid][accountMuted] = strval(Query);
  4528.  
  4529. db_get_field_assoc(Result, "mutesec", Query, 8);
  4530. User[playerid][accountMuteSec] = strval(Query);
  4531.  
  4532. db_get_field_assoc(Result, "cmute", Query, 6);
  4533. User[playerid][accountCMuted] = strval(Query);
  4534.  
  4535. db_get_field_assoc(Result, "cmutesec", Query, 9);
  4536. User[playerid][accountCMuteSec] = strval(Query);
  4537.  
  4538. db_get_field_assoc(Result, "jail", Query, 5);
  4539. User[playerid][accountJail] = strval(Query);
  4540.  
  4541. db_get_field_assoc(Result, "jailsec", Query, 8);
  4542. User[playerid][accountJailSec] = strval(Query);
  4543.  
  4544. db_get_field_assoc(Result, "hours", Query, 6);
  4545. User[playerid][accountGame][2] = strval(Query);
  4546.  
  4547. db_get_field_assoc(Result, "minutes", Query, 8);
  4548. User[playerid][accountGame][1] = strval(Query);
  4549.  
  4550. db_get_field_assoc(Result, "seconds", Query, 8);
  4551. User[playerid][accountGame][0] = strval(Query);
  4552.  
  4553. #if VipSystem == true
  4554. db_get_field_assoc(Result, "vip", Query, 2);
  4555. accountVip[playerid] = strval(Query);
  4556. #endif
  4557.  
  4558. User[playerid][accountLogged] = true;
  4559.  
  4560. if(User[playerid][accountMuted] == 1)
  4561. {
  4562. format(string, 200, "PUNISHMENT: You have been muted from using the chat for %d seconds, You are muted the last time you logged out.", User[playerid][accountMuteSec]);
  4563. SendClientMessage(playerid, COLOR_RED, string);
  4564. }
  4565. if(User[playerid][accountCMuted] == 1)
  4566. {
  4567. format(string, 200, "PUNISHMENT: You have been muted from using the commands for %d seconds, You are muted the last time you logged out.", User[playerid][accountCMuteSec]);
  4568. SendClientMessage(playerid, COLOR_RED, string);
  4569. }
  4570.  
  4571. SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You have successfully logged in to the server.");
  4572. if(User[playerid][accountAdmin] >= 1)
  4573. {
  4574. SendClientMessage(playerid, -1, "You have logged into your administrative account, Good luck doing your duties.");
  4575. }
  4576. #if VipSystem == true
  4577. if(accountVip[playerid] >= 1)
  4578. {
  4579. SendClientMessage(playerid, COLOR_GREEN, "You have logged into your VIP account.");
  4580. }
  4581. #endif
  4582.  
  4583. PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  4584. }
  4585. db_free_result(Result);
  4586. return 1;
  4587. }
  4588.  
  4589. function:IsValidPassword( const password[ ] )
  4590. {
  4591. for( new i = 0; password[ i ] != EOS; ++i )
  4592. {
  4593. switch( password[ i ] )
  4594. {
  4595. case '0'..'9', 'A'..'Z', 'a'..'z': continue;
  4596. default: return 0;
  4597. }
  4598. }
  4599. return 1;
  4600. }
  4601.  
  4602. stock DB_Escape(text[])
  4603. {
  4604. new
  4605. ret[80* 2],
  4606. ch,
  4607. i,
  4608. j;
  4609. while ((ch = text[i++]) && j < sizeof (ret))
  4610. {
  4611. if (ch == '\'')
  4612. {
  4613. if (j < sizeof (ret) - 2)
  4614. {
  4615. ret[j++] = '\'';
  4616. ret[j++] = '\'';
  4617. }
  4618. }
  4619. else if (j < sizeof (ret))
  4620. {
  4621. ret[j++] = ch;
  4622. }
  4623. else
  4624. {
  4625. j++;
  4626. }
  4627. }
  4628. ret[sizeof (ret) - 1] = '\0';
  4629. return ret;
  4630. }
  4631.  
  4632. stock ShowBan(playerid, admin[] = "JakAdmin3", reason[] = "69 Sex", when[] = "01/01/1970 00:00:00")
  4633. {
  4634. new string[256], string2[1500];
  4635.  
  4636. for(new i=0; i<100; i++)
  4637. {
  4638. SendClientMessage(playerid, -1, " ");
  4639. }
  4640.  
  4641. format(string, 256, "You're banned from server by %s for the following reasons:", admin);
  4642. SendClientMessage(playerid, COLOR_RED, string);
  4643. format(string, 256, "(( %s ))", reason);
  4644. SendClientMessage(playerid, -1, string);
  4645.  
  4646. strcat(string2, ""grey"");
  4647. strcat(string2, "You are banned from this server, Statistics of your ban:\n\n");
  4648. format(string, 256, ""white"Name: "red"%s\n", pName(playerid));
  4649. strcat(string2, string);
  4650. format(string, 256, ""white"Banned By: "red"%s\n", admin);
  4651. strcat(string2, string);
  4652. format(string, 256, ""white"Reason: "red"%s\n", reason);
  4653. strcat(string2, string);
  4654. format(string, 256, ""white"IP: "red"%s\n", User[playerid][accountIP]);
  4655. strcat(string2, string);
  4656. format(string, 256, ""white"Banned since: "red"%s\n\n", when);
  4657. strcat(string2, string);
  4658. strcat(string2, ""grey"");
  4659. strcat(string2, "If you think this is a bugged, false ban or the admin abused his/her power, Please place a ban appeal on forums.\n");
  4660. strcat(string2, "Make sure to take a picture of this by pressing F8, Do not lie on your appeal.");
  4661.  
  4662. ShowPlayerDialog(playerid, DIALOG_BEGIN, DIALOG_STYLE_MSGBOX, ""red"You are banned from this server.", string2, "Close", "");
  4663. return 1;
  4664. }
  4665.  
  4666. stock BanAccountEx(name[], ip[], admin[] = "Anticheat", reason[] = "None")
  4667. {
  4668. new
  4669. Query[500],
  4670. DBResult:result,
  4671. ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[128]
  4672. ;
  4673.  
  4674. gettime(ban_hr, ban_min, ban_sec);
  4675. getdate(ban_years, ban_month, ban_days);
  4676.  
  4677. format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
  4678.  
  4679. format(Query, 500, "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`) VALUES ('%s', '%s', '%s', '%s', '%s')", DB_Escape(name), DB_Escape(ip), DB_Escape(admin), DB_Escape(reason), DB_Escape(when));
  4680. result = db_query(Database, Query);
  4681.  
  4682. db_free_result(result);
  4683. return 1;
  4684. }
  4685.  
  4686. stock BanAccount(playerid, admin[] = "Anticheat", reason[] = "None")
  4687. {
  4688. new
  4689. Query[500],
  4690. DBResult:result,
  4691. ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years, when[128]
  4692. ;
  4693.  
  4694. gettime(ban_hr, ban_min, ban_sec);
  4695. getdate(ban_years, ban_month, ban_days);
  4696.  
  4697. format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);
  4698.  
  4699. format(Query, 500, "INSERT INTO `bans` (`username`, `ip`, `banby`, `banreason`, `banwhen`) VALUES ('%s', '%s', '%s', '%s', '%s')", DB_Escape(pName(playerid)), DB_Escape(User[playerid][accountIP]), DB_Escape(admin), DB_Escape(reason), DB_Escape(when));
  4700. result = db_query(Database, Query);
  4701.  
  4702. db_free_result(result);
  4703. return 1;
  4704. }
  4705.  
  4706. function:IsValidWeapon(weaponid)
  4707. {
  4708. if (weaponid > 0 && weaponid < 19 || weaponid > 21 && weaponid < 47) return 1;
  4709. return 0;
  4710. }
  4711.  
  4712. function:SaveLog(filename[], text[])
  4713. {
  4714. #if LOG == true
  4715.  
  4716. new string[256];
  4717.  
  4718. if(!fexist(_LOG_))
  4719. {
  4720. printf("[JakAdmin3] Unable to overwrite '%s' at the '%s', '%s' missing.", filename, _LOG_, _LOG_);
  4721. print("No logs has been saved to your server database.");
  4722.  
  4723. format(string, sizeof string, "JakAdmin3 has attempted to overwrite '%s' at the '%s' which is missing.", filename, _LOG_);
  4724. SendAdmin(COLOR_RED, string);
  4725. SendAdmin(-1, "No logs has been saved to the server database, Check the console for further solution.");
  4726. return 0;
  4727. }
  4728.  
  4729. new File:file,
  4730. filepath[128+40]
  4731. ;
  4732.  
  4733. new year, month, day;
  4734. new hour, minute, second;
  4735.  
  4736. getdate(year, month, day);
  4737. gettime(hour, minute, second);
  4738. format(filepath, sizeof(filepath), ""_LOG_"%s", filename);
  4739. file = fopen(filepath, io_append);
  4740. format(string, sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n", month, day, year, hour, minute, second, text);
  4741. fwrite(file, string);
  4742. fclose(file);
  4743. #endif
  4744. return 1;
  4745. }
  4746.  
  4747. stock VehicleOccupied(vehicleid)
  4748. {
  4749. for(new i = 0; i < MAX_PLAYERS; i++)
  4750. {
  4751. if(IsPlayerInVehicle(i, vehicleid)) return 1;
  4752. }
  4753. return 0;
  4754. }
  4755.  
  4756. stock DataExist(name[])
  4757. {
  4758. new Buffer[180],
  4759. Entry,
  4760. DBResult:Result
  4761. ;
  4762.  
  4763. format(Buffer, sizeof(Buffer), "SELECT `userid` FROM `users` WHERE `username` = '%s'", name);
  4764. Result = db_query(Database, Buffer);
  4765.  
  4766. if(Result)
  4767. {
  4768. if(db_num_rows(Result))
  4769. {
  4770. Entry = 1;
  4771. db_free_result(Result);
  4772. }
  4773. else Entry = 0;
  4774. }
  4775. return Entry;
  4776. }
  4777.  
  4778. stock SendAdmin(color, string[])
  4779. {
  4780. foreach(new i : Player)
  4781. {
  4782. if(User[i][accountAdmin] >= 1)
  4783. {
  4784. SendClientMessage(i, color, string);
  4785. }
  4786. }
  4787. }
  4788.  
  4789. #if ANTI_SWEAR == true
  4790. stock Cenzura(string[], words[], destch = '*')
  4791. {
  4792. new start_index = (-1),
  4793. end_index = (-1);
  4794.  
  4795. start_index = strfind(string, words, true);
  4796. if(start_index == (-1)) return false;
  4797. end_index = (start_index+strlen(words));
  4798.  
  4799. for( ; start_index < end_index; start_index++)
  4800. string[start_index] = destch;
  4801. return true;
  4802. }
  4803. #endif
  4804.  
  4805. stock StartSpectate(playerid, specplayerid)
  4806. {
  4807. foreach(new x : Player)
  4808. {
  4809. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] == playerid)
  4810. {
  4811. AdvanceSpectate(x);
  4812. }
  4813. }
  4814. SetPlayerInterior(playerid, GetPlayerInterior(specplayerid));
  4815. TogglePlayerSpectating(playerid, 1);
  4816.  
  4817. if(IsPlayerInAnyVehicle(specplayerid))
  4818. {
  4819. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
  4820. User[playerid][SpecID] = specplayerid;
  4821. User[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
  4822. }
  4823. else
  4824. {
  4825. PlayerSpectatePlayer(playerid, specplayerid);
  4826. User[playerid][SpecID] = specplayerid;
  4827. User[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
  4828. }
  4829. return 1;
  4830. }
  4831.  
  4832. stock StopSpectate(playerid)
  4833. {
  4834. TogglePlayerSpectating(playerid, 0);
  4835. User[playerid][SpecID] = INVALID_PLAYER_ID;
  4836. User[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
  4837. GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
  4838. return 1;
  4839. }
  4840.  
  4841. stock AdvanceSpectate(playerid)
  4842. {
  4843. if(Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; }
  4844. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
  4845. {
  4846. for(new x=User[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
  4847. {
  4848. if(x == MAX_PLAYERS) x = 0;
  4849. if(IsPlayerConnected(x) && x != playerid)
  4850. {
  4851. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
  4852. {
  4853. continue;
  4854. }
  4855. else
  4856. {
  4857. StartSpectate(playerid, x);
  4858. break;
  4859. }
  4860. }
  4861. }
  4862. }
  4863. return 1;
  4864. }
  4865.  
  4866. stock ReverseSpectate(playerid)
  4867. {
  4868. if(Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; }
  4869. if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
  4870. {
  4871. for(new x=User[playerid][SpecID]-1; x>=0; x--)
  4872. {
  4873. if(x == 0) x = MAX_PLAYERS;
  4874. if(IsPlayerConnected(x) && x != playerid)
  4875. {
  4876. if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
  4877. {
  4878. continue;
  4879. }
  4880. else
  4881. {
  4882. StartSpectate(playerid, x);
  4883. break;
  4884. }
  4885. }
  4886. }
  4887. }
  4888. return 1;
  4889. }
  4890.  
  4891. stock GetVehicleModelIDFromName(vname[])
  4892. {
  4893. for(new i = 0; i < 211; i++)
  4894. {
  4895. if ( strfind(VehicleNames[i], vname, true) != -1 )
  4896. return i + 400;
  4897. }
  4898. return -1;
  4899. }
  4900.  
  4901. function:EraseVeh(vehicleid)
  4902. {
  4903. foreach(new i : Player)
  4904. {
  4905. new Float:X, Float:Y, Float:Z;
  4906. if(IsPlayerInVehicle(i, vehicleid))
  4907. {
  4908. RemovePlayerFromVehicle(i);
  4909. GetPlayerPos(i, X, Y, Z);
  4910. SetPlayerPos(i, X, Y+3, Z);
  4911. }
  4912. SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
  4913. }
  4914. SetTimerEx("VehRes", 1500, 0, "i", vehicleid);
  4915. }
  4916.  
  4917. function:DelVehicle(vehicleid)
  4918. {
  4919. foreach(new players : Player)
  4920. {
  4921. new Float:X, Float:Y, Float:Z;
  4922. if(IsPlayerInVehicle(players, vehicleid))
  4923. {
  4924. GetPlayerPos(players, X, Y, Z);
  4925. SetPlayerPos(players, X, Y, Z+2);
  4926. SetVehicleToRespawn(vehicleid);
  4927. }
  4928. SetVehicleParamsForPlayer(vehicleid, players, 0, 1);
  4929. }
  4930. SetTimerEx("VehRes", 3000, 0, "d", vehicleid);
  4931. return 1;
  4932. }
  4933.  
  4934. stock Config()
  4935. {
  4936. print("\n");
  4937.  
  4938. /*
  4939. Don't blame me, Can't find a nice solution of detecting it, So i will do it
  4940. on my own way - I will find a proper code to optimize this on the next
  4941. version.
  4942. */
  4943.  
  4944. new
  4945. log,
  4946. autolog,
  4947. dialog,
  4948. readcmd,
  4949. maxping,
  4950. antiswear,
  4951. antiname,
  4952. antispawn,
  4953. antiad,
  4954. rconpass,
  4955. antispam,
  4956. on[3] ="ON",
  4957. off[4] = "OFF"
  4958. ;
  4959.  
  4960. log = 0; autolog = 0; dialog = 0; readcmd = 0; maxping = 0; antiswear = 0;
  4961. antiname = 0; antispawn = 0; antiad =0; rconpass=0; antispam = 0; vipsys = 0;
  4962.  
  4963. #if LOG == true
  4964. log = 1;
  4965. #endif
  4966.  
  4967. #if AUTO_LOGIN == true
  4968. autolog = 1;
  4969. #endif
  4970.  
  4971. #if REGISTER_DIALOG == true
  4972. dialog = 1;
  4973. #endif
  4974.  
  4975. #if READ_COMMANDS == true
  4976. readcmd = 1;
  4977. #endif
  4978.  
  4979. #if MAX_PING == true
  4980. maxping = 1;
  4981. #endif
  4982.  
  4983. #if ANTI_SWEAR == true
  4984. antiswear = 1;
  4985. #endif
  4986.  
  4987. #if ANTI_NAME == true
  4988. antiname = 1;
  4989. #endif
  4990.  
  4991. #if ANTI_SPAWN == true
  4992. antispawn = 1;
  4993. #endif
  4994.  
  4995. #if ANTI_AD == true
  4996. antiad = 1;
  4997. #endif
  4998.  
  4999. #if RconProtect == true
  5000. rconpass = 1;
  5001. #endif
  5002.  
  5003. #if AntiSpam == true
  5004. antispam = 1;
  5005. #endif
  5006.  
  5007. #if VipSystem == true
  5008. vipsys = 1;
  5009. #endif
  5010.  
  5011. print("***** JakAdmin 3.4 Configuration *****");
  5012. printf("LogSaving: %s, AutoLogin: %s, Dialog: %s, ReadCommands: %s, MaxPing: %s", log ? on : off, autolog ? on : off, dialog ? on : off, readcmd ? on : off, maxping ? on : off);
  5013. printf("AntiSwear: %s, AntiName: %s, AntiSpawn: %s, AntiAd: %s, RCONProtect: %s", antiswear ? on : off, antiname ? on : off, antispawn ? on : off, antiad ? on : off, rconpass ? on : off);
  5014. printf("AntiSpam: %s, VIP System: %s", antispam ? on : off, vipsys ? on : off);
  5015.  
  5016. #if MAX_PING == true
  5017. printf("MaxPing Limit: %d", PING_EXCEED);
  5018. #endif
  5019.  
  5020. print("***** JakAdmin 3.4 Configuration *****");
  5021. }
  5022.  
  5023. function:VehRes(vehicleid)
  5024. {
  5025. DestroyVehicle(vehicleid);
  5026. }
  5027.  
  5028. stock TimeStamp()
  5029. {
  5030. new time = GetTickCount() / 1000;
  5031. return time;
  5032. }
  5033.  
  5034. function:checkfolderEx()
  5035. {
  5036. if(!fexist("JakAdmin3/"))
  5037. {
  5038. return 0;
  5039. }
  5040. if(!fexist("JakAdmin3/Logs/"))
  5041. {
  5042. return 0;
  5043. }
  5044. return 1;
  5045. }
  5046.  
  5047. function:checkfolder()
  5048. {
  5049. if(!fexist("JakAdmin3/"))
  5050. {
  5051. print("\n[JakAdmin3]: JakAdmin3 folder doesn't exist in scriptfiles, JakAdmin3 won't start.");
  5052. print("Solution: Create the folder JakAdmin3 on the scriptfiles.");
  5053. print("Continusly using the script with the missing file will not save the target script objective.\n");
  5054. return 0;
  5055. }
  5056. if(!fexist("JakAdmin3/Logs/"))
  5057. {
  5058. print("\n[JakAdmin3]: Logs folder doesn't exist in JakAdmin3 folder, JakAdmin3 won't start.");
  5059. print("Solution: Create the folder Logs on the JakAdmin3 folder.");
  5060. print("Continusly using the script with the missing file will not save the target script objective.\n");
  5061. return 0;
  5062. }
  5063. return 1;
  5064. }
  5065.  
  5066. function:PosAfterSpec(playerid)
  5067. {
  5068. SetPlayerPos(playerid, SpecPos[playerid][0], SpecPos[playerid][1], SpecPos[playerid][2]);
  5069. SetPlayerFacingAngle(playerid, SpecPos[playerid][3]);
  5070. SetPlayerInterior(playerid, SpecInt[playerid][0]);
  5071. SetPlayerVirtualWorld(playerid, SpecInt[playerid][1]);
  5072. }
  5073.  
  5074. /////////////////////////////// INCLUDE SUPPORT ////////////////////////////////
  5075.  
  5076. function:vip_check()
  5077. {
  5078. // Checks if the VIP system is disabled or enabled
  5079. return vipsys;
  5080. }
  5081.  
  5082. #if VipSystem == true
  5083. function:check_vip(playerid)
  5084. {
  5085. // Checks the VIP level of the player
  5086. return accountVip[playerid];
  5087. }
  5088.  
  5089. function:set_vip(playerid, level)
  5090. {
  5091. // Sets the VIP level of the player
  5092. accountVip[playerid] = level;
  5093. return 1;
  5094. }
  5095. #endif
  5096.  
  5097. function:save_player(playerid)
  5098. {
  5099. return SaveData(playerid);
  5100. }
  5101.  
  5102. function:check_admin(playerid)
  5103. {
  5104. // Checks the admin level of the player
  5105. return User[playerid][accountAdmin];
  5106. }
  5107.  
  5108. function:set_admin(playerid, level)
  5109. {
  5110. // Sets the admin level of the player
  5111. User[playerid][accountAdmin] = level;
  5112. return 1;
  5113. }
  5114.  
  5115. function:check_login(playerid)
  5116. {
  5117. // Checks if the player is logged in or not
  5118. return User[playerid][accountLogged];
  5119. }
  5120.  
  5121. function:set_log(playerid, toggle)
  5122. {
  5123. // Sets the accountLogged to toggle
  5124. if(toggle == 0)
  5125. {
  5126. User[playerid][accountLogged] = 0;
  5127. }
  5128. else if(toggle >= 1)
  5129. {
  5130. User[playerid][accountLogged] = 1;
  5131. }
  5132. return 1;
  5133. }
  5134.  
  5135. function:check_mute(playerid)
  5136. {
  5137. // Check if the player is muted or not
  5138. return User[playerid][accountMuted];
  5139. }
  5140.  
  5141. function:check_mutesec(playerid)
  5142. {
  5143. // Check the player's mute seconds if there is any
  5144. return User[playerid][accountMuteSec];
  5145. }
  5146.  
  5147. function:check_cmute(playerid)
  5148. {
  5149. // Check if the player is muted or not
  5150. return User[playerid][accountCMuted];
  5151. }
  5152.  
  5153. function:check_cmutesec(playerid)
  5154. {
  5155. // Check the player's mute seconds if there is any
  5156. return User[playerid][accountCMuteSec];
  5157. }
  5158.  
  5159. function:set_mute(playerid, toggle)
  5160. {
  5161. // Set the player's mute status
  5162. User[playerid][accountMuted] = toggle;
  5163. return 1;
  5164. }
  5165.  
  5166. function:set_mutesec(playerid, sec)
  5167. {
  5168. // Set the player's mute seconds
  5169. User[playerid][accountMuteSec] = sec;
  5170. return 1;
  5171. }
  5172.  
  5173. function:set_cmute(playerid, toggle)
  5174. {
  5175. // Set the player's command mute status
  5176. User[playerid][accountCMuted] = toggle;
  5177. return 1;
  5178. }
  5179.  
  5180. function:set_cmutesec(playerid, sec)
  5181. {
  5182. // Set the player's command mute seconds
  5183. User[playerid][accountCMuteSec] = sec;
  5184. return 1;
  5185. }
  5186.  
  5187. function:check_jail(playerid)
  5188. {
  5189. // Check the player's jail status
  5190. return User[playerid][accountJail];
  5191. }
  5192.  
  5193. function:check_jailsec(playerid)
  5194. {
  5195. // Check the player's jail seconds if there is any
  5196. return User[playerid][accountJailSec];
  5197. }
  5198.  
  5199. function:set_jail(playerid, toggle)
  5200. {
  5201. // Set the player's jail status
  5202. User[playerid][accountJail] = toggle;
  5203. return 1;
  5204. }
  5205.  
  5206. function:set_jailsec(playerid, sec)
  5207. {
  5208. // Set the player's jail seconds
  5209. User[playerid][accountJailSec] = sec;
  5210. return 1;
  5211. }
  5212.  
  5213. function:check_id(playerid)
  5214. {
  5215. return User[playerid][accountID];
  5216. }
  5217.  
  5218. function:check_warn(playerid)
  5219. {
  5220. // Check how many warns do the player got
  5221. return User[playerid][accountWarn];
  5222. }
  5223.  
  5224. function:set_warn(playerid, warn)
  5225. {
  5226. // Sets how many warns to the player
  5227. User[playerid][accountWarn] = warn;
  5228. return 1;
  5229. }
  5230.  
  5231. function:check_kills(playerid)
  5232. {
  5233. // Check how many kills do the player got
  5234. return User[playerid][accountKills];
  5235. }
  5236.  
  5237. function:set_kill(playerid, kill)
  5238. {
  5239. // Sets how many kills to the player
  5240. User[playerid][accountKills] = kill;
  5241. return 1;
  5242. }
  5243.  
  5244. function:check_deaths(playerid)
  5245. {
  5246. // Check how many deaths do the player got
  5247. return User[playerid][accountDeaths];
  5248. }
  5249.  
  5250. function:set_death(playerid, death)
  5251. {
  5252. // Sets how many deaths to the player
  5253. User[playerid][accountDeaths] = death;
  5254. return 1;
  5255. }
  5256. strtok(const string[], &index)
  5257. {
  5258. new length = strlen(string);
  5259. while ((index < length) && (string[index] <= ' '))
  5260. {
  5261. index++;
  5262. }
  5263.  
  5264. new offset = index;
  5265. new result[20];
  5266. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  5267. {
  5268. result[index - offset] = string[index];
  5269. index++;
  5270. }
  5271. result[index - offset] = EOS;
  5272. return result;
  5273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement