Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 104.01 KB | None | 0 0
  1. /*x---------------------------------Important-------------------------------------x*/
  2. //**INCLUDES**//
  3. #include <a_samp>
  4. #include <md5>
  5. //**MISC**//
  6. #pragma tabsize 0
  7. //**FORWARD**//
  8. forward OnPlayerPrivmsg(playerid, recieverid, text[]);
  9. /*x---------------------------------Defining-------------------------------------x*/
  10. //**COLORS*//
  11. #define GREEN 0x21DD00FF
  12. #define RED 0xE60000FF
  13. #define ADMIN_RED 0xFB0000FF
  14. #define YELLOW 0xFFFF00FF
  15. #define ORANGE 0xF97804FF
  16. #define LIGHTRED 0xFF8080FF
  17. #define LIGHTBLUE 0x00C2ECFF
  18. #define PURPLE 0xB360FDFF
  19. #define BLUE 0x1229FAFF
  20. #define LIGHTGREEN 0x38FF06FF
  21. #define DARKPINK 0xE100E1FF
  22. #define DARKGREEN 0x008040FF
  23. #define AQUAGREEN 0x00CACAFB
  24. #define NICESKY 0x99FFFFAA
  25. #define GREY 0xCECECEFF
  26. #define WHITE 0xFFFFFFFF
  27. //**MISC**//
  28. #define LOGIN_BEFORE_SPAWN // If uncommented, players will have to login before spawning if their account exists. If commented, they can spawn without logging in.
  29. //#define ENABLE_AUTO_LOGIN // LEAVE IT COMMENTED(BUGGED) -- Allows you to auto-login when you connect if you had the same IP as previous login.
  30. //**VARIABLES**//
  31. enum Info
  32. {
  33. AdminLevel,
  34. Password[128],
  35. Cash,
  36. Warns,
  37. Jail,
  38. Logged,
  39. Mute,
  40. WarnReason1[128],
  41. WarnReason2[128],
  42. WarnReason3[128],
  43. Score,
  44. IP[20],
  45. };
  46.  
  47. new PlayerLevel[MAX_PLAYERS],LevelKills[MAX_PLAYERS],AdminSpawned[MAX_VEHICLES];
  48.  
  49. new ViewCommands[2][128] = // 2 = amount of commands to view
  50. {
  51. {"/admins"},
  52. {"/count"}
  53. };
  54. new VehNames[212][] = { // Vehicle Names - Betamaster
  55. {"Landstalker"},
  56. {"Bravura"},
  57. {"Buffalo"},
  58. {"Linerunner"},
  59. {"Perrenial"},
  60. {"Sentinel"},
  61. {"Dumper"},
  62. {"Firetruck"},
  63. {"Trashmaster"},
  64. {"Stretch"},
  65. {"Manana"},
  66. {"Infernus"},
  67. {"Voodoo"},
  68. {"Pony"},
  69. {"Mule"},
  70. {"Cheetah"},
  71. {"Ambulance"},
  72. {"Leviathan"},
  73. {"Moonbeam"},
  74. {"Esperanto"},
  75. {"Taxi"},
  76. {"Washington"},
  77. {"Bobcat"},
  78. {"Mr Whoopee"},
  79. {"BF Injection"},
  80. {"Hunter"},
  81. {"Premier"},
  82. {"Enforcer"},
  83. {"Securicar"},
  84. {"Banshee"},
  85. {"Predator"},
  86. {"Bus"},
  87. {"Rhino"},
  88. {"Barracks"},
  89. {"Hotknife"},
  90. {"Trailer 1"}, //artict1
  91. {"Previon"},
  92. {"Coach"},
  93. {"Cabbie"},
  94. {"Stallion"},
  95. {"Rumpo"},
  96. {"RC Bandit"},
  97. {"Romero"},
  98. {"Packer"},
  99. {"Monster"},
  100. {"Admiral"},
  101. {"Squalo"},
  102. {"Seasparrow"},
  103. {"Pizzaboy"},
  104. {"Tram"},
  105. {"Trailer 2"}, //artict2
  106. {"Turismo"},
  107. {"Speeder"},
  108. {"Reefer"},
  109. {"Tropic"},
  110. {"Flatbed"},
  111. {"Yankee"},
  112. {"Caddy"},
  113. {"Solair"},
  114. {"Berkley's RC Van"},
  115. {"Skimmer"},
  116. {"PCJ-600"},
  117. {"Faggio"},
  118. {"Freeway"},
  119. {"RC Baron"},
  120. {"RC Raider"},
  121. {"Glendale"},
  122. {"Oceanic"},
  123. {"Sanchez"},
  124. {"Sparrow"},
  125. {"Patriot"},
  126. {"Quad"},
  127. {"Coastguard"},
  128. {"Dinghy"},
  129. {"Hermes"},
  130. {"Sabre"},
  131. {"Rustler"},
  132. {"ZR-350"},
  133. {"Walton"},
  134. {"Regina"},
  135. {"Comet"},
  136. {"BMX"},
  137. {"Burrito"},
  138. {"Camper"},
  139. {"Marquis"},
  140. {"Baggage"},
  141. {"Dozer"},
  142. {"Maverick"},
  143. {"News Chopper"},
  144. {"Rancher"},
  145. {"FBI Rancher"},
  146. {"Virgo"},
  147. {"Greenwood"},
  148. {"Jetmax"},
  149. {"Hotring"},
  150. {"Sandking"},
  151. {"Blista Compact"},
  152. {"Police Maverick"},
  153. {"Boxville"},
  154. {"Benson"},
  155. {"Mesa"},
  156. {"RC Goblin"},
  157. {"Hotring Racer A"}, //hotrina
  158. {"Hotring Racer B"}, //hotrinb
  159. {"Bloodring Banger"},
  160. {"Rancher"},
  161. {"Super GT"},
  162. {"Elegant"},
  163. {"Journey"},
  164. {"Bike"},
  165. {"Mountain Bike"},
  166. {"Beagle"},
  167. {"Cropdust"},
  168. {"Stunt"},
  169. {"Tanker"}, //petro
  170. {"Roadtrain"},
  171. {"Nebula"},
  172. {"Majestic"},
  173. {"Buccaneer"},
  174. {"Shamal"},
  175. {"Hydra"},
  176. {"FCR-900"},
  177. {"NRG-500"},
  178. {"HPV1000"},
  179. {"Cement Truck"},
  180. {"Tow Truck"},
  181. {"Fortune"},
  182. {"Cadrona"},
  183. {"FBI Truck"},
  184. {"Willard"},
  185. {"Forklift"},
  186. {"Tractor"},
  187. {"Combine"},
  188. {"Feltzer"},
  189. {"Remington"},
  190. {"Slamvan"},
  191. {"Blade"},
  192. {"Freight"},
  193. {"Streak"},
  194. {"Vortex"},
  195. {"Vincent"},
  196. {"Bullet"},
  197. {"Clover"},
  198. {"Sadler"},
  199. {"Firetruck LA"}, //firela
  200. {"Hustler"},
  201. {"Intruder"},
  202. {"Primo"},
  203. {"Cargobob"},
  204. {"Tampa"},
  205. {"Sunrise"},
  206. {"Merit"},
  207. {"Utility"},
  208. {"Nevada"},
  209. {"Yosemite"},
  210. {"Windsor"},
  211. {"Monster A"}, //monstera
  212. {"Monster B"}, //monsterb
  213. {"Uranus"},
  214. {"Jester"},
  215. {"Sultan"},
  216. {"Stratum"},
  217. {"Elegy"},
  218. {"Raindance"},
  219. {"RC Tiger"},
  220. {"Flash"},
  221. {"Tahoma"},
  222. {"Savanna"},
  223. {"Bandito"},
  224. {"Freight Flat"}, //freiflat
  225. {"Streak Carriage"}, //streakc
  226. {"Kart"},
  227. {"Mower"},
  228. {"Duneride"},
  229. {"Sweeper"},
  230. {"Broadway"},
  231. {"Tornado"},
  232. {"AT-400"},
  233. {"DFT-30"},
  234. {"Huntley"},
  235. {"Stafford"},
  236. {"BF-400"},
  237. {"Newsvan"},
  238. {"Tug"},
  239. {"Trailer 3"}, //petrotr
  240. {"Emperor"},
  241. {"Wayfarer"},
  242. {"Euros"},
  243. {"Hotdog"},
  244. {"Club"},
  245. {"Freight Carriage"}, //freibox
  246. {"Trailer 3"}, //artict3
  247. {"Andromada"},
  248. {"Dodo"},
  249. {"RC Cam"},
  250. {"Launch"},
  251. {"Police Car (LSPD)"},
  252. {"Police Car (SFPD)"},
  253. {"Police Car (LVPD)"},
  254. {"Police Ranger"},
  255. {"Picador"},
  256. {"S.W.A.T. Van"},
  257. {"Alpha"},
  258. {"Phoenix"},
  259. {"Glendale"},
  260. {"Sadler"},
  261. {"Luggage Trailer A"}, //bagboxa
  262. {"Luggage Trailer B"}, //bagboxb
  263. {"Stair Trailer"}, //tugstair
  264. {"Boxville"},
  265. {"Farm Plow"}, //farmtr1
  266. {"Utility Trailer"} //utiltr1
  267. };
  268.  
  269. new WeapNames[][32] = {
  270. {"Unarmed (Fist)"}, // 0
  271. {"Brass Knuckles"}, // 1
  272. {"Golf Club"}, // 2
  273. {"Night Stick"}, // 3
  274. {"Knife"}, // 4
  275. {"Baseball Bat"}, // 5
  276. {"Shovel"}, // 6
  277. {"Pool Cue"}, // 7
  278. {"Katana"}, // 8
  279. {"Chainsaw"}, // 9
  280. {"Purple Dildo"}, // 10
  281. {"Big White Vibrator"}, // 11
  282. {"Medium White Vibrator"}, // 12
  283. {"Small White Vibrator"}, // 13
  284. {"Flowers"}, // 14
  285. {"Cane"}, // 15
  286. {"Grenade"}, // 16
  287. {"Teargas"}, // 17
  288. {"Molotov"}, // 18
  289. {" "}, // 19
  290. {" "}, // 20
  291. {" "}, // 21
  292. {"Colt 45"}, // 22
  293. {"Colt 45(Silenced)"}, // 23
  294. {"Deagle"}, // 24
  295. {"Normal Shotgun"}, // 25
  296. {"Sawnoff Shotgun"}, // 26
  297. {"Combat Shotgun"}, // 27
  298. {"Micro Uzi(Mac 10)"}, // 28
  299. {"SMG(MP5)"}, // 29
  300. {"AK47"}, // 30
  301. {"M4"}, // 31
  302. {"Tec9"}, // 32
  303. {"Country Rifle"}, // 33
  304. {"Sniper Rifle"}, // 34
  305. {"Rocket Launcher"}, // 35
  306. {"Heat-Seeking Rocket Launcher"}, // 36
  307. {"Flamethrower"}, // 37
  308. {"Minigun"}, // 38
  309. {"Satchel Charge"}, // 39
  310. {"Detonator"}, // 40
  311. {"Spray Can"}, // 41
  312. {"Fire Extinguisher"}, // 42
  313. {"Camera"}, // 43
  314. {"Night Vision Goggles"}, // 44
  315. {"Infrared Vision Goggles"}, // 45
  316. {"Parachute"}, // 46
  317. {"Fake Pistol"} // 47
  318. };
  319. new AccountInfo[MAX_PLAYERS][Info];
  320. new SuperPunch[MAX_PLAYERS];
  321. new ViewCmds[MAX_PLAYERS];
  322. new Count = 999;
  323. new Hide[MAX_PLAYERS];
  324. new Drugs[MAX_PLAYERS];
  325. new bool:PMBlock[MAX_PLAYERS];
  326. new Nuke[MAX_PLAYERS];
  327. new Missile[MAX_PLAYERS];
  328. //**FORWARDS**//
  329. forward SendClientMessageToAdmins(color,string[],alevel);
  330. forward OnPlayerRegister(playerid,password[]);
  331. forward OnPlayerLogin(playerid,password[]);
  332. forward OnPlayerUpdateAccount(playerid);
  333. forward BanLog(string[]);
  334. forward KickLog(string[]);
  335. forward VehicleLog(string[]);
  336. forward CountDown();
  337. /*x---------------------------------CallBacks-------------------------------------x*/
  338. stock strtok(const string[], &index,seperator=' ')
  339. {
  340. new length = strlen(string);
  341. new offset = index;
  342. new result[128];
  343. while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
  344. {
  345. result[index - offset] = string[index];
  346. index++;
  347. }
  348.  
  349. result[index - offset] = EOS;
  350. if ((index < length) && (string[index] == seperator))
  351. {
  352. index++;
  353. }
  354. return result;
  355. }
  356. stock IsNumeric(const string[])
  357. {
  358. for (new i = 0, j = strlen(string); i < j; i++)
  359. if (string[i] > '9' || string[i] < '0')
  360. return 0;
  361. return 1;
  362. }
  363.  
  364. ReturnUser(text[], playerid = INVALID_PLAYER_ID)
  365. {
  366. new pos = 0;
  367. while (text[pos] < 0x21)
  368. {
  369. if (text[pos] == 0) return INVALID_PLAYER_ID;
  370. pos++;
  371. }
  372. new userid = INVALID_PLAYER_ID;
  373. if (IsNumeric(text[pos]))
  374. {
  375. userid = strval(text[pos]);
  376. if (userid >=0 && userid < MAX_PLAYERS)
  377. {
  378. if(!IsPlayerConnected(userid))
  379. userid = INVALID_PLAYER_ID;
  380. else return userid;
  381. }
  382. }
  383. new len = strlen(text[pos]);
  384. new count = 0;
  385. new pname[MAX_PLAYER_NAME];
  386. for (new i = 0; i < MAX_PLAYERS; i++)
  387. {
  388. if (IsPlayerConnected(i))
  389. {
  390. GetPlayerName(i, pname, sizeof (pname));
  391. if (strcmp(pname, text[pos], true, len) == 0)
  392. {
  393. if (len == strlen(pname)) return i;
  394. else
  395. {
  396. count++;
  397. userid = i;
  398. }
  399. }
  400. }
  401. }
  402. if (count != 1)
  403. {
  404. if (playerid != INVALID_PLAYER_ID)
  405. {
  406. if (count) SendClientMessage(playerid, YELLOW, "There are multiple users, enter full playername.");
  407. else SendClientMessage(playerid, RED, "Playername not found.");
  408. }
  409. userid = INVALID_PLAYER_ID;
  410. }
  411. return userid;
  412. }
  413. stock GetFileString(string[])
  414. {
  415. new result[128];
  416. result[0] = 0;
  417. if (strfind(string, ":", true) == -1) return result;
  418. new id = strfind(string, ":", true);
  419. strmid(result, string, 0, id, 128);
  420. return result;
  421. }
  422.  
  423. stock GetFileValue(string[])
  424. {
  425. new val[128];
  426. val[0] = 0;
  427. if (strfind(string , ":", true) == -1) return val;
  428. new id = strfind(string, ":", true);
  429. strmid(val, string, id+2, strlen(string), 128);
  430. return val;
  431. }
  432.  
  433. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  434. {
  435. /*if(strcmp(cmd, "/buygun", true) == 0) // Make player an admin
  436. {
  437. ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Los Santos Gun Shop", "SPAS-12 ($25000)\nSDPistol ($500)\nMP5 ($2000)\nAK47 ($4500)\nM4 ($5000)\nShotgun ($1000)\nSniper Rifle ($22500)\nRifle ($3000)\n", button1[], button2[])
  438. return 1;
  439. }*/ if(dialogid == 1337) { // Our example listbox
  440. if(response) {
  441. new message[128];
  442. if(listitem == 0) {
  443. if(GetPlayerMoney(playerid) >= 25000)
  444. {
  445. format(message, 256, "* You bought a SPAS-12 ($25,000)");
  446. SendClientMessage(playerid, 0xFFFFFFFF, message);
  447. GivePlayerWeapon (playerid, 27, 65535);
  448. GivePlayerMoney(playerid,-25000);
  449. }
  450. } else if(listitem == 1) {
  451. if(GetPlayerMoney(playerid) >= 500)
  452. {
  453. format(message, 256, "* You bought a Silenced 9mm ($500)");
  454. SendClientMessage(playerid, 0xFFFFFFFF, message);
  455. GivePlayerWeapon (playerid, 23, 65535);
  456. GivePlayerMoney(playerid,-500);
  457. }
  458. } else if(listitem == 2) {
  459. if(GetPlayerMoney(playerid) >= 2000)
  460. {
  461. format(message, 256, "* You bought an MP5 ($2000)");
  462. SendClientMessage(playerid, 0xFFFFFFFF, message);
  463. GivePlayerWeapon (playerid, 29, 65535);
  464. GivePlayerMoney(playerid,-2000);
  465. }
  466. } else if(listitem == 3) {
  467. if(GetPlayerMoney(playerid) >= 4500)
  468. {
  469. format(message, 256, "* You bought an AK-47 ($4500)");
  470. SendClientMessage(playerid, 0xFFFFFFFF, message);
  471. GivePlayerWeapon (playerid, 30, 65535);
  472. GivePlayerMoney(playerid,-4500);
  473. }
  474. } else if(listitem == 4) {
  475. if(GetPlayerMoney(playerid) >= 5000)
  476. {
  477. format(message, 256, "* You bought an M4 ($5000)");
  478. SendClientMessage(playerid, 0xFFFFFFFF, message);
  479. GivePlayerWeapon (playerid, 31, 65535);
  480. GivePlayerMoney(playerid,-5000);
  481. }
  482. } else if(listitem == 5) {
  483. if(GetPlayerMoney(playerid) >= 1000)
  484. {
  485. format(message, 256, "* You bought a Shotgun ($1000)");
  486. SendClientMessage(playerid, 0xFFFFFFFF, message);
  487. GivePlayerWeapon (playerid, 25, 65535);
  488. GivePlayerMoney(playerid,-1000);
  489. }
  490. } else if(listitem == 6) {
  491. if(GetPlayerMoney(playerid) >= 22500)
  492. {
  493. format(message, 256, "* You bought a Sniper Rifle ($22500)");
  494. SendClientMessage(playerid, 0xFFFFFFFF, message);
  495. GivePlayerWeapon (playerid, 34, 65535);
  496. GivePlayerMoney(playerid,-22500);
  497. }
  498. } else if(listitem == 7) {
  499. if(GetPlayerMoney(playerid) >= 3000)
  500. {
  501. format(message, 256, "* You bought an Unscoped Rifle ($3000)");
  502. SendClientMessage(playerid, 0xFFFFFFFF, message);
  503. GivePlayerWeapon (playerid, 33, 65535);
  504. GivePlayerMoney(playerid,-3000);
  505. }
  506. }
  507. } else {
  508. SendClientMessage(playerid, 0xFFFFFFFF, "You Cancelled");
  509. }
  510. return 1;
  511. }
  512. return 0;
  513. }
  514.  
  515. public VehicleLog(string[])
  516. {
  517. new entry[128];
  518. format(entry, sizeof(entry), "%s\r\n",string);
  519. new File:hFile;
  520. hFile = fopen("vehiclespawn.log", io_append);
  521. if (hFile)
  522. {
  523. fwrite(hFile, entry);
  524. fclose(hFile);
  525. }
  526. }
  527.  
  528. public KickLog(string[])
  529. {
  530. new entry[128];
  531. format(entry, sizeof(entry), "%s\r\n",string);
  532. new File:hFile;
  533. hFile = fopen("kick.log", io_append);
  534. if (hFile)
  535. {
  536. fwrite(hFile, entry);
  537. fclose(hFile);
  538. }
  539. }
  540.  
  541. public BanLog(string[])
  542. {
  543. new entry[128];
  544. format(entry, sizeof(entry), "%s\r\n",string);
  545. new File:hFile;
  546. hFile = fopen("ban.log", io_append);
  547. if (hFile)
  548. {
  549. fwrite(hFile, entry);
  550. fclose(hFile);
  551. }
  552. }
  553. public SendClientMessageToAdmins(color,string[],alevel)
  554. {
  555. for(new i = 0; i < MAX_PLAYERS; i++)
  556. {
  557. if(IsPlayerConnected(i))
  558. {
  559. if (AccountInfo[i][AdminLevel] >= alevel)
  560. {
  561. SendClientMessage(i, color, string);
  562. printf("%s", string);
  563. }
  564. }
  565. }
  566. return 1;
  567. }
  568. public OnPlayerRegister(playerid, password[])
  569. {
  570. if(IsPlayerConnected(playerid))
  571. {
  572. new name[MAX_PLAYER_NAME], str[128], ip[15];
  573. GetPlayerName(playerid, name, sizeof name);
  574. GetPlayerIp(playerid, ip, sizeof ip);
  575. format(str, sizeof str, "/sAccounts/%s.seifadmin", name);
  576. new File:account = fopen(str, io_write);
  577. if (account)
  578. {
  579. strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
  580. AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
  581. AccountInfo[playerid][Score] = GetPlayerScore(playerid);
  582. new file[128];
  583. {
  584. format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
  585. { fwrite(account, file); }
  586. format(file, sizeof file, "AdminLevel: %d\n\r", 0);
  587. { fwrite(account, file); AccountInfo[playerid][AdminLevel] = 0; }
  588. format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
  589. { fwrite(account, file); }
  590. format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
  591. { fwrite(account, file); }
  592. format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
  593. { fwrite(account, file); }
  594. format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
  595. { fwrite(account, file); }
  596. format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
  597. { fwrite(account, file); }
  598. format(file, sizeof file, "IPAddress: %s\n\r",ip);
  599. { fwrite(account, file); }
  600. format(file, sizeof file, "Score: %d\n\r",AccountInfo[playerid][Cash]);
  601. { fwrite(account, file); }
  602. }
  603. fclose(account);
  604. SendClientMessage(playerid, GREEN, "|- Account successfully registered. You can now login ( /login [password] ) -|");
  605. }
  606. }
  607. return 1;
  608. }
  609.  
  610. public OnPlayerUpdateAccount(playerid)
  611. {
  612. if(IsPlayerConnected(playerid))
  613. {
  614. if(AccountInfo[playerid][Logged] == 1)
  615. {
  616. new name[MAX_PLAYER_NAME], str[128];
  617. GetPlayerName(playerid, name, sizeof name);
  618. format(str, sizeof str, "/sAccounts/%s.seifadmin", name);
  619. new File:account = fopen(str, io_write);
  620. if (account)
  621. {
  622. AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
  623. AccountInfo[playerid][Score] = GetPlayerScore(playerid);
  624. new file[128];
  625. {
  626. format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
  627. { fwrite(account, file); }
  628. format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
  629. { fwrite(account, file); }
  630. format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
  631. { fwrite(account, file); }
  632. format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
  633. { fwrite(account, file); }
  634. format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
  635. { fwrite(account, file); }
  636. format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
  637. { fwrite(account, file); }
  638. format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
  639. { fwrite(account, file); }
  640. format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
  641. { fwrite(account, file); }
  642. format(file, sizeof file, "Score: %d\n\r",AccountInfo[playerid][Score]);
  643. { fwrite(account, file); }
  644. format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
  645. { fwrite(account, file); }
  646. }
  647. fclose(account);
  648. }
  649. }
  650. }
  651. return 1;
  652. }
  653.  
  654. public OnPlayerLogin(playerid, password[])
  655. {
  656. new name[MAX_PLAYER_NAME], str[128];
  657. GetPlayerName(playerid, name, sizeof name);
  658. format(str, sizeof str, "/sAccounts/%s.seifadmin", name);
  659. new File:account = fopen(str, io_read);
  660. if (account)
  661. {
  662. new pass[256];
  663. new passres[128], value[128];
  664. fread(account, pass, sizeof pass);
  665. passres = GetFileString(pass);
  666. if (!strcmp("Password", passres))
  667. {
  668. value = GetFileValue(pass);
  669. strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
  670. }
  671. if (!strcmp(AccountInfo[playerid][Password], password, true))
  672. {
  673. while (fread(account, pass, 256))
  674. {
  675. passres = GetFileString(pass);
  676. if (strfind(passres, "AdminLevel") != -1)
  677. {
  678. value = GetFileValue(pass);
  679. AccountInfo[playerid][AdminLevel] = strval(value);
  680. }
  681. if (strfind(passres, "Cash") != -1)
  682. {
  683. value = GetFileValue(pass);
  684. AccountInfo[playerid][Cash] = strval(value);
  685. }
  686. if (strfind(passres, "Warnings") != -1)
  687. {
  688. value = GetFileValue(pass);
  689. AccountInfo[playerid][Warns] = strval(value);
  690. }
  691. if (strfind(passres, "WarnReason1") != -1)
  692. {
  693. value = GetFileValue(pass);
  694. strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 128);
  695. }
  696. if (strfind(passres, "WarnReason2") != -1)
  697. {
  698. value = GetFileValue(pass);
  699. strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 128);
  700. }
  701. if (strfind(passres, "WarnReason3") != -1)
  702. {
  703. value = GetFileValue(pass);
  704. strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 128);
  705. }
  706. if (strfind(passres, "Score") != -1)
  707. {
  708. value = GetFileValue(pass);
  709. AccountInfo[playerid][Score] = strval(value);
  710. }
  711. }
  712. fclose(account);
  713. AccountInfo[playerid][Logged] = 1;
  714. }
  715. else
  716. {
  717. SendClientMessage(playerid, RED, "Incorrect Password.");
  718. fclose(account);
  719. return 1;
  720. }
  721. GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
  722. SetPlayerScore(playerid, AccountInfo[playerid][Score]);
  723. format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
  724. SendClientMessage(playerid, GREEN, str);
  725. printf("%s has logged in", name);
  726. if (AccountInfo[playerid][AdminLevel] > 0)
  727. {
  728. format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
  729. SendClientMessage(playerid, LIGHTGREEN, str);
  730. ViewCmds[playerid] = 0;
  731. }
  732. }
  733. return 1;
  734. }
  735.  
  736. public OnFilterScriptInit()
  737. {
  738. print("<|-----------------------------------------|>");
  739. print(" | .: [ - SeifAdmin Script by Seif - ] :. |");
  740. print("<|-----------------------------------------|>");
  741. return 1;
  742. }
  743.  
  744. public OnFilterScriptExit()
  745. {
  746. return 1;
  747. }
  748.  
  749. public OnPlayerRequestSpawn(playerid)
  750. {
  751. #if defined LOGIN_BEFORE_SPAWN
  752. new string[128];
  753. new sendername[MAX_PLAYER_NAME];
  754. GetPlayerName(playerid,sendername,24);
  755. format(string,128,"/sAccounts/%s.seifadmin",sendername);
  756. if (fexist(string) && AccountInfo[playerid][Logged] == 0)
  757. {
  758. SendClientMessage(playerid,RED,"Your account is registered. You must first login in order to spawn.");
  759. return 0;
  760. }
  761. #endif
  762. return 1;
  763. }
  764.  
  765. public OnPlayerConnect(playerid)
  766. {
  767. AccountInfo[playerid][Jail] = 0;
  768. AccountInfo[playerid][AdminLevel] = 0;
  769. AccountInfo[playerid][Warns] = 0;
  770. AccountInfo[playerid][Logged] = 0;
  771. AccountInfo[playerid][Mute] = 0;
  772. format(AccountInfo[playerid][Password], 128, " ");
  773. format(AccountInfo[playerid][WarnReason1], 128, "NONE");
  774. format(AccountInfo[playerid][WarnReason2], 128, "NONE");
  775. format(AccountInfo[playerid][WarnReason3], 128, "NONE");
  776. Drugs[playerid] = 0;
  777. Hide[playerid] = 0;
  778. SuperPunch[playerid] = 0;
  779. ViewCmds[playerid] = 0;
  780. PMBlock[playerid] = false;
  781. new string[128];
  782. new ip[20];
  783. new sendername[MAX_PLAYER_NAME];
  784. GetPlayerName(playerid, sendername, sizeof(sendername));
  785. GetPlayerIp(playerid, ip, sizeof ip);
  786. strmid(AccountInfo[playerid][IP], ip, 0, strlen(ip), 128);
  787. format(string, sizeof(string), "/sAccounts/%s.seifadmin", sendername);
  788. if (!fexist(string)) return SendClientMessage(playerid,WHITE,"SERVER: Your account isn't registered. Please register ( /register [password] )");
  789. #if defined ENABLE_AUTO_LOGIN
  790. {
  791. new File:user = fopen(string, io_read);
  792. if (user)
  793. {
  794. new pass[128];
  795. new passres[128], value[128];
  796. new loop = 1;
  797. WHILE:
  798. while (fread(user, pass))
  799. {
  800. printf("line: %s", pass);
  801. strmid(passres, GetFileString(pass), 0, strlen(GetFileString(pass)), 128);
  802. if (loop == 1)
  803. {
  804. if (!strcmp("IPAddress", passres)) printf("IP; %s", GetFileValue(pass));
  805. if (!strcmp("Password", passres))
  806. {
  807. value = GetFileValue(pass);
  808. strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
  809. loop = 2;
  810. goto WHILE;
  811. }
  812. }
  813. else if (loop == 2)
  814. {
  815. if (!strcmp("IPAddress", passres))
  816. {
  817. printf("%s", passres);
  818. strmid(passres, value, 0, strlen(value)-1, 20);
  819. printf("file-ip: %s | player-ip: %s", GetFileValue(pass), AccountInfo[playerid][IP]);
  820. if (!strcmp(AccountInfo[playerid][IP], passres, true))
  821. {
  822. SendClientMessage(playerid, YELLOW, "|- Auto Login -|");
  823. fclose(user);
  824. OnPlayerLogin(playerid, AccountInfo[playerid][Password]);
  825. return 1;
  826. }
  827. else
  828. {
  829. if (fexist(string))
  830. {
  831. SendClientMessage(playerid, WHITE, "SERVER: That account is registered.");
  832. SendClientMessage(playerid, ORANGE, "Please login to retrieve your account stats ( /login [password] )");
  833. }
  834. fclose(user);
  835. }
  836. }
  837. }
  838. }
  839. fclose(user);
  840. }
  841. }
  842. #else
  843. {
  844. if (fexist(string))
  845. {
  846. SendClientMessage(playerid, WHITE, "SERVER: That account is registered.");
  847. SendClientMessage(playerid, ORANGE, "Please login to retrieve your account stats ( /login [password] )");
  848. }
  849. }
  850. #endif
  851. return 1;
  852. }
  853.  
  854. public OnPlayerDisconnect(playerid, reason)
  855. {
  856. OnPlayerUpdateAccount(playerid);
  857. AccountInfo[playerid][Jail] = 0;
  858. AccountInfo[playerid][AdminLevel] = 0;
  859. AccountInfo[playerid][Warns] = 0;
  860. AccountInfo[playerid][Logged] = 0;
  861. AccountInfo[playerid][Mute] = 0;
  862. Drugs[playerid] = 0;
  863. Hide[playerid] = 0;
  864. SuperPunch[playerid] = 0;
  865. ViewCmds[playerid] = 0;
  866. strmid(AccountInfo[playerid][IP], " ", 0, strlen(" "), 20);
  867. new playernom[32],string[128];
  868. GetPlayerName(playerid, playernom, 32);
  869. format(string,128,"%s has left the server.",playernom);
  870. SendClientMessageToAll(0xFF000000,string);
  871. return 1;
  872. }
  873.  
  874. public OnPlayerSpawn(playerid)
  875. {
  876. return 1;
  877. }
  878.  
  879. public OnPlayerDeath(playerid, killerid, reason)
  880. {
  881. GivePlayerMoney(killerid,500);
  882. LevelKills[killerid] += 1;
  883. Drugs[playerid] = 0;
  884. return 1;
  885. }
  886.  
  887. public OnVehicleSpawn(vehicleid)
  888. {
  889. return 1;
  890. }
  891.  
  892. public OnVehicleDeath(vehicleid, killerid)
  893. {
  894. return 1;
  895. }
  896.  
  897. public OnPlayerText(playerid, text[])
  898. {
  899. if (AccountInfo[playerid][Mute] == 1)
  900. {
  901. SendClientMessage(playerid, RED, "You are muted! You cannot talk.");
  902. return 0;
  903. }
  904. return 1;
  905. }
  906.  
  907. public OnPlayerCommandText(playerid, cmdtext[])
  908. {
  909. new cmd[128];
  910. new tmp[128];
  911. new idx;
  912. new giveplayername[MAX_PLAYER_NAME];
  913. new sendername[MAX_PLAYER_NAME];
  914. new string[128];
  915. cmd = strtok(cmdtext,idx);
  916.  
  917. for(new i = 0; i < GetMaxPlayers(); i++)
  918. {
  919. if (IsPlayerConnected(i))
  920. {
  921. if (AccountInfo[i][AdminLevel] > 0 && ViewCmds[i] == 1)
  922. {
  923. for(new v = 0; v < sizeof(ViewCommands); v++) if (!strcmp(cmdtext, ViewCommands[v], true))
  924. {
  925. GetPlayerName(playerid, sendername, sizeof sendername);
  926. format(tmp, 128, "[VIEWCMDS] [%d]%s: %s", playerid, sendername, cmdtext);
  927. SendClientMessage(i, PURPLE, tmp);
  928. }
  929. }
  930. }
  931. }
  932.  
  933. /*»»»»»»»»»»»»»»»»»»»»»»»»»»»» [ADMINS] «««««««««««««««««««««««««««*/
  934.  
  935. if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin
  936. {
  937. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  938. {
  939. tmp = strtok(cmdtext, idx);
  940. if(!strlen(tmp))
  941. {
  942. SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level 1-5]");
  943. SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin depending on the given level.");
  944. return 1;
  945. }
  946. new giveplayerid = ReturnUser(tmp, playerid);
  947. tmp = strtok(cmdtext, idx);
  948. new level = strval(tmp);
  949. if(giveplayerid != INVALID_PLAYER_ID)
  950. {
  951. if (level >= 0)
  952. {
  953. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  954. GetPlayerName(playerid, sendername, sizeof(sendername));
  955. printf("ADMIN: %s made %s a level %d admin.", sendername, giveplayername, level);
  956. format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, sendername);
  957. SendClientMessage(giveplayerid, LIGHTBLUE, string);
  958. format(string, sizeof(string), "|- Administrator %s has given %s an Admin Level. [Level: %d] -|", sendername,giveplayername,level);
  959. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  960. AccountInfo[giveplayerid][AdminLevel] = level;
  961. format(string, sizeof(string), "You have given %s level %d admin.", giveplayername,AccountInfo[giveplayerid][AdminLevel]);
  962. SendClientMessage(playerid, LIGHTBLUE, string);
  963. }
  964. else return SendClientMessage(playerid, RED, "You can't go below level 0!");
  965. }
  966. else if(giveplayerid == INVALID_PLAYER_ID)
  967. {
  968. format(string, sizeof(string), "%i is not an active player.", giveplayerid);
  969. SendClientMessage(playerid, RED, string);
  970. }
  971. }
  972. else SendClientMessage(playerid, RED, "You are not a lead admin!");
  973. return 1;
  974. }
  975.  
  976.  
  977. if(strcmp(cmd, "/destroycars", true) == 0) // Destroy admin-spawned cars.
  978. {
  979. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  980. {
  981. for(new i=0;i<201;i++) { if(AdminSpawned[i] == 1) { DestroyVehicle(i); } } }
  982. else SendClientMessage(playerid, RED, "You are not a lead admin!");
  983. return 1;
  984. }
  985.  
  986. if(strcmp(cmd, "/buygun", true) == 0) // Buy gun
  987. {
  988. ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Los Santos Gun Shop", "SPAS-12 ($25000)\nSDPistol ($500)\nMP5 ($2000)\nAK47 ($4500)\nM4 ($5000)\nShotgun ($1000)\nSniper Rifle ($22500)\nRifle ($3000)\n", "Buy", "Cancel");
  989. return 1;
  990. }
  991.  
  992. if(strcmp(cmd, "/buylevel", true) == 0) // Level up
  993. {
  994. new nextlevel = PlayerLevel[playerid]+1;
  995. if((LevelKills[playerid] == (nextlevel*10)+10) && GetPlayerMoney(playerid) == nextlevel*10000)
  996. {
  997. PlayerLevel[playerid] += 1;
  998. SendClientMessage(playerid,0x00FF0000,"Levelled up!");
  999. }
  1000. else
  1001. {
  1002. SendClientMessage(playerid,0xFF000000,"Not enough cash/Not enough kills!");
  1003. }
  1004. return 1;
  1005. }
  1006.  
  1007. if(strcmp(cmd, "/gmx", true) == 0) // Reboot the server
  1008. {
  1009. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid)) { for(new i=0;i<MAX_PLAYERS;i++) { OnPlayerUpdateAccount(i); } GameModeExit(); }
  1010. else return SendClientMessage(playerid, RED, "You are not a lead admin!");
  1011. }
  1012.  
  1013. if(strcmp(cmd, "/kickall", true) == 0) // Kick everyone except the one who does this
  1014. {
  1015. new reason[128];
  1016. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  1017. {
  1018. GetPlayerName(playerid, sendername, sizeof(sendername));
  1019. reason = bigstrtok(cmdtext, idx);
  1020. if(!strlen(reason))
  1021. {
  1022. SendClientMessage(playerid, ORANGE, "USAGE: /kickall [reason]");
  1023. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick all the players.");
  1024. return 1;
  1025. }
  1026. printf("ADMIN: Admin %s kicked everyone. Reason: %s", sendername, reason);
  1027. format(string, sizeof(string), "-| Administrator %s kicked everyone. [Reason: %s ] |-", sendername,reason);
  1028. SendClientMessageToAll(ADMIN_RED, string);
  1029. for(new i = 0; i < MAX_PLAYERS; i++)
  1030. {
  1031. if (i != playerid)
  1032. {
  1033. Kick(i);
  1034. KickLog(string);
  1035. }
  1036. }
  1037. }
  1038. else SendClientMessage(playerid, RED, "You are not a lead admin!");
  1039. return 1;
  1040. }
  1041.  
  1042. if(strcmp(cmd, "/nuke", true) == 0) // Nuke a player (explode)
  1043. {
  1044. if (AccountInfo[playerid][AdminLevel] >= 3)
  1045. {
  1046. tmp = strtok(cmdtext, idx);
  1047. if(!strlen(tmp))
  1048. {
  1049. SendClientMessage(playerid, ORANGE, "USAGE: /nuke [playerid]");
  1050. SendClientMessage(playerid, ORANGE, "FUNCTION: Player will explode.");
  1051. return 1;
  1052. }
  1053. new Float:X,Float:Y,Float:Z;
  1054. new giveplayerid = ReturnUser(tmp, playerid);
  1055. if(IsPlayerConnected(giveplayerid))
  1056. {
  1057. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1058. GetPlayerName(playerid, sendername, sizeof(sendername));
  1059. GetPlayerPos(giveplayerid, X,Y,Z);
  1060. CreateExplosion(X,Y,Z,2,3.0);
  1061. SetPlayerHealth(giveplayerid, 0.0);
  1062. format(string, sizeof(string), "-| Administrator %s nuked %s |-",sendername,giveplayername);
  1063. SendClientMessageToAdmins(ADMIN_RED, string,1);
  1064. }
  1065. else if (!IsPlayerConnected(giveplayerid))
  1066. {
  1067. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1068. SendClientMessage(playerid, RED, string);
  1069. }
  1070. }
  1071. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1072. return 1;
  1073. }
  1074.  
  1075. if(strcmp(cmd, "/setscore", true) == 0) // Set player a score
  1076. {
  1077. if (IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  1078. {
  1079. tmp = strtok(cmdtext, idx);
  1080. if(!strlen(tmp))
  1081. {
  1082. SendClientMessage(playerid, ORANGE, "USAGE: /setscore [playerid] [score]");
  1083. SendClientMessage(playerid, ORANGE, "FUNCTION: Will set a specified player's score");
  1084. return 1;
  1085. }
  1086. new giveplayerid = ReturnUser(tmp);
  1087. tmp = strtok(cmdtext, idx);
  1088. if(!strlen(tmp))
  1089. {
  1090. SendClientMessage(playerid, ORANGE, "USAGE: /score [playerid] [score]");
  1091. SendClientMessage(playerid, ORANGE, "FUNCTION: Will set a specified player's score");
  1092. return 1;
  1093. }
  1094. new score = strval(tmp);
  1095. if(IsPlayerConnected(giveplayerid))
  1096. {
  1097. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1098. GetPlayerScore(giveplayerid);
  1099. SetPlayerScore(giveplayerid, score);
  1100. format(string, sizeof(string), "You have changed %s's score number to %d.",giveplayername, score);
  1101. SendClientMessage(playerid, GREEN, string);
  1102. }
  1103. else if (!IsPlayerConnected(giveplayerid))
  1104. {
  1105. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1106. SendClientMessage(playerid, RED, string);
  1107. }
  1108. }
  1109. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1110. return 1;
  1111. }
  1112.  
  1113. if(strcmp(cmd, "/angle", true) == 0) // Shows your current angle + sets it
  1114. {
  1115. if (IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  1116. {
  1117. new Float:angle;
  1118. tmp = strtok(cmdtext, idx);
  1119. if(!strlen(tmp))
  1120. {
  1121. SendClientMessage(playerid, ORANGE, "USAGE: /angle [angle degree]");
  1122. SendClientMessage(playerid, ORANGE, "FUNCTION: Will change your current angle.");
  1123. GetPlayerFacingAngle(playerid,angle);
  1124. format(string, sizeof(string), "HELP: Your current angle is %f", angle);
  1125. SendClientMessage(playerid, ORANGE, string);
  1126. return 1;
  1127. }
  1128. angle = floatstr(tmp);
  1129. if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1130. {
  1131. SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
  1132. format(string, sizeof(string), "You have changed your angle degree to %f" ,angle);
  1133. SendClientMessage(playerid, GREEN, string);
  1134. }
  1135. else
  1136. {
  1137. SetPlayerFacingAngle(playerid,angle);
  1138. format(string, sizeof(string), "You have changed your angle degree to %f",angle);
  1139. SendClientMessage(playerid, GREEN, string);
  1140. }
  1141. }
  1142. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1143. return 1;
  1144. }
  1145.  
  1146. if(strcmp(cmd, "/rangeban", true) == 0) // Range-bans a player with the amount of ranges entered.
  1147. {
  1148. if (AccountInfo[playerid][AdminLevel] >= 4)
  1149. {
  1150. tmp = strtok(cmdtext,idx);
  1151. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [ranges(2 max)]");
  1152. new ip[20],ban[128];
  1153. new giveplayerid = ReturnUser(tmp);
  1154. if (IsPlayerConnected(giveplayerid))
  1155. {
  1156. tmp = strtok(cmdtext,idx);
  1157. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [RANGES(2 max)]");
  1158. new ranges = strval(tmp);
  1159. if (ranges < 0 || ranges > 2) return SendClientMessage(playerid, RED, "Minimum ranges: 0 | Maximum ranges: 2");
  1160. if (ranges == 0)
  1161. {
  1162. Ban(giveplayerid);
  1163. }
  1164. GetPlayerName(giveplayerid, giveplayername, sizeof giveplayername);
  1165. GetPlayerIp(giveplayerid, ip, sizeof ip);
  1166. new count = 1;
  1167. for(new i = strlen(ip); i > 0; i--)
  1168. {
  1169. if (ip[i] == '.')
  1170. {
  1171. if (count == ranges)
  1172. {
  1173. format(ban, sizeof ban, "banip %s", ip);
  1174. SendRconCommand(ban);
  1175. break;
  1176. }
  1177. else count++;
  1178. }
  1179. else ip[i] = '*';
  1180. }
  1181. format(ban, sizeof ban, "%s has been banned with the ip '%s'", giveplayername, ip);
  1182. SendClientMessage(playerid, GREEN, ban);
  1183. }
  1184. else
  1185. {
  1186. format(string, sizeof(string), "%i is not an active player.", giveplayerid);
  1187. SendClientMessage(playerid, RED, string);
  1188. }
  1189. }
  1190. else SendClientMessage(playerid, RED, "You're not a lead admin !");
  1191. return 1;
  1192. }
  1193.  
  1194. if(strcmp(cmd, "/ip", true) == 0) // Look at the player's IP address
  1195. {
  1196. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1197. {
  1198. tmp = strtok(cmdtext, idx);
  1199. if(!strlen(tmp))
  1200. {
  1201. SendClientMessage(playerid, ORANGE, "USAGE: /ip [playername/id]");
  1202. SendClientMessage(playerid, ORANGE, "FUNCTION: View a player's IP.");
  1203. return 1;
  1204. }
  1205.  
  1206. new giveplayerid = ReturnUser(tmp);
  1207. if(IsPlayerConnected(giveplayerid))
  1208. {
  1209. new sstring[256];
  1210. new ip[20];
  1211. GetPlayerIp(giveplayerid, ip, sizeof ip);
  1212. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1213. format(sstring, sizeof(sstring), "-| %s's IP: %s |-", giveplayername,ip);
  1214. SendClientMessage(playerid,LIGHTBLUE, sstring);
  1215. }
  1216. else
  1217. {
  1218. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1219. SendClientMessage(playerid, RED, string);
  1220. }
  1221. }
  1222. else SendClientMessage(playerid, RED, "You are not an admin.");
  1223. return 1;
  1224. }
  1225.  
  1226. if(strcmp(cmd, "/ban", true) == 0) // Bans a player from the server
  1227. {
  1228. new reason[128];
  1229. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1230. {
  1231. tmp = strtok(cmdtext, idx);
  1232. if(!strlen(tmp))
  1233. {
  1234. SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
  1235. SendClientMessage(playerid, ORANGE, "FUNCTION: Will BAN the specified player.");
  1236. return 1;
  1237. }
  1238.  
  1239. new giveplayerid = ReturnUser(tmp);
  1240.  
  1241. if (AccountInfo[giveplayerid][AdminLevel] > AccountInfo[playerid][AdminLevel])
  1242. {
  1243. format(string, sizeof(string), "-| [%i]%s tried to ban you! |-",playerid,sendername);
  1244. SendClientMessage(giveplayerid, ADMIN_RED,string);
  1245. SendClientMessage(playerid, ADMIN_RED, "You are not allowed to ban an admin with a higher level than you!");
  1246. }
  1247.  
  1248. else if (giveplayerid != INVALID_PLAYER_ID)
  1249. {
  1250. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1251. GetPlayerName(playerid, sendername, sizeof(sendername));
  1252. reason = bigstrtok(cmdtext, idx);
  1253. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
  1254. new ip[20];
  1255. printf("ADMIN: Admin %s banned %s. Reason: %s", sendername, giveplayername, reason);
  1256. format(string, sizeof(string), "-| Administrator %s banned %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1257. SendClientMessageToAll(ADMIN_RED, string);
  1258. GetPlayerIp(giveplayerid, ip, sizeof ip);
  1259. format(string, sizeof(string), "-| Banned Player's IP: %s |-", ip);
  1260. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1261. AccountInfo[giveplayerid][AdminLevel] = 0; // Resets the banned player's admin level for security reasons
  1262. format(reason, sizeof reason, "[%s]%s", sendername, reason);
  1263. BanEx(giveplayerid, reason);
  1264. }
  1265. else if(giveplayerid == INVALID_PLAYER_ID)
  1266. {
  1267. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1268. SendClientMessage(playerid, RED, string);
  1269. }
  1270. }
  1271. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1272. return 1;
  1273. }
  1274.  
  1275. if(strcmp(cmd, "/kick", true) == 0) // Kicks the player from the server
  1276. {
  1277. new reason[128];
  1278. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1279. {
  1280. tmp = strtok(cmdtext, idx);
  1281. if(!strlen(tmp))
  1282. {
  1283. SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
  1284. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick the specified player.");
  1285. return 1;
  1286. }
  1287.  
  1288. new giveplayerid = ReturnUser(tmp);
  1289. if(giveplayerid != INVALID_PLAYER_ID)
  1290. {
  1291. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1292. GetPlayerName(playerid, sendername, sizeof(sendername));
  1293. reason = bigstrtok(cmdtext, idx);
  1294. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
  1295. printf("ADMIN: Admin %s kicked %s. Reason: %s", sendername, giveplayername, reason);
  1296. format(string, sizeof(string), "-| Administrator %s kicked %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1297. SendClientMessageToAll(ADMIN_RED, string);
  1298. Kick(giveplayerid);
  1299. KickLog(string);
  1300. }
  1301. else if(giveplayerid == INVALID_PLAYER_ID)
  1302. {
  1303. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1304. SendClientMessage(playerid, RED, string);
  1305. }
  1306. }
  1307. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1308. return 1;
  1309. }
  1310.  
  1311. if(strcmp(cmd, "/mute", true) == 0) // Mutes the player from talking in the chat box
  1312. {
  1313. new reason[128];
  1314. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1315. {
  1316. tmp = strtok(cmdtext, idx);
  1317. if(!strlen(tmp))
  1318. {
  1319. SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
  1320. SendClientMessage(playerid, ORANGE, "FUNCTION: Will mute the specified player.");
  1321. return 1;
  1322. }
  1323.  
  1324. new giveplayerid = ReturnUser(tmp);
  1325.  
  1326. if(giveplayerid != INVALID_PLAYER_ID)
  1327. {
  1328. if (AccountInfo[giveplayerid][Mute] == 0)
  1329. {
  1330. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1331. GetPlayerName(playerid, sendername, sizeof(sendername));
  1332. reason = bigstrtok(cmdtext, idx);
  1333. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
  1334. printf("ADMIN: Admin %s muted %s. Reason: %s", sendername, giveplayername, reason);
  1335. format(string, sizeof(string), "-| Administrator %s muted %s. [Reason: %s ]|-", sendername,giveplayername,reason);
  1336. SendClientMessageToAll(ADMIN_RED, string);
  1337. AccountInfo[giveplayerid][Mute] = 1;
  1338. }
  1339. else if (AccountInfo[giveplayerid][Mute] == 1) SendClientMessage(playerid, RED, "Player is already muted!");
  1340. }
  1341.  
  1342. else if(giveplayerid == INVALID_PLAYER_ID)
  1343. {
  1344. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1345. SendClientMessage(playerid, RED, string);
  1346. }
  1347. }
  1348. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1349. return 1;
  1350. }
  1351.  
  1352. if(strcmp(cmd, "/unmute", true) == 0) // Unmutes a muted player
  1353. {
  1354. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1355. {
  1356. tmp = strtok(cmdtext, idx);
  1357. if(!strlen(tmp))
  1358. {
  1359. SendClientMessage(playerid, ORANGE, "USAGE: /unmute [playername/id]");
  1360. SendClientMessage(playerid, ORANGE, "FUNCTION: Will unmute the specified player.");
  1361. return 1;
  1362. }
  1363.  
  1364. new giveplayerid = ReturnUser(tmp);
  1365.  
  1366. if(giveplayerid != INVALID_PLAYER_ID)
  1367. {
  1368. if (AccountInfo[giveplayerid][Mute] == 1)
  1369. {
  1370. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1371. GetPlayerName(playerid, sendername, sizeof(sendername));
  1372. format(string, sizeof(string), "-| Administrator %s unmuted %s |-", sendername,giveplayername);
  1373. SendClientMessageToAll(ADMIN_RED, string);
  1374. AccountInfo[giveplayerid][Mute] = 0;
  1375. }
  1376. else if (AccountInfo[giveplayerid][Mute] == 0) SendClientMessage(playerid, RED, "Player isn't muted.");
  1377. }
  1378.  
  1379. else if(giveplayerid == INVALID_PLAYER_ID)
  1380. {
  1381. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1382. SendClientMessage(playerid, RED, string);
  1383. }
  1384. }
  1385. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1386. return 1;
  1387. }
  1388.  
  1389. if(strcmp(cmd, "/drugs", true) == 0) // Will make the player invinsible until death
  1390. {
  1391. if (AccountInfo[playerid][AdminLevel] > 1 || IsPlayerAdmin(playerid))
  1392. {
  1393. SetPlayerHealth(playerid,999999999); // max HP
  1394. Drugs[playerid] = 1;
  1395. SendClientMessage(playerid, GREEN, "You are now high on drugs...");
  1396. }
  1397. else SendClientMessage(playerid, RED, "Drugs are bad for you!");
  1398. return 1;
  1399. }
  1400.  
  1401. if(strcmp(cmd, "/freeze", true) == 0) // Freezes the player. Prevents him from moving
  1402. {
  1403. new reason[128];
  1404. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1405. {
  1406. tmp = strtok(cmdtext, idx);
  1407. if(!strlen(tmp))
  1408. {
  1409. SendClientMessage(playerid, ORANGE, "USAGE: /freeze [playername/id] [reason]");
  1410. SendClientMessage(playerid, ORANGE, "FUNCTION: Will freeze the specified player.");
  1411. return 1;
  1412. }
  1413.  
  1414. new giveplayerid = ReturnUser(tmp);
  1415. if(giveplayerid != INVALID_PLAYER_ID)
  1416. {
  1417. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1418. GetPlayerName(playerid, sendername, sizeof(sendername));
  1419. reason = bigstrtok(cmdtext, idx);
  1420. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /freeze [playername/id] [reason]");
  1421. format(string, sizeof(string), "-| Administrator %s froze %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1422. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1423. TogglePlayerControllable(giveplayerid, false);
  1424. }
  1425. else if(giveplayerid == INVALID_PLAYER_ID)
  1426. {
  1427. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1428. SendClientMessage(playerid, RED, string);
  1429. }
  1430. }
  1431. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1432. return 1;
  1433. }
  1434. if(strcmp(cmd, "/unfreeze", true) == 0) // Unfreezes the player
  1435. {
  1436. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1437. {
  1438. tmp = strtok(cmdtext, idx);
  1439. if(!strlen(tmp))
  1440. {
  1441. SendClientMessage(playerid, ORANGE, "USAGE: /unfreeze [playername/id]");
  1442. SendClientMessage(playerid, ORANGE, "FUNCTION: Will unfreeze the specified player.");
  1443. return 1;
  1444. }
  1445.  
  1446. new giveplayerid = ReturnUser(tmp);
  1447. if(giveplayerid != INVALID_PLAYER_ID)
  1448. {
  1449. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1450. GetPlayerName(playerid, sendername, sizeof(sendername));
  1451. format(string, sizeof(string), "-| Administrator %s unfroze %s |-", sendername,giveplayername);
  1452. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1453. TogglePlayerControllable(giveplayerid, true);
  1454. }
  1455. else if(giveplayerid == INVALID_PLAYER_ID)
  1456. {
  1457. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1458. SendClientMessage(playerid, RED, string);
  1459. }
  1460. }
  1461. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1462. return 1;
  1463. }
  1464.  
  1465. if(strcmp(cmd, "/setname", true) == 0) // Changes a player's name
  1466. {
  1467. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1468. {
  1469. tmp = strtok(cmdtext, idx);
  1470. if(!strlen(tmp))
  1471. {
  1472. SendClientMessage(playerid, ORANGE, "USAGE: /setname [playername/id] [newname]");
  1473. SendClientMessage(playerid, ORANGE, "FUNCTION: Will change the player's current name. ");
  1474. return 1;
  1475. }
  1476.  
  1477. new giveplayerid = ReturnUser(tmp);
  1478. if(giveplayerid != INVALID_PLAYER_ID)
  1479. {
  1480. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1481. GetPlayerName(playerid, sendername, sizeof(sendername));
  1482. tmp = strtok(cmdtext, idx);
  1483. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setname [playername/id] [newname]");
  1484. format(string, sizeof(string), "-| Administrator %s renamed %s. [New Name: %s ] |-", sendername, giveplayername, tmp);
  1485. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1486. SetPlayerName(giveplayerid, tmp);
  1487. }
  1488. else if(giveplayerid == INVALID_PLAYER_ID)
  1489. {
  1490. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1491. SendClientMessage(playerid, RED, string);
  1492. }
  1493. }
  1494. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1495. return 1;
  1496. }
  1497.  
  1498. if(strcmp(cmd, "/givecash", true) == 0) // Gives some cash to the player
  1499. {
  1500. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1501. {
  1502. tmp = strtok(cmdtext, idx);
  1503. if(!strlen(tmp))
  1504. {
  1505. SendClientMessage(playerid, ORANGE, "USAGE: /givecash [playername/id] [cash]");
  1506. SendClientMessage(playerid, ORANGE, "FUNCTION: Will give the player some cash. ");
  1507. return 1;
  1508. }
  1509.  
  1510. new giveplayerid = ReturnUser(tmp);
  1511. if(giveplayerid != INVALID_PLAYER_ID)
  1512. {
  1513. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1514. GetPlayerName(playerid, sendername, sizeof(sendername));
  1515. tmp = strtok(cmdtext, idx);
  1516. new cash = strval(tmp);
  1517. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /givecash [playername/id] [cash]");
  1518. format(string, sizeof(string), "-| Administrator %s gave %s $%d |-", sendername,giveplayername,cash);
  1519. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1520. GivePlayerMoney(giveplayerid, cash);
  1521. }
  1522. else if(giveplayerid == INVALID_PLAYER_ID)
  1523. {
  1524. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1525. SendClientMessage(playerid, RED, string);
  1526. }
  1527. }
  1528. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1529. return 1;
  1530. }
  1531.  
  1532. if(strcmp(cmd, "/kill", true) == 0) // If an admin, it kills the player you want. If not, suicide.
  1533. {
  1534. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1535. {
  1536. tmp = strtok(cmdtext, idx);
  1537. if(!strlen(tmp))
  1538. {
  1539. SendClientMessage(playerid, ORANGE, "USAGE: /kill [playername/id]");
  1540. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kill the specified player.");
  1541. return 1;
  1542. }
  1543.  
  1544. new giveplayerid = ReturnUser(tmp);
  1545. if(giveplayerid != INVALID_PLAYER_ID)
  1546. {
  1547. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1548. GetPlayerName(playerid, sendername, sizeof(sendername));
  1549. format(string, sizeof(string), "-| Administrator %s killed %s |-", sendername,giveplayername);
  1550. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1551. SetPlayerHealth(giveplayerid, 0.0);
  1552. }
  1553. else if(giveplayerid == INVALID_PLAYER_ID)
  1554. {
  1555. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1556. SendClientMessage(playerid, RED, string);
  1557. }
  1558. }
  1559. else
  1560. {
  1561. SendClientMessage(playerid, RED, "You have committed suicide.");
  1562. SetPlayerHealth(playerid,0.0);
  1563. }
  1564. return 1;
  1565. }
  1566.  
  1567. if(strcmp(cmd, "/goto", true) == 0) // Teleports to a player
  1568. {
  1569. new Float:pX,Float:pY,Float:pZ;
  1570. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1571. {
  1572. tmp = strtok(cmdtext, idx);
  1573. if(!strlen(tmp))
  1574. {
  1575. SendClientMessage(playerid, ORANGE, "USAGE: /goto [playername/id]");
  1576. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport to the specified player.");
  1577. return 1;
  1578. }
  1579. new giveplayerid = ReturnUser(tmp);
  1580. if(giveplayerid != INVALID_PLAYER_ID)
  1581. {
  1582. if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1583. {
  1584. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1585. SetVehiclePos(GetPlayerVehicleID(playerid),pX,pY,pZ+2);
  1586. }
  1587. else
  1588. {
  1589. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1590. SetPlayerPos(playerid,pX,pY,pZ+2);
  1591. }
  1592. SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
  1593. }
  1594. else if(giveplayerid == INVALID_PLAYER_ID)
  1595. {
  1596. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1597. SendClientMessage(playerid, RED, string);
  1598. }
  1599. }
  1600. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1601. return 1;
  1602. }
  1603.  
  1604. if(strcmp(cmd, "/get", true) == 0) // Teleports the player to your position
  1605. {
  1606. new Float:pX,Float:pY,Float:pZ;
  1607. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1608. {
  1609. tmp = strtok(cmdtext, idx);
  1610. if(!strlen(tmp))
  1611. {
  1612. SendClientMessage(playerid, ORANGE, "USAGE: /get [playername/id]");
  1613. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport the specified player to you.");
  1614. return 1;
  1615. }
  1616. new giveplayerid = ReturnUser(tmp);
  1617. if(giveplayerid != INVALID_PLAYER_ID)
  1618. {
  1619. if (GetPlayerState(giveplayerid) == PLAYER_STATE_DRIVER)
  1620. {
  1621. GetPlayerPos(playerid,pX,pY,pZ);
  1622. SetVehiclePos(GetPlayerVehicleID(giveplayerid),pX,pY,pZ+2);
  1623. }
  1624. else
  1625. {
  1626. GetPlayerPos(playerid,pX,pY,pZ);
  1627. SetPlayerPos(giveplayerid,pX,pY,pZ+2);
  1628. }
  1629. SetPlayerInterior(giveplayerid,GetPlayerInterior(playerid));
  1630. }
  1631. else if(giveplayerid == INVALID_PLAYER_ID)
  1632. {
  1633. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1634. SendClientMessage(playerid, RED, string);
  1635. }
  1636. }
  1637. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1638. return 1;
  1639. }
  1640.  
  1641. if(strcmp(cmd, "/teleport", true) == 0) // Teleports the player to the other player
  1642. {
  1643. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  1644. {
  1645. tmp = strtok(cmdtext, idx);
  1646. if(!strlen(tmp))
  1647. {
  1648. SendClientMessage(playerid, ORANGE, "USAGE: /teleport [playername/id] [targetname/id]");
  1649. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport the player to the target.");
  1650. return 1;
  1651. }
  1652. new giveplayerid = ReturnUser(tmp);
  1653. if(giveplayerid != INVALID_PLAYER_ID)
  1654. {
  1655. tmp = strtok(cmdtext, idx);
  1656. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /teleport [playername/id] [targetname/id]");
  1657. new targetid = ReturnUser(tmp, playerid);
  1658. if (targetid == INVALID_PLAYER_ID) return 1;
  1659. new Float:tX,Float:tY,Float:tZ;
  1660. if (GetPlayerState(giveplayerid) == PLAYER_STATE_DRIVER)
  1661. {
  1662. GetPlayerPos(targetid,tX,tY,tZ);
  1663. SetVehiclePos(GetPlayerVehicleID(giveplayerid),tX,tY,tZ+2);
  1664. }
  1665. else
  1666. {
  1667. GetPlayerPos(targetid,tX,tY,tZ);
  1668. SetPlayerPos(giveplayerid,tX,tY,tZ+2);
  1669. }
  1670. SetPlayerInterior(giveplayerid,GetPlayerInterior(targetid));
  1671. }
  1672. else if(giveplayerid == INVALID_PLAYER_ID)
  1673. {
  1674. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1675. SendClientMessage(playerid, RED, string);
  1676. }
  1677. }
  1678. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1679. return 1;
  1680. }
  1681.  
  1682. if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
  1683. {
  1684. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1685. {
  1686. if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: //<text>"), SendClientMessage(playerid, ORANGE, "HELP: Example: //Hi");
  1687. GetPlayerName(playerid, sendername, sizeof(sendername));
  1688. format(string, sizeof(string), "Admin [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
  1689. SendClientMessageToAdmins(DARKPINK, string, 1);
  1690. return 1;
  1691. }
  1692. else return SendClientMessage(playerid, RED, "You are not an admin!");
  1693. }
  1694.  
  1695. if(strcmp(cmd, "/slap", true) == 0) // Slap a player
  1696. {
  1697. new Float:pX,Float:pY,Float:pZ;
  1698. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1699. {
  1700. tmp = strtok(cmdtext, idx);
  1701. if(!strlen(tmp))
  1702. {
  1703. SendClientMessage(playerid, ORANGE, "USAGE: /slap [playername/id]");
  1704. SendClientMessage(playerid, ORANGE, "FUNCTION: Will slap the specified player");
  1705. return 1;
  1706. }
  1707.  
  1708. new giveplayerid = ReturnUser(tmp);
  1709. if(giveplayerid != INVALID_PLAYER_ID)
  1710. {
  1711. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1712. GetPlayerName(playerid, sendername, sizeof(sendername));
  1713. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1714. SetPlayerPos(giveplayerid,pX,pY,pZ+5);
  1715. format(string, sizeof(string), "-| Administrator %s slapped %s |-",sendername, giveplayername);
  1716. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1717. }
  1718. else if(giveplayerid == INVALID_PLAYER_ID)
  1719. {
  1720. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1721. SendClientMessage(playerid, RED, string);
  1722. }
  1723. }
  1724. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1725. return 1;
  1726. }
  1727.  
  1728. if(strcmp(cmd, "/bslap", true) == 0) // Slap a player 2 times higher than /slap
  1729. {
  1730. new Float:pX,Float:pY,Float:pZ;
  1731. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1732. {
  1733. tmp = strtok(cmdtext, idx);
  1734. if(!strlen(tmp))
  1735. {
  1736. SendClientMessage(playerid, ORANGE, "USAGE: /bslap [playername/id]");
  1737. SendClientMessage(playerid, ORANGE, "FUNCTION: Will double slap the specified player");
  1738. return 1;
  1739. }
  1740.  
  1741. new giveplayerid = ReturnUser(tmp);
  1742. if(giveplayerid != INVALID_PLAYER_ID)
  1743. {
  1744. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1745. GetPlayerName(playerid, sendername, sizeof(sendername));
  1746. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1747. SetPlayerPos(giveplayerid,pX,pY,pZ+10);
  1748. format(string, sizeof(string), "-| Administrator %s bitch slapped %s |-",sendername, giveplayername);
  1749. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1750. }
  1751. else if(giveplayerid == INVALID_PLAYER_ID)
  1752. {
  1753. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1754. SendClientMessage(playerid, RED, string);
  1755. }
  1756. }
  1757. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1758. return 1;
  1759. }
  1760.  
  1761. if(strcmp(cmd, "/disarm", true) == 0) // Reset the player's weapons
  1762. {
  1763. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1764. {
  1765. tmp = strtok(cmdtext, idx);
  1766. if(!strlen(tmp))
  1767. {
  1768. SendClientMessage(playerid, ORANGE, "USAGE: /disarm [playername/id]");
  1769. SendClientMessage(playerid, ORANGE, "FUNCTION: Will disarm the player.");
  1770. return 1;
  1771. }
  1772.  
  1773. new giveplayerid = ReturnUser(tmp);
  1774. if(giveplayerid != INVALID_PLAYER_ID)
  1775. {
  1776. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1777. GetPlayerName(playerid, sendername, sizeof(sendername));
  1778. ResetPlayerWeapons(giveplayerid);
  1779. format(string, sizeof(string), "-| Administrator %s disarmed %s |-",sendername, giveplayername);
  1780. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1781. }
  1782. else if(giveplayerid == INVALID_PLAYER_ID)
  1783. {
  1784. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1785. SendClientMessage(playerid, RED, string);
  1786. }
  1787. }
  1788. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1789. return 1;
  1790. }
  1791.  
  1792. if(strcmp(cmd, "/say", true) == 0) // Publicly says an admin message. Exact same as RCON's 'say' but in a red color.
  1793. {
  1794. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1795. {
  1796. GetPlayerName(playerid, sendername, sizeof(sendername));
  1797. new result[128];
  1798. result = bigstrtok(cmdtext, idx);
  1799. if(!strlen(result))
  1800. {
  1801. SendClientMessage(playerid, ORANGE, "USAGE: /say [message]");
  1802. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast an admin message.");
  1803. return 1;
  1804. }
  1805. format(string, sizeof(string), "* Admin: %s", result);
  1806. SendClientMessageToAll(LIGHTRED, string);
  1807. printf("%s", string);
  1808. }
  1809. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1810. return 1;
  1811. }
  1812.  
  1813. if(strcmp(cmd, "/bc", true) == 0 || strcmp(cmd, "/broadcast", true) == 0) // Displays a screen message
  1814. {
  1815. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1816. {
  1817. GetPlayerName(playerid, sendername, sizeof(sendername));
  1818. new result[128];
  1819. result = bigstrtok(cmdtext, idx);
  1820. if(!strlen(result))
  1821. {
  1822. SendClientMessage(playerid, ORANGE, "USAGE: /bc [message] [time in seconds(if non entered, 5 seconds will be the time by default)]");
  1823. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast a screen message");
  1824. return 1;
  1825. }
  1826. new time;
  1827. tmp = strtok(cmdtext, idx);
  1828. if (!strlen(tmp)) time = 5;
  1829. else time = strval(tmp);
  1830. format(string, sizeof(string), "~w~%s", result);
  1831. GameTextForAll(string, time*1000, 4);
  1832. printf("%s", string);
  1833. }
  1834. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1835. return 1;
  1836. }
  1837.  
  1838. if(strcmp(cmd, "/veh", true) == 0) // Spawn a vehicle. Name supported too.
  1839. {
  1840. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1841. {
  1842. tmp = strtok(cmdtext, idx);
  1843. if(!strlen(tmp))
  1844. {
  1845. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1846. return 1;
  1847. }
  1848. new car = GetVehicleModelIDFromName(tmp);
  1849. if (car == -1)
  1850. {
  1851. car = strval(tmp);
  1852. if(car < 400 || car > 611) return SendClientMessage(playerid, RED, "Vehicle ID can't be below 400 nor above 611 !");
  1853. }
  1854.  
  1855. tmp = strtok(cmdtext, idx);
  1856. if(!strlen(tmp))
  1857. {
  1858. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1859. return 1;
  1860. }
  1861. new color1 = strval(tmp);
  1862.  
  1863. tmp = strtok(cmdtext, idx);
  1864. if(!strlen(tmp))
  1865. {
  1866. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1867. return 1;
  1868. }
  1869. new color2 = strval(tmp);
  1870.  
  1871. new Float:X,Float:Y,Float:Z,Float:A;
  1872. GetPlayerPos(playerid, X,Y,Z);
  1873. GetPlayerFacingAngle(playerid, A);
  1874. X += (5 * floatsin(-A, degrees));
  1875. Y += (5 * floatcos(-A, degrees));
  1876. new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 600000000);
  1877. format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
  1878. SendClientMessage(playerid, GREEN, string);
  1879. GetPlayerName(playerid,sendername,sizeof(sendername));
  1880. format(string, sizeof(string), "-| Administrator %s spawned a vehicle(%d) [ Model: %s ] |-", sendername, carid, VehNames[GetVehicleModel(carid)-400]);
  1881. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1882. }
  1883. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1884. return 1;
  1885. }
  1886.  
  1887. if(strcmp(cmd, "/pweapons", true) == 0) // Checks a player's weapons
  1888. {
  1889. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  1890. {
  1891. tmp = strtok(cmdtext, idx);
  1892. if(!strlen(tmp))
  1893. {
  1894. SendClientMessage(playerid, ORANGE, "USAGE: /pweapons [playerid/name]");
  1895. return 1;
  1896. }
  1897. new giveplayerid = ReturnUser(tmp);
  1898. if (giveplayerid != INVALID_PLAYER_ID)
  1899. {
  1900. new bullets[12];
  1901. new weapons[12];
  1902. new weapname[12][20];
  1903. for(new i = 0; i < 12; i++)
  1904. {
  1905. GetPlayerWeaponData(giveplayerid, i+1, weapons[i], bullets[i]);
  1906. GetWeaponName(weapons[i], weapname[i], 20);
  1907. }
  1908. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1909. format(string,sizeof(string)," |- %s's Weapons -|",giveplayername);
  1910. SendClientMessage(playerid,LIGHTGREEN,string);
  1911. format(string, sizeof(string),"%s(0) - %s(%d) - %s(%d) - %s(%d) - %s(%d) - %s(%d)",weapname[0],weapname[1],bullets[1],weapname[2],bullets[2],weapname[3],bullets[3],weapname[4],bullets[4],weapname[5],bullets[5]);
  1912. SendClientMessage(playerid,YELLOW,string);
  1913. format(string,sizeof(string),"%s(%d) - %s(%d) - %s(%d) - %s(0) - %s(0) - %s(0)",weapname[6],bullets[6],weapname[7],bullets[7],weapname[8],bullets[8],weapname[9],weapname[10],weapname[11]);
  1914. SendClientMessage(playerid,YELLOW,string);
  1915. }
  1916. else SendClientMessage(playerid, RED, "Player is not active.");
  1917. }
  1918. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1919. return 1;
  1920. }
  1921.  
  1922. if(strcmp(cmd, "/sethp", true) == 0) // Sets a player's health
  1923. {
  1924. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 3)
  1925. {
  1926. tmp = strtok(cmdtext, idx);
  1927. if(!strlen(tmp))
  1928. {
  1929. SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
  1930. return 1;
  1931. }
  1932. new targetid = ReturnUser(tmp);
  1933. tmp = strtok(cmdtext, idx);
  1934. new Float:hp = floatstr(tmp);
  1935. if (targetid != INVALID_PLAYER_ID)
  1936. {
  1937. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
  1938. SetPlayerHealth(targetid,hp);
  1939. if (hp < 1) Drugs[targetid] = 0;
  1940. GetPlayerName(playerid, sendername, sizeof(sendername));
  1941. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1942. format(string,sizeof(string),"|- Administrator %s has changed %s's HP. [HP: %.2f] -|",sendername,giveplayername,hp);
  1943. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1944. }
  1945. else SendClientMessage(playerid, RED, "Player is not active.");
  1946. }
  1947. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1948. return 1;
  1949. }
  1950.  
  1951. if (strcmp(cmd, "/logout", true) == 0) // Logs off the admin
  1952. {
  1953. if(AccountInfo[playerid][Logged] == 1)
  1954. {
  1955. if(AccountInfo[playerid][AdminLevel] >= 1)
  1956. {
  1957. OnPlayerUpdateAccount(playerid);
  1958. AccountInfo[playerid][Logged] = 0;
  1959. AccountInfo[playerid][AdminLevel] = 0;
  1960. SendClientMessage(playerid, GREEN, "You have successfuly logged out.");
  1961. }
  1962. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1963. }
  1964. else return SendClientMessage(playerid, RED, "You're not logged in! ( /login [password] )");
  1965. return 1;
  1966. }
  1967.  
  1968. if(strcmp(cmd, "/warn", true) == 0) // Warns a player. 3 warnings = auto-ban
  1969. {
  1970. if (AccountInfo[playerid][AdminLevel] >= 3)
  1971. {
  1972. tmp = strtok(cmdtext, idx);
  1973. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /warn [playername/id] [reason]");
  1974. new targetid = ReturnUser(tmp);
  1975. if(IsPlayerConnected(targetid))
  1976. {
  1977. if(targetid != INVALID_PLAYER_ID)
  1978. {
  1979. new reason[128];
  1980. reason = bigstrtok(cmdtext, idx);
  1981. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /warn [playername/id] [reason]");
  1982. new sstring[128];
  1983. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1984. GetPlayerName(playerid, sendername, sizeof(sendername));
  1985. AccountInfo[targetid][Warns] += 1;
  1986. format(string, sizeof(string), "You got warned by Admin %s. Reason: %s", sendername, reason);
  1987. SendClientMessage(targetid, ADMIN_RED, string);
  1988. format(string, sizeof(string), "-| Administrator %s warned %s. [Reason: %s ] |-", sendername,giveplayername, reason);
  1989. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1990. format(string, sizeof(string), "-| %s's warnings: %d |-",giveplayername, AccountInfo[targetid][Warns]);
  1991. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1992. if (AccountInfo[targetid][Warns] == 1) strmid(AccountInfo[targetid][WarnReason1], reason, 0, strlen(reason), 128);
  1993. else if (AccountInfo[targetid][Warns] == 2) strmid(AccountInfo[targetid][WarnReason2], reason, 0, strlen(reason), 128);
  1994. else if (AccountInfo[targetid][Warns] == 3) strmid(AccountInfo[targetid][WarnReason3], reason, 0, strlen(reason), 128);
  1995. SendClientMessage(targetid, RED, "3 Warnings = Auto-Ban!");
  1996. if(AccountInfo[targetid][Warns] >= 3)
  1997. {
  1998. new ip[128];
  1999. format(string, sizeof(string), "-| Administrator %s banned %s. [Reason: 3 Warnings...] |-", sendername,giveplayername);
  2000. BanLog(string);
  2001. SendClientMessageToAll(ADMIN_RED, string);
  2002. for(new i = 0; i < 3; i++)
  2003. {
  2004. if (i == 0) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason1]);
  2005. else if (i == 1) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason2]);
  2006. else if (i == 2) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason3]);
  2007. SendClientMessageToAll(ADMIN_RED, string);
  2008. }
  2009. GetPlayerIp(targetid,ip,128);
  2010. format(sstring, sizeof(sstring), "-| Banned Player's IP: %s |-", ip);
  2011. SendClientMessageToAdmins(ADMIN_RED, sstring,1);
  2012. AccountInfo[targetid][AdminLevel]= 0;
  2013. AccountInfo[targetid][Warns] = 0;
  2014. format(AccountInfo[targetid][WarnReason1], 128, "NONE");
  2015. format(AccountInfo[targetid][WarnReason2], 128, "NONE");
  2016. format(AccountInfo[targetid][WarnReason3], 128, "NONE");
  2017. Ban(giveplayerid);
  2018. return 1;
  2019. }
  2020. }
  2021. else
  2022. {
  2023. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2024. SendClientMessage(playerid, RED, string);
  2025. }
  2026. }
  2027. else
  2028. {
  2029. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2030. SendClientMessage(playerid, RED, string);
  2031. }
  2032. }
  2033. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2034. return 1;
  2035. }
  2036.  
  2037. if(strcmp(cmd, "/pstats", true) == 0) // Views the player's stats
  2038. {
  2039. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  2040. {
  2041. tmp = strtok(cmdtext, idx);
  2042. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /pstats [playername/id]");
  2043. new targetid = ReturnUser(tmp);
  2044. if (targetid != INVALID_PLAYER_ID)
  2045. {
  2046. new Float:health,Float:armor;
  2047. GetPlayerHealth(targetid,health);
  2048. GetPlayerArmour(targetid,armor);
  2049. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2050. format(string, sizeof(string), "Stats of %s: Health: '%.2f' - Cash: '$%d' - Warnings: '%d' - Armor: '%.2f'",giveplayername, health,GetPlayerMoney(targetid),AccountInfo[targetid][Warns],armor);
  2051. SendClientMessage(playerid,PURPLE,string);
  2052. if(AccountInfo[giveplayerid][Logged] == 1) SendClientMessage(playerid, PURPLE, "Logged In: Yes");
  2053. else if(AccountInfo[giveplayerid][Logged] == 0) SendClientMessage(playerid, PURPLE, "Logged In: No");
  2054. SendClientMessage(playerid,YELLOW,"Type /pweapons [playername/id] to check the player's weapons");
  2055. }
  2056. else SendClientMessage(playerid, RED, "Player is not active.");
  2057. }
  2058. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2059. return 1;
  2060. }
  2061.  
  2062. if(strcmp(cmd, "/fuck", true) == 0) // Sends a player in the air and explodes
  2063. {
  2064. new Float:pX,Float:pY,Float:pZ;
  2065. new Float:X,Float:Y,Float:Z;
  2066. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  2067. {
  2068. tmp = strtok(cmdtext, idx);
  2069. if(!strlen(tmp))
  2070. {
  2071. SendClientMessage(playerid, ORANGE, "USAGE: /fuck [playerid]");
  2072. SendClientMessage(playerid, ORANGE, "FUNCTION: Will fuck up a player.");
  2073. return 1;
  2074. }
  2075.  
  2076. new targetid = ReturnUser(tmp);
  2077. if(targetid != INVALID_PLAYER_ID)
  2078. {
  2079. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2080. GetPlayerName(playerid, sendername, sizeof(sendername));
  2081. GetPlayerPos(targetid,pX,pY,pZ);
  2082. CreateExplosion(X,Y,Z+50,2,5.0);
  2083. SetPlayerPos(targetid,pX,pY,pZ+50);
  2084. format(string, sizeof(string), "-| Administrator %s fucked %s up |-",sendername, giveplayername);
  2085. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2086. SendClientMessage(targetid, RED, "You've been fucked up by an admin.");
  2087. }
  2088. else if(giveplayerid == INVALID_PLAYER_ID)
  2089. {
  2090. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2091. SendClientMessage(playerid, RED, string);
  2092. }
  2093. }
  2094. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2095. return 1;
  2096. }
  2097.  
  2098. if(strcmp(cmd, "/giveweapon", true) == 0) // Gives a weapon to a player
  2099. {
  2100. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  2101. {
  2102. tmp = strtok(cmdtext, idx);
  2103. if(!strlen(tmp))
  2104. {
  2105. SendClientMessage(playerid, ORANGE, "USAGE: /giveweapon [playername/id] [weaponid] [ammo]");
  2106. return 1;
  2107. }
  2108. new gun;
  2109. new ammo;
  2110. new targetid = ReturnUser(tmp);
  2111. tmp = strtok(cmdtext, idx);
  2112. gun = strval(tmp);
  2113. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /giveweapon [playername/id] [weaponid] [ammo]");
  2114. tmp = strtok(cmdtext, idx);
  2115. ammo = strval(tmp);
  2116. if(targetid != INVALID_PLAYER_ID)
  2117. {
  2118. new weap[50];
  2119. GetPlayerName(playerid, sendername, sizeof(sendername));
  2120. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2121. GivePlayerWeapon(targetid, gun, ammo);
  2122. GetWeaponName(gun, weap, sizeof weap);
  2123. format(string, sizeof(string), "-| Administrator %s gave a weapon(%s) to %s |-",sendername, weap, giveplayername);
  2124. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2125. }
  2126. else if(targetid == INVALID_PLAYER_ID)
  2127. {
  2128. format(string, sizeof(string), "%d is not an active player.", targetid);
  2129. SendClientMessage(playerid, RED, string);
  2130. }
  2131. }
  2132. else SendClientMessage(playerid, RED, "You are not an admin with the required level!");
  2133. return 1;
  2134. }
  2135. if(strcmp(cmd, "/crash", true) == 0) // Crashes a player's client
  2136. {
  2137. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  2138. {
  2139. tmp = strtok(cmdtext, idx);
  2140. if(!strlen(tmp))
  2141. {
  2142. SendClientMessage(playerid, ORANGE, "USAGE: /crash [playername/id]");
  2143. SendClientMessage(playerid, ORANGE, "FUNCTION: Will crash a player.");
  2144. return 1;
  2145. }
  2146. new Float:X,Float:Y,Float:Z;
  2147. new targetid = ReturnUser(tmp);
  2148. if(IsPlayerConnected(targetid))
  2149. {
  2150. GetPlayerPos(giveplayerid,X,Y,Z);
  2151. new objectcrash = CreatePlayerObject(targetid,666666,X,Y,Z,0,0,0); // double-devil has spoken
  2152. SendClientMessage(playerid,GREEN, "Player successfuly crashed.");
  2153. DestroyPlayerObject(targetid, objectcrash);
  2154. }
  2155. else if (!IsPlayerConnected(giveplayerid))
  2156. {
  2157. format(string, sizeof(string), "%d is not an active player.", targetid);
  2158. SendClientMessage(playerid, RED, string);
  2159. }
  2160. }
  2161. else SendClientMessage(playerid, RED, "You're not a lead admin.");
  2162. return 1;
  2163. }
  2164.  
  2165. if(strcmp(cmd, "/setwarn", true) == 0) // Sets the player's warnings
  2166. {
  2167. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  2168. {
  2169. tmp = strtok(cmdtext, idx);
  2170. if(!strlen(tmp))
  2171. {
  2172. SendClientMessage(playerid, ORANGE, "USAGE: /setwarn [playername/id] [warning]");
  2173. SendClientMessage(playerid, ORANGE, "FUNCTION: Will set a certain player's warning.");
  2174. return 1;
  2175. }
  2176. new targetid = ReturnUser(tmp);
  2177. if(targetid != INVALID_PLAYER_ID)
  2178. {
  2179. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2180. GetPlayerName(playerid, sendername, sizeof(sendername));
  2181. tmp = strtok(cmdtext, idx);
  2182. new warnings = strval(tmp);
  2183. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setwarn [playername/id] [warning]");
  2184. AccountInfo[targetid][Warns] = warnings;
  2185. format(string, sizeof(string), "Admin %s changed your warnings to %d", sendername, warnings);
  2186. SendClientMessage(targetid, GREEN, string);
  2187. SendClientMessage(targetid, RED, "3 Warnings = Auto-Ban! Ask an admin to check how many warnings you have");
  2188. format(string, sizeof(string), "-| Administrator %s changed %s's warnings. [Warnings: %d ] |-",sendername,giveplayername, AccountInfo[giveplayerid][Warns]);
  2189. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2190. }
  2191. else if(giveplayerid == INVALID_PLAYER_ID)
  2192. {
  2193. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2194. SendClientMessage(playerid, RED, string);
  2195. }
  2196. }
  2197. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2198. return 1;
  2199. }
  2200.  
  2201. if(strcmp(cmd, "/an", true) == 0 || strcmp(cmd, "/announce", true) == 0) // Broadcasts an 'announcement' message.
  2202. {
  2203. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  2204. {
  2205. GetPlayerName(playerid, sendername, sizeof(sendername));
  2206. new result[128];
  2207. result = bigstrtok(cmdtext, idx);
  2208. if(!strlen(result))
  2209. {
  2210. SendClientMessage(playerid, ORANGE, "USAGE: /(an)nounce [message]");
  2211. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast an announcement.");
  2212. return 1;
  2213. }
  2214. format(string, sizeof(string), "%s", result);
  2215. SendClientMessageToAll(AQUAGREEN, string);
  2216. printf("Announcement by %s: %s", sendername, string);
  2217. }
  2218. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2219. return 1;
  2220. }
  2221.  
  2222. if(strcmp(cmd, "/superpunch", true) == 0) // Triggers an explosion when you use the punch key
  2223. {
  2224. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  2225. {
  2226. tmp = strtok(cmdtext,idx);
  2227. if(!strlen(tmp))
  2228. {
  2229. SendClientMessage(playerid, ORANGE, "USAGE: /superpunch [on/off]");
  2230. SendClientMessage(playerid, ORANGE, "FUNCTION: Will give you the power of Super Punch. When pressing 'PUNCH' button, you will explode but will live.");
  2231. }
  2232. else if(strcmp(tmp,"on",true) == 0)
  2233. {
  2234. SuperPunch[playerid] = 1;
  2235. SendClientMessage(playerid,GREEN,"You are now blessed with SUPER PUNCH! Go knock someone out.");
  2236. }
  2237. else if(strcmp(tmp,"off",true) == 0)
  2238. {
  2239. SuperPunch[playerid] = 0;
  2240. SendClientMessage(playerid,GREEN,"Your super punch is now disabled.");
  2241. }
  2242. }
  2243. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2244. return 1;
  2245. }
  2246.  
  2247. if (strcmp(cmd, "/superpunchp", true) == 0) // Gives the Super Punch ability to a player
  2248. {
  2249. new tmp2[128];
  2250. if (AccountInfo[playerid][AdminLevel] > 4 || IsPlayerAdmin(playerid))
  2251. {
  2252. tmp = strtok(cmdtext,idx);
  2253. if(!strlen(tmp))
  2254. {
  2255. SendClientMessage(playerid,ORANGE,"USAGE: /superpunchp [playername/id] [on/off]");
  2256. SendClientMessage(playerid,ORANGE,"FUNCTION: Will give the player the power of SuperPunch.");
  2257. }
  2258. new targetid = ReturnUser(tmp);
  2259. if(targetid != INVALID_PLAYER_ID)
  2260. {
  2261. tmp2 = strtok(cmdtext,idx);
  2262. if(strcmp(tmp2,"on",true) == 0)
  2263. {
  2264. GetPlayerName(playerid, sendername, sizeof(sendername));
  2265. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2266. SuperPunch[targetid] = 1;
  2267. format(string, sizeof(string), "Admin %s blessed you with the power of Super Punch !", sendername);
  2268. SendClientMessage(targetid,GREEN,string);
  2269. format(string, sizeof(string), "-| Administrator %s blessed %s with the power of Super Punch |-", sendername,giveplayername);
  2270. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2271. }
  2272. else if(strcmp(tmp2,"off",true) == 0)
  2273. {
  2274. format(string, sizeof(string), "Admin %s removed your Super Punch power.", sendername);
  2275. SendClientMessage(targetid,RED,string);
  2276. SuperPunch[targetid] = 0;
  2277. }
  2278. }
  2279. else if(giveplayerid == INVALID_PLAYER_ID)
  2280. {
  2281. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2282. SendClientMessage(playerid,RED,string);
  2283. }
  2284. }
  2285. else SendClientMessage(playerid,RED,"You are not an admin with the required level.");
  2286. return 1;
  2287. }
  2288.  
  2289. if(strcmp(cmd, "/viewcmds", true) == 0) // Views unknown commands and commands mentioned in 'ViewCommands' variable entered by players
  2290. {
  2291. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  2292. {
  2293. tmp = strtok(cmdtext,idx);
  2294. if(!strlen(tmp))
  2295. {
  2296. SendClientMessage(playerid, ORANGE, "USAGE: /viewcmds [on/off]");
  2297. SendClientMessage(playerid, ORANGE, "FUNCTION: Will see the players typing some commands and wrong commands.");
  2298. }
  2299. else if(strcmp(tmp,"on",true) == 0)
  2300. {
  2301. ViewCmds[playerid] = 1;
  2302. SendClientMessage(playerid,GREEN,"You can know view players typing some commands and wrong commands.");
  2303. }
  2304. else if(strcmp(tmp,"off",true) == 0)
  2305. {
  2306. ViewCmds[playerid] = 0;
  2307. SendClientMessage(playerid,GREEN,"You can no longer view players typing some commands and wrong commands.");
  2308. }
  2309. }
  2310. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2311. return 1;
  2312. }
  2313.  
  2314. if(strcmp(cmd, "/jail", true) == 0) // Jails a player
  2315. {
  2316. if (AccountInfo[playerid][AdminLevel] >= 2)
  2317. {
  2318. tmp = strtok(cmdtext, idx);
  2319. if(!strlen(tmp))
  2320. {
  2321. SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
  2322. return 1;
  2323. }
  2324. new targetid = ReturnUser(tmp);
  2325. if(IsPlayerConnected(targetid))
  2326. {
  2327. if(targetid != INVALID_PLAYER_ID)
  2328. {
  2329. if(AccountInfo[giveplayerid][Jail] == 0)
  2330. {
  2331. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2332. GetPlayerName(playerid, sendername, sizeof(sendername));
  2333. new reason[128];
  2334. reason = bigstrtok(cmdtext, idx);
  2335. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
  2336. format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
  2337. SendClientMessage(targetid, ADMIN_RED, string);
  2338. format(string, sizeof(string), "-| Administrator %s jailed %s. [ Reason: %s ] |-",sendername,giveplayername, reason);
  2339. SendClientMessageToAll(ADMIN_RED,string);
  2340. AccountInfo[targetid][Jail] = 1;
  2341. OnPlayerJailed(targetid);
  2342. return 1;
  2343. }
  2344. else SendClientMessage(playerid, RED, "Player is already jailed!");
  2345. }
  2346. else
  2347. {
  2348. format(string, sizeof(string), "%d is not an active player.", targetid);
  2349. SendClientMessage(playerid, RED, string);
  2350. }
  2351. }
  2352. else
  2353. {
  2354. format(string, sizeof(string), "%d is not an active player.", targetid);
  2355. SendClientMessage(playerid, RED, string);
  2356. }
  2357. }
  2358. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2359. return 1;
  2360. }
  2361.  
  2362. if(strcmp(cmd, "/unjail", true) == 0) // Unjails a player
  2363. {
  2364. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  2365. {
  2366. tmp = strtok(cmdtext, idx);
  2367. if(!strlen(tmp))
  2368. {
  2369. SendClientMessage(playerid, ORANGE, "USAGE: /unjail [playername/id]");
  2370. return 1;
  2371. }
  2372.  
  2373. new targetid = ReturnUser(tmp);
  2374. if(targetid != INVALID_PLAYER_ID)
  2375. {
  2376. if(AccountInfo[giveplayerid][Jail] == 1)
  2377. {
  2378. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2379. GetPlayerName(playerid, sendername, sizeof(sendername));
  2380. format(string, sizeof(string), "-| Administrator %s unjailed %s |-",sendername, giveplayername);
  2381. SendClientMessageToAll(ADMIN_RED,string);
  2382. AccountInfo[targetid][Jail] = 0;
  2383. OnPlayerUnjailed(targetid);
  2384. }
  2385. else SendClientMessage(playerid, RED, "Player is not jailed!");
  2386. }
  2387. else
  2388. {
  2389. format(string, sizeof(string), "%d is not an active player.", targetid);
  2390. SendClientMessage(playerid, RED, string);
  2391. }
  2392. }
  2393. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2394. return 1;
  2395. }
  2396.  
  2397. if(strcmp(cmd, "/gotoveh", true) == 0) // Teleports to a vehicle's position
  2398. {
  2399. tmp = strtok(cmdtext, idx);
  2400. if(!strlen(tmp))
  2401. {
  2402. SendClientMessage(playerid, ORANGE, "USAGE: /gotoveh [vehicleid]");
  2403. return 1;
  2404. }
  2405. new car = strval(tmp);
  2406. if (AccountInfo[playerid][AdminLevel] >= 3)
  2407. {
  2408. new Float:vx,Float:vy,Float:vz;
  2409. GetVehiclePos(car,vx,vy,vz);
  2410. if (GetPlayerState(playerid) == 2)
  2411. SetVehiclePos(GetPlayerVehicleID(playerid),vx,vy+2,vz);
  2412. else
  2413. SetPlayerPos(playerid,vx,vy,vz+1);
  2414. SetPlayerInterior(playerid,0);
  2415. format(string,256,"You have teleported to vehicle id %d(%s)",car, VehNames[GetVehicleModel(car)-400]);
  2416. SendClientMessage(playerid,GREEN,string);
  2417. }
  2418. else SendClientMessage(playerid,RED,"You're not an admin with the required level");
  2419. return 1;
  2420. }
  2421. if(!strcmp(cmdtext, "/aclearchat", true)) // Clears the chatbox for everyone
  2422. {
  2423. if(AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  2424. {
  2425. for(new chat = 0; chat <= 50; chat++) SendClientMessageToAll(GREEN, " ");
  2426. GetPlayerName(playerid, sendername, 20);
  2427. format(string, 256, "-| Administrator %s cleared the chat |-", sendername);
  2428. SendClientMessageToAll(ADMIN_RED, string);
  2429. return 1;
  2430. }
  2431. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2432. return 1;
  2433. }
  2434. if(strcmp(cmd, "/hide", true) == 0) // Hides you from the admin list
  2435. {
  2436. if (AccountInfo[playerid][AdminLevel] >= 4)
  2437. {
  2438. Hide[playerid] = 1;
  2439. SendClientMessage(playerid,GREEN,"|- You're now hidden from the admin list -|");
  2440. }
  2441. return 1;
  2442. }
  2443. if(strcmp(cmd, "/unhide", true) == 0)
  2444. {
  2445. if (AccountInfo[playerid][AdminLevel] >= 4) // Unhides you from the admin list
  2446. {
  2447. if (Hide[playerid] != 1) return SendClientMessage(playerid,RED,"You're not hidden in the admin list!");
  2448. Hide[playerid] = 0;
  2449. SendClientMessage(playerid,GREEN,"|- You're now visible in the admin list -|");
  2450. }
  2451. return 1;
  2452. }
  2453.  
  2454. if(strcmp(cmd, "/virtual", true) == 0) // Sets the player's virtual world
  2455. {
  2456. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 2)
  2457. {
  2458. tmp = strtok(cmdtext, idx);
  2459. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /virtual [playerid/name] [virtual world (0-255)]");
  2460. new targetid = ReturnUser(tmp);
  2461. tmp = strtok(cmdtext, idx);
  2462. new v = strval(tmp);
  2463. if (targetid != INVALID_PLAYER_ID)
  2464. {
  2465. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /virtual [playerid/name] [virtual world (0-255)]");
  2466. SetPlayerVirtualWorld(targetid,v);
  2467. GetPlayerName(playerid, sendername, sizeof(sendername));
  2468. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2469. format(string,sizeof(string),"|- Administrator %s has changed %s's Virtual World. [World: %d] -|",sendername,giveplayername,v);
  2470. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2471. }
  2472. else SendClientMessage(playerid, RED, "Player is not active.");
  2473. }
  2474. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2475. return 1;
  2476. }
  2477.  
  2478. if(strcmp(cmd,"/count", true) == 0) // Starts a count down
  2479. {
  2480. tmp = strtok(cmdtext, idx);
  2481. new count = strval(tmp);
  2482. if (!strlen(tmp)) count = 5;
  2483. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin");
  2484. if (Count > 0) return SendClientMessage(playerid, RED, "Countdown is already in progress.");
  2485. GetPlayerName(playerid, sendername, sizeof(sendername));
  2486. format(string,sizeof(string),"|- Administrator %s started a countdown from %d -|", sendername, count);
  2487. SendClientMessageToAll(LIGHTGREEN, string);
  2488. Count = count;
  2489. CountDown();
  2490. return 1;
  2491. }
  2492.  
  2493. if(strcmp(cmd, "/view", true) == 0) // Spectates a player
  2494. {
  2495. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin !");
  2496. tmp = strtok(cmdtext, idx);
  2497. if(!strlen(tmp))
  2498. {
  2499. SendClientMessage(playerid, ORANGE, "|__________________________________|");
  2500. SendClientMessage(playerid, ORANGE, "USAGE: /view [playerid]");
  2501. SendClientMessage(playerid, ORANGE, "FUNCTION: Will spectate a player.");
  2502. SendClientMessage(playerid, ORANGE, "HELP: /view off to stop spectating");
  2503. SendClientMessage(playerid, ORANGE, "|__________________________________|");
  2504. return 1;
  2505. }
  2506. new targetid = ReturnUser(tmp);
  2507. if (giveplayerid != INVALID_PLAYER_ID)
  2508. {
  2509. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin !");
  2510. TogglePlayerSpectating(playerid, 1);
  2511. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(targetid));
  2512. SetPlayerInterior(playerid,GetPlayerInterior(targetid));
  2513. if (IsPlayerInAnyVehicle(targetid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(targetid));
  2514. else PlayerSpectatePlayer(playerid, targetid);
  2515. SendClientMessage(playerid, ORANGE, "HELP: '/view off' to stop spectating");
  2516. }
  2517. else if(strcmp(tmp, "off", true) == 0)
  2518. {
  2519. TogglePlayerSpectating(playerid, 0);
  2520. SetPlayerVirtualWorld(playerid,0);
  2521. }
  2522. else
  2523. {
  2524. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2525. SendClientMessage(playerid, RED, string);
  2526. }
  2527. return 1;
  2528. }
  2529.  
  2530. if(strcmp(cmd, "/blockpm", true) == 0) // Blocks PMs
  2531. {
  2532. if (AccountInfo[playerid][AdminLevel] >= 5)
  2533. {
  2534. if (PMBlock[playerid] == true)
  2535. {
  2536. PMBlock[playerid] = false;
  2537. SendClientMessage(playerid, GREEN, "|- Private messages BLOCKED -|");
  2538. return 1;
  2539. }
  2540. if (PMBlock[playerid] == false)
  2541. {
  2542. PMBlock[playerid] = true;
  2543. SendClientMessage(playerid, GREEN, "|- Private messages UNBLOCKED -|");
  2544. return 1;
  2545. }
  2546. }
  2547. else return SendClientMessage(playerid, RED, "You're not a lead admin!");
  2548. }
  2549.  
  2550. if(!strcmp(cmd, "/seifocalypse", true)) // Launches explosion(s) in front of the player(it follow the previous explosion so it goes straight) as many times has he wants
  2551. {
  2552. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  2553. {
  2554. tmp = strtok(cmdtext, idx);
  2555. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /seifocalypse [explosions]");
  2556. new Float:X,Float:Y,Float:Z,Float:A;
  2557. GetPlayerPos(playerid, X,Y,Z);
  2558. GetPlayerFacingAngle(playerid, A);
  2559. Nuke[playerid] = 1;
  2560. SetTimerEx("NukeBlast", 200, 0, "ddffff",playerid, strval(tmp), X, Y, Z, A);
  2561. }
  2562. else return SendClientMessage(playerid, RED, "You're not a lead admin!");
  2563. return 1;
  2564. }
  2565.  
  2566. if(!strcmp(cmd, "/missile", true)) // Spawns a missile 50 Z higher than player's and drops it to the ground, toggling a huge explosion
  2567. {
  2568. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  2569. {
  2570. if (IsValidObject(Missile[playerid])) return SendClientMessage(playerid, RED, "You already dropped a missile that's currently in progress of exploding");
  2571. new Float:X,Float:Y,Float:Z;
  2572. GetPlayerPos(playerid, X,Y,Z);
  2573. Missile[playerid] = CreateObject(3786, X, Y, Z+50, 357.6293, 272.3375, 6.8755);
  2574. MoveObject(Missile[playerid], X, Y, Z, 20.0);
  2575. }
  2576. else return SendClientMessage(playerid, RED, "You're not a lead admin!");
  2577. return 1;
  2578. }
  2579.  
  2580. if (!strcmp(cmd, "/push", true)) // Pushes a player back. Player gets pushed back in motions
  2581. {
  2582. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 3)
  2583. {
  2584. tmp = strtok(cmdtext, idx);
  2585. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /push [playername/id]");
  2586. new targetid = ReturnUser(tmp);
  2587. if (targetid != INVALID_PLAYER_ID)
  2588. {
  2589. PushPlayer(targetid, 20, true);
  2590. GetPlayerName(playerid, sendername, sizeof(sendername));
  2591. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2592. format(string,sizeof(string),"|- Administrator %s has pushed %s -|", sendername, giveplayername);
  2593. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  2594. }
  2595. else SendClientMessage(playerid, RED, "Player is not active.");
  2596. }
  2597. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2598. return 1;
  2599. }
  2600.  
  2601. if (!strcmp(cmd, "/setgravity", true)) // Changes gravity
  2602. {
  2603. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 4)
  2604. {
  2605. tmp = strtok(cmdtext, idx);
  2606. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /pussetgravity [gravity float]");
  2607. new Float:gravity = floatstr(tmp);
  2608. SetGravity(gravity);
  2609. GetPlayerName(playerid, sendername, sizeof(sendername));
  2610. format(string,sizeof(string),"|- Administrator %s has changed gravity [ Gravity: %.4f ] -|", sendername, gravity);
  2611. SendClientMessageToAll(ADMIN_RED, string);
  2612. }
  2613. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2614. return 1;
  2615. }
  2616.  
  2617. if (!strcmp(cmd, "/settime", true)) // Changes time
  2618. {
  2619. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 3)
  2620. {
  2621. tmp = strtok(cmdtext, idx);
  2622. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /settime [time(0-23)]");
  2623. new time = strval(tmp);
  2624. if (time < 0 || time > 23) return SendClientMessage(playerid, RED, "Time can only be from 0 to 23!");
  2625. SetWorldTime(time);
  2626. GetPlayerName(playerid, sendername, sizeof(sendername));
  2627. format(string,sizeof(string),"|- Administrator %s has changed time [ Hour: %d ] -|", sendername, time);
  2628. SendClientMessageToAll(ADMIN_RED, string);
  2629. }
  2630. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2631. return 1;
  2632. }
  2633.  
  2634. if (!strcmp(cmd, "/setweather", true)) // Changes time
  2635. {
  2636. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 4)
  2637. {
  2638. tmp = strtok(cmdtext, idx);
  2639. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setweather [weather id]");
  2640. new weather = strval(tmp);
  2641. SetWeather(weather);
  2642. GetPlayerName(playerid, sendername, sizeof(sendername));
  2643. format(string,sizeof(string),"|- Administrator %s has changed weather [ Weather: %d ] -|", sendername, weather);
  2644. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  2645. }
  2646. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2647. return 1;
  2648. }
  2649.  
  2650. if(strcmp(cmd, "/report", true) == 0) // Available for everyone: reports a player to the admins
  2651. {
  2652. tmp = strtok(cmdtext, idx);
  2653. if(!strlen(tmp))
  2654. {
  2655. SendClientMessage(playerid, ORANGE, "USAGE: /report [playername/id] [reason]");
  2656. SendClientMessage(playerid, ORANGE, "FUNCTION: Will report the specified player to the administrators(online).");
  2657. return 1;
  2658. }
  2659. new targetid = ReturnUser(tmp);
  2660. if(targetid != INVALID_PLAYER_ID)
  2661. {
  2662. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2663. GetPlayerName(playerid, sendername, sizeof(sendername));
  2664. new reason[128];
  2665. reason = bigstrtok(cmdtext, idx);
  2666. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /report [playerid] [reason]");
  2667. format(string, sizeof(string), "|- %s reported %s [ Reason: %s ]", sendername,giveplayername,reason);
  2668. SendClientMessageToAdmins(ADMIN_RED, string,1);
  2669. format(string, sizeof(string), "Your report on '%s' has been sent to the current online admins. Thank you.", giveplayername);
  2670. SendClientMessage(playerid, GREEN, string);
  2671. }
  2672.  
  2673. else if(giveplayerid == INVALID_PLAYER_ID)
  2674. {
  2675. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2676. SendClientMessage(playerid, RED, string);
  2677. }
  2678. return 1;
  2679. }
  2680.  
  2681. if(strcmp(cmd, "/ah", true) == 0 || strcmp(cmd, "/ahelp", true) == 0 || strcmp(cmd, "/acommands", true) == 0) // List of admin commands
  2682. {
  2683. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  2684. {
  2685. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2686. SendClientMessage(playerid, ORANGE, "LEAD(5): /gmx /makeadmin /kickall /crash /blockpm /seifocalypse /missile");
  2687. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /setscore /angle /kick /setname /kill /goto /ip /pweapons /view /changepassword");
  2688. SendClientMessage(playerid, ORANGE, "LEVEL 2+: /(un)mute /givecash /get /pstats /warn /viewcmds /logout /demolish /virtual");
  2689. SendClientMessage(playerid, ORANGE, "LEVEL 3+: /nuke /ban /disarm /say /giveweapon /slap /gotoveh /(un)jail /sethp /push /settime");
  2690. SendClientMessage(playerid, ORANGE, "LEVEL 4+: /fuck /bc /setwarn /announce /aclearchat /bslap /(un)hide /rangeban /teleport /setgravity /setweather");
  2691. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: // Example: //hello");
  2692. }
  2693. else SendClientMessage(playerid, RED, "You are not an admin!");
  2694. return 1;
  2695. }
  2696.  
  2697.  
  2698. if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
  2699. {
  2700. new count = 0;
  2701. SendClientMessage(playerid, GREEN, " [Online Admins]");
  2702. for(new i = 0; i < MAX_PLAYERS; i++)
  2703. {
  2704. if (IsPlayerConnected(i))
  2705. {
  2706. if(AccountInfo[i][AdminLevel] >= 1 && AccountInfo[i][AdminLevel] <= 5 && Hide[i] == 0)
  2707. {
  2708. GetPlayerName(i, sendername, sizeof(sendername));
  2709. format(string, 128, "Level %d [%i]%s", AccountInfo[i][AdminLevel],i,sendername);
  2710. SendClientMessage(playerid, LIGHTGREEN, string);
  2711. count++;
  2712. }
  2713. }
  2714. }
  2715. if (count == 0) SendClientMessage(playerid,RED,"No admin online in the list");
  2716. SendClientMessage(playerid, GREEN, "[____________________________________]");
  2717. return 1;
  2718. }
  2719.  
  2720. if (strcmp(cmd, "/register", true) == 0) // Registers an account
  2721. {
  2722. if(IsPlayerConnected(playerid))
  2723. {
  2724. if(AccountInfo[playerid][Logged] == 1)
  2725. {
  2726. SendClientMessage(playerid, RED, "You are already logged in.");
  2727. return 1;
  2728. }
  2729. GetPlayerName(playerid, sendername, sizeof(sendername));
  2730. format(string, sizeof(string), "/sAccounts/%s.seifadmin", sendername);
  2731. new File: hFile = fopen(string, io_read);
  2732. if (hFile)
  2733. {
  2734. SendClientMessage(playerid, RED, "That name is already taken. Please reconnect using a different username.");
  2735. fclose(hFile);
  2736. return 1;
  2737. }
  2738. new tmppass[128];
  2739. tmp = strtok(cmdtext, idx);
  2740. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /register [password]");
  2741. strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
  2742. OnPlayerRegister(playerid, MD5_Hash(tmppass));
  2743. }
  2744. return 1;
  2745. }
  2746.  
  2747. if (strcmp(cmd, "/login", true) == 0) // Logins
  2748. {
  2749. new tmppass[128];
  2750. if(AccountInfo[playerid][Logged] == 1) return SendClientMessage(playerid, RED, "You are already logged in.");
  2751. tmp = strtok(cmdtext, idx);
  2752. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /login [password]");
  2753. new plname[MAX_PLAYER_NAME];
  2754. GetPlayerName(playerid, plname, sizeof(plname));
  2755. format(string, sizeof(string), "/sAccounts/%s.seifadmin", plname);
  2756. if(!fexist(string)) return SendClientMessage(playerid, RED, "That account isn't registered! Please register: /register [password]");
  2757. strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
  2758. OnPlayerLogin(playerid, MD5_Hash(tmppass));
  2759. return 1;
  2760. }
  2761.  
  2762. if (!strcmp(cmd, "/changepassword", true)) // Changes your password
  2763. {
  2764. if (!AccountInfo[playerid][Logged]) return SendClientMessage(playerid, RED, "You're not logged in.");
  2765. if (AccountInfo[playerid][AdminLevel] >= 1)
  2766. {
  2767. new oldpass[128];
  2768. oldpass = strtok(cmdtext, idx);
  2769. if(!strlen(oldpass)) return SendClientMessage(playerid, ORANGE, "USAGE: /changepassword [CURRENT PASSWORD] [new password]");
  2770. if (strcmp(MD5_Hash(oldpass), AccountInfo[playerid][Password], true)) return SendClientMessage(playerid, RED, "Invalid password.");
  2771. tmp = strtok(cmdtext, idx);
  2772. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /changepassword [current password] [NEW PASSWORD]");
  2773. format(oldpass, 128, "|- You've changed your password to '%s' -|", tmp);
  2774. SendClientMessage(playerid, LIGHTGREEN, oldpass);
  2775. strmid(AccountInfo[playerid][Password], MD5_Hash(tmp), 0, strlen(MD5_Hash(tmp)), 128);
  2776. }
  2777. return 1;
  2778. }
  2779.  
  2780. /*»»»»»»»»»»»»»»»»»»»»»»»»»»»» [WRONG COMMAND] «««««««««««««««««««««««««««*/
  2781. else
  2782. {
  2783. for(new i = 0; i < GetMaxPlayers(); i++)
  2784. {
  2785. if (IsPlayerConnected(i))
  2786. {
  2787. if (AccountInfo[i][AdminLevel] > 0 && ViewCmds[i] == 1)
  2788. {
  2789. GetPlayerName(playerid, sendername, sizeof sendername);
  2790. format(tmp, 128, "[VIEWCMDS] [%d]%s: %s", playerid, sendername, cmdtext);
  2791. SendClientMessage(i, PURPLE, tmp);
  2792. }
  2793. }
  2794. }
  2795. return 0;
  2796. }
  2797. }
  2798.  
  2799. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2800. {
  2801. if (SuperPunch[playerid] == 1)
  2802. {
  2803. if (GetPlayerState(playerid) != 2)
  2804. {
  2805. if (newkeys & KEY_FIRE && Drugs[playerid] == 0)
  2806. {
  2807. new Float:X,Float:Y,Float:Z,Float:Health;
  2808. GetPlayerHealth(playerid,Health);
  2809. if (GetPlayerWeapon(playerid) == 0)
  2810. {
  2811. GetPlayerPos(playerid,X,Y,Z);
  2812. CreateExplosion(X,Y,Z,7,7.0);
  2813. SetPlayerHealth(playerid,Health);
  2814. }
  2815. }
  2816. else if (newkeys & KEY_FIRE && Drugs[playerid] == 1)
  2817. {
  2818. new Float:X,Float:Y,Float:Z;
  2819. if (GetPlayerWeapon(playerid) == 0)
  2820. {
  2821. SetPlayerHealth(playerid,999999999);
  2822. GetPlayerPos(playerid,X,Y,Z);
  2823. CreateExplosion(X,Y,Z,7,7.0);
  2824. SetPlayerHealth(playerid,999999999);
  2825. }
  2826. }
  2827. }
  2828. }
  2829. }
  2830.  
  2831. OnPlayerJailed(playerid)
  2832. {
  2833. SetPlayerInterior(playerid, 6);
  2834. SetPlayerPos(playerid, 264.3700,77.5700,1001.0391);
  2835. SetPlayerFacingAngle(playerid, 272.6900);
  2836. TogglePlayerControllable(playerid, 0);
  2837. return 1;
  2838. }
  2839.  
  2840. OnPlayerUnjailed(playerid)
  2841. {
  2842. SetPlayerInterior(playerid, 6);
  2843. SetPlayerPos(playerid, 266.9272,78.6098,1001.0391);
  2844. SetPlayerFacingAngle(playerid, 266.9169);
  2845. TogglePlayerControllable(playerid, 1);
  2846. return 1;
  2847. }
  2848.  
  2849. public CountDown()
  2850. {
  2851. if (Count > 0)
  2852. {
  2853. new str[5];
  2854. format(str, sizeof str, "~w~%d", Count);
  2855. GameTextForAll(str,2500,3);
  2856. Count--;
  2857. SetTimer("CountDown",1000,0);
  2858. }
  2859. else
  2860. {
  2861. GameTextForAll("~g~~h~Go ~w~!!",2500,3);
  2862. Count = 999;
  2863. }
  2864. return 1;
  2865. }
  2866.  
  2867. public OnPlayerPrivmsg(playerid, recieverid, text[])
  2868. {
  2869. if (PMBlock[recieverid] == true) return SendClientMessage(playerid, RED, "That admin has blocked private messages"), 0;
  2870. return 1;
  2871. }
  2872.  
  2873. forward NukeBlast(playerid, times, Float:X,Float:Y,Float:Z,Float:A);
  2874. public NukeBlast(playerid, times, Float:X,Float:Y,Float:Z,Float:A)
  2875. {
  2876. if (Nuke[playerid] == times+1) return 1;
  2877. //printf("Nukeblast %d",Nuke[playerid]);
  2878. new Float:x,Float:y;
  2879. x = X + ((10*Nuke[playerid]) * floatsin(-A+5, degrees));
  2880. y = Y + ((10*Nuke[playerid]) * floatcos(-A+5, degrees));
  2881. CreateExplosion(x, y, Z, 3, 3.0);
  2882. Nuke[playerid]++;
  2883. SetTimerEx("NukeBlast", 200, 0, "ddffff",playerid, times, X, Y, Z, A);
  2884. return 1;
  2885. }
  2886.  
  2887. public OnObjectMoved(objectid)
  2888. {
  2889. for(new i; i < MAX_PLAYERS; i++) if (objectid == Missile[i])
  2890. {
  2891. new Float:X,Float:Y,Float:Z,Float:x,Float:y,Float:z;
  2892. GetObjectPos(objectid, X, Y, Z);
  2893. GetObjectPos(objectid, x, y, z);
  2894. DestroyObject(objectid);
  2895. CreateExplosion(X, Y, Z, 7, 5);
  2896. //front
  2897. X += (5.0 * floatsin(0, degrees));
  2898. Y += (5.0 * floatcos(0, degrees));
  2899. CreateExplosion(X, Y, Z, 7, 5);
  2900. X += (3.0 * floatsin(0+45, degrees));
  2901. Y += (3.0 * floatcos(0+45, degrees));
  2902. CreateExplosion(X, Y, Z, 7, 5);
  2903. X += (3.0 * floatsin(0-45, degrees));
  2904. Y += (3.0 * floatcos(0-45, degrees));
  2905. CreateExplosion(X, Y, Z, 7, 5);
  2906. //right-left
  2907. X += (5.0 * floatcos(0, degrees));
  2908. Y += (5.0 * floatsin(0, degrees));
  2909. CreateExplosion(X, Y, Z, 7, 5);
  2910. //back
  2911. X -= (5.0 * floatcos(0, degrees));
  2912. Y -= (5.0 * floatsin(0, degrees));
  2913. CreateExplosion(X, Y, Z, 7, 5);
  2914. X -= (5.0 * floatsin(0, degrees));
  2915. Y -= (5.0 * floatcos(0, degrees));
  2916. CreateExplosion(X, Y, Z, 7, 5);
  2917. X -= (3.0 * floatsin(0+45, degrees));
  2918. Y -= (3.0 * floatcos(0+45, degrees));
  2919. CreateExplosion(X, Y, Z, 7, 5);
  2920. X -= (3.0 * floatsin(0-45, degrees));
  2921. Y -= (3.0 * floatcos(0-45, degrees));
  2922. CreateExplosion(X, Y, Z, 7, 5);
  2923. SetTimerEx("MissileExplosion", 700, 0, "fffd", x, y, z, 3);
  2924. break;
  2925. }
  2926. }
  2927.  
  2928. forward MissileExplosion(Float:X, Float:Y, Float:Z, times);
  2929. public MissileExplosion(Float:X, Float:Y, Float:Z, times)
  2930. {
  2931. new Float:x = X;
  2932. new Float:y = Y;
  2933. new Float:z = Z;
  2934. if (times == 3)
  2935. {
  2936. //front
  2937. X += (10.0 * floatsin(0, degrees));
  2938. Y += (10.0 * floatcos(0, degrees));
  2939. CreateExplosion(X, Y, Z, 7, 5);
  2940. X += (6.0 * floatsin(0+45, degrees));
  2941. Y += (6.0 * floatcos(0+45, degrees));
  2942. CreateExplosion(X, Y, Z, 7, 5);
  2943. X += (6.0 * floatsin(0-45, degrees));
  2944. Y += (6.0 * floatcos(0-45, degrees));
  2945. CreateExplosion(X, Y, Z, 7, 5);
  2946. //right-left
  2947. X += (10.0 * floatcos(0, degrees));
  2948. Y += (10.0 * floatsin(0, degrees));
  2949. CreateExplosion(X, Y, Z, 7, 5);
  2950. //back
  2951. X -= (10.0 * floatcos(0, degrees));
  2952. Y -= (10.0 * floatsin(0, degrees));
  2953. CreateExplosion(X, Y, Z, 7, 5);
  2954. X -= (10.0 * floatsin(0, degrees));
  2955. Y -= (10.0 * floatcos(0, degrees));
  2956. CreateExplosion(X, Y, Z, 7, 5);
  2957. X -= (6.0 * floatsin(0+45, degrees));
  2958. Y -= (6.0 * floatcos(0+45, degrees));
  2959. CreateExplosion(X, Y, Z, 7, 5);
  2960. X -= (6.0 * floatsin(0-45, degrees));
  2961. Y -= (6.0 * floatcos(0-45, degrees));
  2962. CreateExplosion(X, Y, Z, 7, 5);
  2963. }
  2964. else if (times == 2)
  2965. {
  2966. //front
  2967. X += (15.0 * floatsin(0, degrees));
  2968. Y += (15.0 * floatcos(0, degrees));
  2969. CreateExplosion(X, Y, Z, 7, 5);
  2970. X += (9.0 * floatsin(0+45, degrees));
  2971. Y += (9.0 * floatcos(0+45, degrees));
  2972. CreateExplosion(X, Y, Z, 7, 5);
  2973. X += (9.0 * floatsin(0-45, degrees));
  2974. Y += (9.0 * floatcos(0-45, degrees));
  2975. CreateExplosion(X, Y, Z, 7, 5);
  2976. //right-left
  2977. X += (15.0 * floatcos(0, degrees));
  2978. Y += (15.0 * floatsin(0, degrees));
  2979. CreateExplosion(X, Y, Z, 7, 5);
  2980. //back
  2981. X -= (15.0 * floatcos(0, degrees));
  2982. Y -= (15.0 * floatsin(0, degrees));
  2983. CreateExplosion(X, Y, Z, 7, 5);
  2984. X -= (15.0 * floatsin(0, degrees));
  2985. Y -= (15.0 * floatcos(0, degrees));
  2986. CreateExplosion(X, Y, Z, 7, 5);
  2987. X -= (9.0 * floatsin(0+45, degrees));
  2988. Y -= (9.0 * floatcos(0+45, degrees));
  2989. CreateExplosion(X, Y, Z, 7, 5);
  2990. X -= (9.0 * floatsin(0-45, degrees));
  2991. Y -= (9.0 * floatcos(0-45, degrees));
  2992. CreateExplosion(X, Y, Z, 7, 5);
  2993. }
  2994. else if (times == 1)
  2995. {
  2996. //front
  2997. X += (20.0 * floatsin(0, degrees));
  2998. Y += (20.0 * floatcos(0, degrees));
  2999. CreateExplosion(X, Y, Z, 7, 5);
  3000. X += (12.0 * floatsin(0+45, degrees));
  3001. Y += (12.0 * floatcos(0+45, degrees));
  3002. CreateExplosion(X, Y, Z, 7, 5);
  3003. X += (12.0 * floatsin(0-45, degrees));
  3004. Y += (12.0 * floatcos(0-45, degrees));
  3005. CreateExplosion(X, Y, Z, 7, 5);
  3006. //right-left
  3007. X += (20.0 * floatcos(0, degrees));
  3008. Y += (20.0 * floatsin(0, degrees));
  3009. CreateExplosion(X, Y, Z, 7, 5);
  3010. //back
  3011. X -= (20.0 * floatcos(0, degrees));
  3012. Y -= (20.0 * floatsin(0, degrees));
  3013. CreateExplosion(X, Y, Z, 7, 5);
  3014. X -= (20.0 * floatsin(0, degrees));
  3015. Y -= (20.0 * floatcos(0, degrees));
  3016. CreateExplosion(X, Y, Z, 7, 5);
  3017. X -= (12.0 * floatsin(0+45, degrees));
  3018. Y -= (12.0 * floatcos(0+45, degrees));
  3019. CreateExplosion(X, Y, Z, 7, 5);
  3020. X -= (12.0 * floatsin(0-45, degrees));
  3021. Y -= (12.0 * floatcos(0-45, degrees));
  3022. CreateExplosion(X, Y, Z, 7, 5);
  3023. }
  3024.  
  3025. if (times > 0) SetTimerEx("MissileExplosion", 700, 0, "fffd", x, y, z, times-1);
  3026. }
  3027.  
  3028. forward PushPlayer(playerid, distance, zup);
  3029. public PushPlayer(playerid, distance, zup)
  3030. {
  3031. new Float:X,Float:Y,Float:Z,Float:A;
  3032. GetPlayerPos(playerid, X, Y, Z);
  3033. GetPlayerFacingAngle(playerid, A);
  3034. if (zup == 1) SetPlayerPos(playerid, X, Y, Z+5);
  3035. GetPlayerPos(playerid, X, Y, Z);
  3036. X -= (2.0 * floatsin(-A, degrees));
  3037. Y -= (2.0 * floatcos(-A, degrees));
  3038. SetPlayerPos(playerid, X, Y, Z);
  3039. if (distance > 0) SetTimerEx("PushPlayer", 100, 0, "ddd", playerid, distance-1, 0);
  3040. }
  3041.  
  3042. stock GetVehicleModelIDFromName(vehname[])
  3043. {
  3044. for(new i = 0; i < 211; i++)
  3045. {
  3046. if (strfind(VehNames[i], vehname, true) != -1) return i + 400;
  3047. }
  3048. return -1;
  3049. }
  3050.  
  3051. stock GetWeaponModelIDFromName(weapname[])
  3052. {
  3053. for(new i = 0; i < 48; i++)
  3054. {
  3055. if (i == 19 || i == 20 || i == 21) continue;
  3056. if (strfind(WeapNames[i], weapname, true) != -1) return i;
  3057. }
  3058. return -1;
  3059. }
  3060.  
  3061. stock bigstrtok(const string[], &idx)
  3062. {
  3063. new length = strlen(string);
  3064. while ((idx < length) && (string[idx] <= ' '))
  3065. {
  3066. idx++;
  3067. }
  3068. new offset = idx;
  3069. new result[128];
  3070. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  3071. {
  3072. result[idx - offset] = string[idx];
  3073. idx++;
  3074. }
  3075. result[idx - offset] = EOS;
  3076. return result;
  3077. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement