Advertisement
Guest User

Untitled

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