Guest User

SEIF PROBLEM

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