Advertisement
Guest User

SEIF ADMIN

a guest
May 8th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 91.87 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 Missile[MAX_PLAYERS];
  321. //**FORWARDS**//
  322. forward SendClientMessageToAdmins(color,string[],alevel);
  323. forward OnPlayerRegister(playerid,password[]);
  324. forward OnPlayerLogin(playerid,password[]);
  325. forward OnPlayerUpdateAccount(playerid);
  326. forward BanLog(string[]);
  327. forward KickLog(string[]);
  328. forward VehicleLog(string[]);
  329. forward CountDown();
  330. /*x---------------------------------CallBacks-------------------------------------x*/
  331. stock strtok(const string[], &index,seperator=' ')
  332. {
  333. new length = strlen(string);
  334. new offset = index;
  335. new result[128];
  336. while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
  337. {
  338. result[index - offset] = string[index];
  339. index++;
  340. }
  341.  
  342. result[index - offset] = EOS;
  343. if ((index < length) && (string[index] == seperator))
  344. {
  345. index++;
  346. }
  347. return result;
  348. }
  349. stock IsNumeric(const string[])
  350. {
  351. for (new i = 0, j = strlen(string); i < j; i++)
  352. if (string[i] > '9' || string[i] < '0')
  353. return 0;
  354. return 1;
  355. }
  356.  
  357. ReturnUser(text[], playerid = INVALID_PLAYER_ID)
  358. {
  359. new pos = 0;
  360. while (text[pos] < 0x21)
  361. {
  362. if (text[pos] == 0) return INVALID_PLAYER_ID;
  363. pos++;
  364. }
  365. new userid = INVALID_PLAYER_ID;
  366. if (IsNumeric(text[pos]))
  367. {
  368. userid = strval(text[pos]);
  369. if (userid >=0 && userid < MAX_PLAYERS)
  370. {
  371. if(!IsPlayerConnected(userid))
  372. userid = INVALID_PLAYER_ID;
  373. else return userid;
  374. }
  375. }
  376. new len = strlen(text[pos]);
  377. new count = 0;
  378. new pname[MAX_PLAYER_NAME];
  379. for (new i = 0; i < MAX_PLAYERS; i++)
  380. {
  381. if (IsPlayerConnected(i))
  382. {
  383. GetPlayerName(i, pname, sizeof (pname));
  384. if (strcmp(pname, text[pos], true, len) == 0)
  385. {
  386. if (len == strlen(pname)) return i;
  387. else
  388. {
  389. count++;
  390. userid = i;
  391. }
  392. }
  393. }
  394. }
  395. if (count != 1)
  396. {
  397. if (playerid != INVALID_PLAYER_ID)
  398. {
  399. if (count) SendClientMessage(playerid, YELLOW, "There are multiple users, enter full playername.");
  400. else SendClientMessage(playerid, RED, "Playername not found.");
  401. }
  402. userid = INVALID_PLAYER_ID;
  403. }
  404. return userid;
  405. }
  406. stock GetFileString(string[])
  407. {
  408. new result[128];
  409. result[0] = 0;
  410. if (strfind(string, ":", true) == -1) return result;
  411. new id = strfind(string, ":", true);
  412. strmid(result, string, 0, id, 128);
  413. return result;
  414. }
  415.  
  416. stock GetFileValue(string[])
  417. {
  418. new val[128];
  419. val[0] = 0;
  420. if (strfind(string , ":", true) == -1) return val;
  421. new id = strfind(string, ":", true);
  422. strmid(val, string, id+2, strlen(string), 128);
  423. return val;
  424. }
  425.  
  426. public VehicleLog(string[])
  427. {
  428. new entry[128];
  429. format(entry, sizeof(entry), "%s\r\n",string);
  430. new File:hFile;
  431. hFile = fopen("vehiclespawn.log", io_append);
  432. if (hFile)
  433. {
  434. fwrite(hFile, entry);
  435. fclose(hFile);
  436. }
  437. }
  438.  
  439. public KickLog(string[])
  440. {
  441. new entry[128];
  442. format(entry, sizeof(entry), "%s\r\n",string);
  443. new File:hFile;
  444. hFile = fopen("kick.log", io_append);
  445. if (hFile)
  446. {
  447. fwrite(hFile, entry);
  448. fclose(hFile);
  449. }
  450. }
  451.  
  452. public BanLog(string[])
  453. {
  454. new entry[128];
  455. format(entry, sizeof(entry), "%s\r\n",string);
  456. new File:hFile;
  457. hFile = fopen("ban.log", io_append);
  458. if (hFile)
  459. {
  460. fwrite(hFile, entry);
  461. fclose(hFile);
  462. }
  463. }
  464. public SendClientMessageToAdmins(color,string[],alevel)
  465. {
  466. for(new i = 0; i < MAX_PLAYERS; i++)
  467. {
  468. if(IsPlayerConnected(i))
  469. {
  470. if (AccountInfo[i][AdminLevel] >= alevel)
  471. {
  472. SendClientMessage(i, color, string);
  473. printf("%s", string);
  474. }
  475. }
  476. }
  477. return 1;
  478. }
  479. public OnPlayerRegister(playerid, password[])
  480. {
  481. if(IsPlayerConnected(playerid))
  482. {
  483. new name[MAX_PLAYER_NAME], str[128], ip[15];
  484. GetPlayerName(playerid, name, sizeof name);
  485. GetPlayerIp(playerid, ip, sizeof ip);
  486. format(str, sizeof str, "/sHAccounts/%s.seifadmin", name);
  487. new File:account = fopen(str, io_write);
  488. if (account)
  489. {
  490. strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
  491. AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
  492. new file[128];
  493. {
  494. format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
  495. { fwrite(account, file); }
  496. format(file, sizeof file, "AdminLevel: %d\n\r", 0);
  497. { fwrite(account, file); AccountInfo[playerid][AdminLevel] = 0; }
  498. format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
  499. { fwrite(account, file); }
  500. format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
  501. { fwrite(account, file); }
  502. format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
  503. { fwrite(account, file); }
  504. format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
  505. { fwrite(account, file); }
  506. format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
  507. { fwrite(account, file); }
  508. format(file, sizeof file, "IPAddress: %s\n\r",ip);
  509. { fwrite(account, file); }
  510. }
  511. fclose(account);
  512. SendClientMessage(playerid, GREEN, "|- Account successfully registered. You can now login ( /login [password] ) -|");
  513. }
  514. }
  515. return 1;
  516. }
  517.  
  518. public OnPlayerUpdateAccount(playerid)
  519. {
  520. if(IsPlayerConnected(playerid))
  521. {
  522. if(AccountInfo[playerid][Logged] == 1)
  523. {
  524. new name[MAX_PLAYER_NAME], str[128];
  525. GetPlayerName(playerid, name, sizeof name);
  526. format(str, sizeof str, "/sHAccounts/%s.seifadmin", name);
  527. new File:account = fopen(str, io_write);
  528. if (account)
  529. {
  530. AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
  531. new file[128];
  532. {
  533. format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
  534. { fwrite(account, file); }
  535. format(file, sizeof file, "AdminLevel: %d\n\r",AccountInfo[playerid][AdminLevel]);
  536. { fwrite(account, file); }
  537. format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
  538. { fwrite(account, file); }
  539. format(file, sizeof file, "Warnings: %d\n\r",AccountInfo[playerid][Warns]);
  540. { fwrite(account, file); }
  541. format(file, sizeof file, "WarnReason1: %s\n\r",AccountInfo[playerid][WarnReason1]);
  542. { fwrite(account, file); }
  543. format(file, sizeof file, "WarnReason2: %s\n\r",AccountInfo[playerid][WarnReason2]);
  544. { fwrite(account, file); }
  545. format(file, sizeof file, "WarnReason3: %s\n\r",AccountInfo[playerid][WarnReason3]);
  546. { fwrite(account, file); }
  547. format(file, sizeof file, "IPAddress: %s\n\r",AccountInfo[playerid][IP]);
  548. { fwrite(account, file); }
  549. }
  550. fclose(account);
  551. }
  552. }
  553. }
  554. return 1;
  555. }
  556.  
  557. public OnPlayerLogin(playerid, password[])
  558. {
  559. new name[MAX_PLAYER_NAME], str[128];
  560. GetPlayerName(playerid, name, sizeof name);
  561. format(str, sizeof str, "/sHAccounts/%s.seifadmin", name);
  562. new File:account = fopen(str, io_read);
  563. if (account)
  564. {
  565. new pass[256];
  566. new passres[128], value[128];
  567. fread(account, pass, sizeof pass);
  568. passres = GetFileString(pass);
  569. if (!strcmp("Password", passres))
  570. {
  571. value = GetFileValue(pass);
  572. strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
  573. }
  574. if (!strcmp(AccountInfo[playerid][Password], password, true))
  575. {
  576. while (fread(account, pass, 256))
  577. {
  578. passres = GetFileString(pass);
  579. if (strfind(passres, "AdminLevel") != -1)
  580. {
  581. value = GetFileValue(pass);
  582. AccountInfo[playerid][AdminLevel] = strval(value);
  583. }
  584. if (strfind(passres, "Cash") != -1)
  585. {
  586. value = GetFileValue(pass);
  587. AccountInfo[playerid][Cash] = strval(value);
  588. }
  589. if (strfind(passres, "Warnings") != -1)
  590. {
  591. value = GetFileValue(pass);
  592. AccountInfo[playerid][Warns] = strval(value);
  593. }
  594. if (strfind(passres, "WarnReason1") != -1)
  595. {
  596. value = GetFileValue(pass);
  597. strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 128);
  598. }
  599. if (strfind(passres, "WarnReason2") != -1)
  600. {
  601. value = GetFileValue(pass);
  602. strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 128);
  603. }
  604. if (strfind(passres, "WarnReason3") != -1)
  605. {
  606. value = GetFileValue(pass);
  607. strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 128);
  608. }
  609. }
  610. fclose(account);
  611. AccountInfo[playerid][Logged] = 1;
  612. }
  613. else
  614. {
  615. SendClientMessage(playerid, RED, "Incorrect Password.");
  616. fclose(account);
  617. return 1;
  618. }
  619. GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
  620. format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
  621. SendClientMessage(playerid, GREEN, str);
  622. printf("%s has logged in", name);
  623. if (AccountInfo[playerid][AdminLevel] > 0)
  624. {
  625. format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
  626. SendClientMessage(playerid, LIGHTGREEN, str);
  627. ViewCmds[playerid] = 0;
  628. }
  629. }
  630. return 1;
  631. }
  632.  
  633. public OnFilterScriptInit()
  634. {
  635. print("<|-----------------------------------------|>");
  636. print(" | .: [ - SeifAdmin Script by Seif - ] :. |");
  637. print("<|-----------------------------------------|>");
  638. return 1;
  639. }
  640.  
  641. public OnFilterScriptExit()
  642. {
  643. return 1;
  644. }
  645.  
  646. public OnPlayerRequestSpawn(playerid)
  647. {
  648. #if defined LOGIN_BEFORE_SPAWN
  649. new string[128];
  650. new sendername[MAX_PLAYER_NAME];
  651. GetPlayerName(playerid,sendername,24);
  652. format(string,128,"/sHAccounts/%s.seifadmin",sendername);
  653. if (fexist(string) && AccountInfo[playerid][Logged] == 0)
  654. {
  655. SendClientMessage(playerid,RED,"Your account is registered. You must first login in order to spawn.");
  656. return 0;
  657. }
  658. #endif
  659. return 1;
  660. }
  661.  
  662. public OnPlayerConnect(playerid)
  663. {
  664. AccountInfo[playerid][Jail] = 0;
  665. AccountInfo[playerid][AdminLevel] = 0;
  666. AccountInfo[playerid][Warns] = 0;
  667. AccountInfo[playerid][Logged] = 0;
  668. AccountInfo[playerid][Mute] = 0;
  669. format(AccountInfo[playerid][Password], 128, " ");
  670. format(AccountInfo[playerid][WarnReason1], 128, "NONE");
  671. format(AccountInfo[playerid][WarnReason2], 128, "NONE");
  672. format(AccountInfo[playerid][WarnReason3], 128, "NONE");
  673. Drugs[playerid] = 0;
  674. Hide[playerid] = 0;
  675. SuperPunch[playerid] = 0;
  676. ViewCmds[playerid] = 0;
  677. PMBlock[playerid] = false;
  678. new string[128];
  679. new ip[20];
  680. new sendername[MAX_PLAYER_NAME];
  681. GetPlayerName(playerid, sendername, sizeof(sendername));
  682. GetPlayerIp(playerid, ip, sizeof ip);
  683. strmid(AccountInfo[playerid][IP], ip, 0, strlen(ip), 128);
  684. format(string, sizeof(string), "/sHAccounts/%s.seifadmin", sendername);
  685. if (!fexist(string)) return SendClientMessage(playerid,WHITE,"SERVER: Your account isn't registered. Please register ( /register [password] )");
  686. #if defined ENABLE_AUTO_LOGIN
  687. {
  688. new File:user = fopen(string, io_read);
  689. if (user)
  690. {
  691. new pass[128];
  692. new passres[128], value[128];
  693. new loop = 1;
  694. WHILE:
  695. while (fread(user, pass))
  696. {
  697. printf("line: %s", pass);
  698. strmid(passres, GetFileString(pass), 0, strlen(GetFileString(pass)), 128);
  699. if (loop == 1)
  700. {
  701. if (!strcmp("IPAddress", passres)) printf("IP; %s", GetFileValue(pass));
  702. if (!strcmp("Password", passres))
  703. {
  704. value = GetFileValue(pass);
  705. strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
  706. loop = 2;
  707. goto WHILE;
  708. }
  709. }
  710. else if (loop == 2)
  711. {
  712. if (!strcmp("IPAddress", passres))
  713. {
  714. printf("%s", passres);
  715. strmid(passres, value, 0, strlen(value)-1, 20);
  716. printf("file-ip: %s | player-ip: %s", GetFileValue(pass), AccountInfo[playerid][IP]);
  717. if (!strcmp(AccountInfo[playerid][IP], passres, true))
  718. {
  719. SendClientMessage(playerid, YELLOW, "|- Auto Login -|");
  720. fclose(user);
  721. OnPlayerLogin(playerid, AccountInfo[playerid][Password]);
  722. return 1;
  723. }
  724. else
  725. {
  726. if (fexist(string))
  727. {
  728. SendClientMessage(playerid, WHITE, "SERVER: That account is registered.");
  729. SendClientMessage(playerid, ORANGE, "Please login to retrieve your account stats ( /login [password] )");
  730. }
  731. fclose(user);
  732. }
  733. }
  734. }
  735. }
  736. fclose(user);
  737. }
  738. }
  739. #else
  740. {
  741. if (fexist(string))
  742. {
  743. SendClientMessage(playerid, WHITE, "SERVER: That account is registered.");
  744. SendClientMessage(playerid, ORANGE, "Please login to retrieve your account stats ( /login [password] )");
  745. }
  746. }
  747. #endif
  748. return 1;
  749. }
  750.  
  751. public OnPlayerDisconnect(playerid, reason)
  752. {
  753. OnPlayerUpdateAccount(playerid);
  754. AccountInfo[playerid][Jail] = 0;
  755. AccountInfo[playerid][AdminLevel] = 0;
  756. AccountInfo[playerid][Warns] = 0;
  757. AccountInfo[playerid][Logged] = 0;
  758. AccountInfo[playerid][Mute] = 0;
  759. Drugs[playerid] = 0;
  760. Hide[playerid] = 0;
  761. SuperPunch[playerid] = 0;
  762. ViewCmds[playerid] = 0;
  763. strmid(AccountInfo[playerid][IP], " ", 0, strlen(" "), 20);
  764. return 1;
  765. }
  766.  
  767. public OnPlayerSpawn(playerid)
  768. {
  769. return 1;
  770. }
  771.  
  772. public OnPlayerDeath(playerid, killerid, reason)
  773. {
  774. Drugs[playerid] = 0;
  775. return 1;
  776. }
  777.  
  778. public OnVehicleSpawn(vehicleid)
  779. {
  780. return 1;
  781. }
  782.  
  783. public OnVehicleDeath(vehicleid, killerid)
  784. {
  785. return 1;
  786. }
  787.  
  788. public OnPlayerText(playerid, text[])
  789. {
  790. if (AccountInfo[playerid][Mute] == 1)
  791. {
  792. SendClientMessage(playerid, RED, "You are muted! You cannot talk.");
  793. return 0;
  794. }
  795. return 1;
  796. }
  797.  
  798. public OnPlayerCommandText(playerid, cmdtext[])
  799. {
  800. new cmd[128];
  801. new tmp[128];
  802. new idx;
  803. new giveplayername[MAX_PLAYER_NAME];
  804. new sendername[MAX_PLAYER_NAME];
  805. new string[128];
  806. cmd = strtok(cmdtext,idx);
  807.  
  808. for(new i = 0; i < GetMaxPlayers(); i++)
  809. {
  810. if (IsPlayerConnected(i))
  811. {
  812. if (AccountInfo[i][AdminLevel] > 0 && ViewCmds[i] == 1)
  813. {
  814. for(new v = 0; v < sizeof(ViewCommands); v++) if (!strcmp(cmdtext, ViewCommands[v], true))
  815. {
  816. GetPlayerName(playerid, sendername, sizeof sendername);
  817. format(tmp, 128, "[VIEWCMDS] [%d]%s: %s", playerid, sendername, cmdtext);
  818. SendClientMessage(i, PURPLE, tmp);
  819. }
  820. }
  821. }
  822. }
  823.  
  824. /*»»»»»»»»»»»»»»»»»»»»»»»»»»»» [ADMINS] «««««««««««««««««««««««««««*/
  825.  
  826. if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin
  827. {
  828. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  829. {
  830. tmp = strtok(cmdtext, idx);
  831. if(!strlen(tmp))
  832. {
  833. SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level 1-5]");
  834. SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin depending on the given level.");
  835. return 1;
  836. }
  837. new giveplayerid = ReturnUser(tmp, playerid);
  838. tmp = strtok(cmdtext, idx);
  839. new level = strval(tmp);
  840. if(giveplayerid != INVALID_PLAYER_ID)
  841. {
  842. if (level >= 0)
  843. {
  844. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  845. GetPlayerName(playerid, sendername, sizeof(sendername));
  846. printf("ADMIN: %s made %s a level %d admin.", sendername, giveplayername, level);
  847. format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, sendername);
  848. SendClientMessage(giveplayerid, LIGHTBLUE, string);
  849. format(string, sizeof(string), "|- Administrator %s has given %s an Admin Level. [Level: %d] -|", sendername,giveplayername,level);
  850. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  851. AccountInfo[giveplayerid][AdminLevel] = level;
  852. format(string, sizeof(string), "You have given %s level %d admin.", giveplayername,AccountInfo[giveplayerid][AdminLevel]);
  853. SendClientMessage(playerid, LIGHTBLUE, string);
  854. }
  855. else return SendClientMessage(playerid, RED, "You can't go below level 0!");
  856. }
  857. else if(giveplayerid == INVALID_PLAYER_ID)
  858. {
  859. format(string, sizeof(string), "%i is not an active player.", giveplayerid);
  860. SendClientMessage(playerid, RED, string);
  861. }
  862. }
  863. else SendClientMessage(playerid, RED, "You are not a lead admin!");
  864. return 1;
  865. }
  866.  
  867. if(strcmp(cmd, "/gmx", true) == 0) // Reboot the server
  868. {
  869. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid)) return GameModeExit();
  870. else return SendClientMessage(playerid, RED, "You are not a lead admin!");
  871. }
  872.  
  873. if(strcmp(cmd, "/kickall", true) == 0) // Kick everyone except the one who does this
  874. {
  875. new reason[128];
  876. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  877. {
  878. GetPlayerName(playerid, sendername, sizeof(sendername));
  879. reason = bigstrtok(cmdtext, idx);
  880. if(!strlen(reason))
  881. {
  882. SendClientMessage(playerid, ORANGE, "USAGE: /kickall [reason]");
  883. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick all the players.");
  884. return 1;
  885. }
  886. printf("ADMIN: Admin %s kicked everyone. Reason: %s", sendername, reason);
  887. format(string, sizeof(string), "-| Administrator %s kicked everyone. [Reason: %s ] |-", sendername,reason);
  888. SendClientMessageToAll(ADMIN_RED, string);
  889. for(new i = 0; i < MAX_PLAYERS; i++)
  890. {
  891. if (i != playerid)
  892. {
  893. Kick(i);
  894. KickLog(string);
  895. }
  896. }
  897. }
  898. else SendClientMessage(playerid, RED, "You are not a lead admin!");
  899. return 1;
  900. }
  901.  
  902.  
  903. if(strcmp(cmd, "/rangeban", true) == 0) // Range-bans a player with the amount of ranges entered.
  904. {
  905. if (AccountInfo[playerid][AdminLevel] >= 4)
  906. {
  907. tmp = strtok(cmdtext,idx);
  908. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [ranges(2 max)]");
  909. new ip[20],ban[128];
  910. new giveplayerid = ReturnUser(tmp);
  911. if (IsPlayerConnected(giveplayerid))
  912. {
  913. tmp = strtok(cmdtext,idx);
  914. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /rangeban [playername/id] [RANGES(2 max)]");
  915. new ranges = strval(tmp);
  916. if (ranges < 0 || ranges > 2) return SendClientMessage(playerid, RED, "Minimum ranges: 0 | Maximum ranges: 2");
  917. if (ranges == 0)
  918. {
  919. Ban(giveplayerid);
  920. }
  921. GetPlayerName(giveplayerid, giveplayername, sizeof giveplayername);
  922. GetPlayerIp(giveplayerid, ip, sizeof ip);
  923. new count = 1;
  924. for(new i = strlen(ip); i > 0; i--)
  925. {
  926. if (ip[i] == '.')
  927. {
  928. if (count == ranges)
  929. {
  930. format(ban, sizeof ban, "banip %s", ip);
  931. SendRconCommand(ban);
  932. break;
  933. }
  934. else count++;
  935. }
  936. else ip[i] = '*';
  937. }
  938. format(ban, sizeof ban, "%s has been banned with the ip '%s'", giveplayername, ip);
  939. SendClientMessage(playerid, GREEN, ban);
  940. }
  941. else
  942. {
  943. format(string, sizeof(string), "%i is not an active player.", giveplayerid);
  944. SendClientMessage(playerid, RED, string);
  945. }
  946. }
  947. else SendClientMessage(playerid, RED, "You're not a lead admin !");
  948. return 1;
  949. }
  950.  
  951. if(strcmp(cmd, "/ip", true) == 0) // Look at the player's IP address
  952. {
  953. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  954. {
  955. tmp = strtok(cmdtext, idx);
  956. if(!strlen(tmp))
  957. {
  958. SendClientMessage(playerid, ORANGE, "USAGE: /ip [playername/id]");
  959. SendClientMessage(playerid, ORANGE, "FUNCTION: View a player's IP.");
  960. return 1;
  961. }
  962.  
  963. new giveplayerid = ReturnUser(tmp);
  964. if(IsPlayerConnected(giveplayerid))
  965. {
  966. new sstring[256];
  967. new ip[20];
  968. GetPlayerIp(giveplayerid, ip, sizeof ip);
  969. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  970. format(sstring, sizeof(sstring), "-| %s's IP: %s |-", giveplayername,ip);
  971. SendClientMessage(playerid,LIGHTBLUE, sstring);
  972. }
  973. else
  974. {
  975. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  976. SendClientMessage(playerid, RED, string);
  977. }
  978. }
  979. else SendClientMessage(playerid, RED, "You are not an admin.");
  980. return 1;
  981. }
  982.  
  983. if(strcmp(cmd, "/ban", true) == 0) // Bans a player from the server
  984. {
  985. new reason[128];
  986. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  987. {
  988. tmp = strtok(cmdtext, idx);
  989. if(!strlen(tmp))
  990. {
  991. SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
  992. SendClientMessage(playerid, ORANGE, "FUNCTION: Will BAN the specified player.");
  993. return 1;
  994. }
  995.  
  996. new giveplayerid = ReturnUser(tmp);
  997.  
  998. if (AccountInfo[giveplayerid][AdminLevel] > AccountInfo[playerid][AdminLevel])
  999. {
  1000. format(string, sizeof(string), "-| [%i]%s tried to ban you! |-",playerid,sendername);
  1001. SendClientMessage(giveplayerid, ADMIN_RED,string);
  1002. SendClientMessage(playerid, ADMIN_RED, "You are not allowed to ban an admin with a higher level than you!");
  1003. }
  1004.  
  1005. else if (giveplayerid != INVALID_PLAYER_ID)
  1006. {
  1007. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1008. GetPlayerName(playerid, sendername, sizeof(sendername));
  1009. reason = bigstrtok(cmdtext, idx);
  1010. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /ban [playername/id] [reason]");
  1011. new ip[20];
  1012. printf("ADMIN: Admin %s banned %s. Reason: %s", sendername, giveplayername, reason);
  1013. format(string, sizeof(string), "-| Administrator %s banned %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1014. SendClientMessageToAll(ADMIN_RED, string);
  1015. GetPlayerIp(giveplayerid, ip, sizeof ip);
  1016. format(string, sizeof(string), "-| Banned Player's IP: %s |-", ip);
  1017. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1018. AccountInfo[giveplayerid][AdminLevel] = 0; // Resets the banned player's admin level for security reasons
  1019. format(reason, sizeof reason, "[%s]%s", sendername, reason);
  1020. BanEx(giveplayerid, reason);
  1021. }
  1022. else if(giveplayerid == INVALID_PLAYER_ID)
  1023. {
  1024. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1025. SendClientMessage(playerid, RED, string);
  1026. }
  1027. }
  1028. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1029. return 1;
  1030. }
  1031.  
  1032. if(strcmp(cmd, "/kick", true) == 0) // Kicks the player from the server
  1033. {
  1034. new reason[128];
  1035. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1036. {
  1037. tmp = strtok(cmdtext, idx);
  1038. if(!strlen(tmp))
  1039. {
  1040. SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
  1041. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kick the specified player.");
  1042. return 1;
  1043. }
  1044.  
  1045. new giveplayerid = ReturnUser(tmp);
  1046. if(giveplayerid != INVALID_PLAYER_ID)
  1047. {
  1048. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1049. GetPlayerName(playerid, sendername, sizeof(sendername));
  1050. reason = bigstrtok(cmdtext, idx);
  1051. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /kick [playername/id] [reason]");
  1052. printf("ADMIN: Admin %s kicked %s. Reason: %s", sendername, giveplayername, reason);
  1053. format(string, sizeof(string), "-| Administrator %s kicked %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1054. SendClientMessageToAll(ADMIN_RED, string);
  1055. Kick(giveplayerid);
  1056. KickLog(string);
  1057. }
  1058. else if(giveplayerid == INVALID_PLAYER_ID)
  1059. {
  1060. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1061. SendClientMessage(playerid, RED, string);
  1062. }
  1063. }
  1064. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1065. return 1;
  1066. }
  1067. if(strcmp(cmd, "/setskin", true) == 0)
  1068. {
  1069. if(IsPlayerConnected(playerid)) {
  1070. if(AccountInfo[playerid][AdminLevel] >= 1) {
  1071. new tmp2[256];
  1072. tmp = strtok(cmdtext, idx);
  1073. new otherplayer = strval(tmp);
  1074. tmp2 = strtok(cmdtext, idx);
  1075. new skin = strval(tmp2);
  1076. if(!strlen(tmp)) {
  1077. SendClientMessage(playerid, WHITE, "USAGE: /setskin [id] [idskin]");
  1078. return 1;
  1079. }
  1080. if(!strlen(tmp2)) {
  1081. SendClientMessage(playerid, WHITE, "USAGE: /setskin [id] [idskin]");
  1082. return 1;
  1083. }
  1084. SetPlayerSkin(otherplayer, skin);
  1085. SendClientMessage(otherplayer, GREEN, "An admin changed your skin.");
  1086. new amsg[256];
  1087. GetPlayerName(playerid, giveplayername, sizeof(giveplayername));
  1088. format(amsg, sizeof(amsg), "%s changed the skin of .", giveplayername);
  1089.  
  1090. }
  1091. else {
  1092. SendClientMessage(playerid, RED, "You are not admin !");
  1093. return 1;
  1094. }
  1095. }
  1096. return 1;
  1097. }
  1098.  
  1099. if(strcmp(cmd, "/mute", true) == 0) // Mutes the player from talking in the chat box
  1100. {
  1101. new reason[128];
  1102. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1103. {
  1104. tmp = strtok(cmdtext, idx);
  1105. if(!strlen(tmp))
  1106. {
  1107. SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
  1108. SendClientMessage(playerid, ORANGE, "FUNCTION: Will mute the specified player.");
  1109. return 1;
  1110. }
  1111.  
  1112. new giveplayerid = ReturnUser(tmp);
  1113.  
  1114. if(giveplayerid != INVALID_PLAYER_ID)
  1115. {
  1116. if (AccountInfo[giveplayerid][Mute] == 0)
  1117. {
  1118. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1119. GetPlayerName(playerid, sendername, sizeof(sendername));
  1120. reason = bigstrtok(cmdtext, idx);
  1121. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /mute [playername/id] [reason]");
  1122. printf("ADMIN: Admin %s muted %s. Reason: %s", sendername, giveplayername, reason);
  1123. format(string, sizeof(string), "-| Administrator %s muted %s. [Reason: %s ]|-", sendername,giveplayername,reason);
  1124. SendClientMessageToAll(ADMIN_RED, string);
  1125. AccountInfo[giveplayerid][Mute] = 1;
  1126. }
  1127. else if (AccountInfo[giveplayerid][Mute] == 1) SendClientMessage(playerid, RED, "Player is already muted!");
  1128. }
  1129.  
  1130. else if(giveplayerid == INVALID_PLAYER_ID)
  1131. {
  1132. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1133. SendClientMessage(playerid, RED, string);
  1134. }
  1135. }
  1136. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1137. return 1;
  1138. }
  1139.  
  1140. if(strcmp(cmd, "/unmute", true) == 0) // Unmutes a muted player
  1141. {
  1142. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1143. {
  1144. tmp = strtok(cmdtext, idx);
  1145. if(!strlen(tmp))
  1146. {
  1147. SendClientMessage(playerid, ORANGE, "USAGE: /unmute [playername/id]");
  1148. SendClientMessage(playerid, ORANGE, "FUNCTION: Will unmute the specified player.");
  1149. return 1;
  1150. }
  1151.  
  1152. new giveplayerid = ReturnUser(tmp);
  1153.  
  1154. if(giveplayerid != INVALID_PLAYER_ID)
  1155. {
  1156. if (AccountInfo[giveplayerid][Mute] == 1)
  1157. {
  1158. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1159. GetPlayerName(playerid, sendername, sizeof(sendername));
  1160. format(string, sizeof(string), "-| Administrator %s unmuted %s |-", sendername,giveplayername);
  1161. SendClientMessageToAll(ADMIN_RED, string);
  1162. AccountInfo[giveplayerid][Mute] = 0;
  1163. }
  1164. else if (AccountInfo[giveplayerid][Mute] == 0) SendClientMessage(playerid, RED, "Player isn't muted.");
  1165. }
  1166.  
  1167. else if(giveplayerid == INVALID_PLAYER_ID)
  1168. {
  1169. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1170. SendClientMessage(playerid, RED, string);
  1171. }
  1172. }
  1173. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1174. return 1;
  1175. }
  1176.  
  1177.  
  1178.  
  1179. if(strcmp(cmd, "/freeze", true) == 0) // Freezes the player. Prevents him from moving
  1180. {
  1181. new reason[128];
  1182. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1183. {
  1184. tmp = strtok(cmdtext, idx);
  1185. if(!strlen(tmp))
  1186. {
  1187. SendClientMessage(playerid, ORANGE, "USAGE: /freeze [playername/id] [reason]");
  1188. SendClientMessage(playerid, ORANGE, "FUNCTION: Will freeze the specified player.");
  1189. return 1;
  1190. }
  1191.  
  1192. new giveplayerid = ReturnUser(tmp);
  1193. if(giveplayerid != INVALID_PLAYER_ID)
  1194. {
  1195. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1196. GetPlayerName(playerid, sendername, sizeof(sendername));
  1197. reason = bigstrtok(cmdtext, idx);
  1198. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /freeze [playername/id] [reason]");
  1199. format(string, sizeof(string), "-| Administrator %s froze %s. [Reason: %s ] |-", sendername, giveplayername, reason);
  1200. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1201. TogglePlayerControllable(giveplayerid, false);
  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, "/unfreeze", true) == 0) // Unfreezes the player
  1214. {
  1215. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1216. {
  1217. tmp = strtok(cmdtext, idx);
  1218. if(!strlen(tmp))
  1219. {
  1220. SendClientMessage(playerid, ORANGE, "USAGE: /unfreeze [playername/id]");
  1221. SendClientMessage(playerid, ORANGE, "FUNCTION: Will unfreeze the specified player.");
  1222. return 1;
  1223. }
  1224.  
  1225. new giveplayerid = ReturnUser(tmp);
  1226. if(giveplayerid != INVALID_PLAYER_ID)
  1227. {
  1228. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1229. GetPlayerName(playerid, sendername, sizeof(sendername));
  1230. format(string, sizeof(string), "-| Administrator %s unfroze %s |-", sendername,giveplayername);
  1231. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1232. TogglePlayerControllable(giveplayerid, true);
  1233. }
  1234. else if(giveplayerid == INVALID_PLAYER_ID)
  1235. {
  1236. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1237. SendClientMessage(playerid, RED, string);
  1238. }
  1239. }
  1240. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1241. return 1;
  1242. }
  1243.  
  1244. if(strcmp(cmd, "/setname", true) == 0) // Changes a player's name
  1245. {
  1246. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1247. {
  1248. tmp = strtok(cmdtext, idx);
  1249. if(!strlen(tmp))
  1250. {
  1251. SendClientMessage(playerid, ORANGE, "USAGE: /setname [playername/id] [newname]");
  1252. SendClientMessage(playerid, ORANGE, "FUNCTION: Will change the player's current name. ");
  1253. return 1;
  1254. }
  1255.  
  1256. new giveplayerid = ReturnUser(tmp);
  1257. if(giveplayerid != INVALID_PLAYER_ID)
  1258. {
  1259. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1260. GetPlayerName(playerid, sendername, sizeof(sendername));
  1261. tmp = strtok(cmdtext, idx);
  1262. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setname [playername/id] [newname]");
  1263. format(string, sizeof(string), "-| Administrator %s renamed %s. [New Name: %s ] |-", sendername, giveplayername, tmp);
  1264. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1265. SetPlayerName(giveplayerid, tmp);
  1266. }
  1267. else if(giveplayerid == INVALID_PLAYER_ID)
  1268. {
  1269. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1270. SendClientMessage(playerid, RED, string);
  1271. }
  1272. }
  1273. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1274. return 1;
  1275. }
  1276.  
  1277. if(strcmp(cmd, "/givecash", true) == 0) // Gives some cash to the player
  1278. {
  1279. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1280. {
  1281. tmp = strtok(cmdtext, idx);
  1282. if(!strlen(tmp))
  1283. {
  1284. SendClientMessage(playerid, ORANGE, "USAGE: /givecash [playername/id] [cash]");
  1285. SendClientMessage(playerid, ORANGE, "FUNCTION: Will give the player some cash. ");
  1286. return 1;
  1287. }
  1288.  
  1289. new giveplayerid = ReturnUser(tmp);
  1290. if(giveplayerid != INVALID_PLAYER_ID)
  1291. {
  1292. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1293. GetPlayerName(playerid, sendername, sizeof(sendername));
  1294. tmp = strtok(cmdtext, idx);
  1295. new cash = strval(tmp);
  1296. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /givecash [playername/id] [cash]");
  1297. format(string, sizeof(string), "-| Administrator %s gave %s $%d |-", sendername,giveplayername,cash);
  1298. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1299. GivePlayerMoney(giveplayerid, cash);
  1300. }
  1301. else if(giveplayerid == INVALID_PLAYER_ID)
  1302. {
  1303. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1304. SendClientMessage(playerid, RED, string);
  1305. }
  1306. }
  1307. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1308. return 1;
  1309. }
  1310.  
  1311. if(strcmp(cmd, "/kill", true) == 0) // If an admin, it kills the player you want. If not, suicide.
  1312. {
  1313. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1314. {
  1315. tmp = strtok(cmdtext, idx);
  1316. if(!strlen(tmp))
  1317. {
  1318. SendClientMessage(playerid, ORANGE, "USAGE: /kill [playername/id]");
  1319. SendClientMessage(playerid, ORANGE, "FUNCTION: Will kill the specified player.");
  1320. return 1;
  1321. }
  1322.  
  1323. new giveplayerid = ReturnUser(tmp);
  1324. if(giveplayerid != INVALID_PLAYER_ID)
  1325. {
  1326. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1327. GetPlayerName(playerid, sendername, sizeof(sendername));
  1328. format(string, sizeof(string), "-| Administrator %s killed %s |-", sendername,giveplayername);
  1329. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1330. SetPlayerHealth(giveplayerid, 0.0);
  1331. }
  1332. else if(giveplayerid == INVALID_PLAYER_ID)
  1333. {
  1334. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1335. SendClientMessage(playerid, RED, string);
  1336. }
  1337. }
  1338. else
  1339. {
  1340. SendClientMessage(playerid, RED, "You have committed suicide.");
  1341. SetPlayerHealth(playerid,0.0);
  1342. }
  1343. return 1;
  1344. }
  1345.  
  1346. if(strcmp(cmd, "/goto", true) == 0) // Teleports to a player
  1347. {
  1348. new Float:pX,Float:pY,Float:pZ;
  1349. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1350. {
  1351. tmp = strtok(cmdtext, idx);
  1352. if(!strlen(tmp))
  1353. {
  1354. SendClientMessage(playerid, ORANGE, "USAGE: /goto [playername/id]");
  1355. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport to the specified player.");
  1356. return 1;
  1357. }
  1358. new giveplayerid = ReturnUser(tmp);
  1359. if(giveplayerid != INVALID_PLAYER_ID)
  1360. {
  1361. if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1362. {
  1363. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1364. SetVehiclePos(GetPlayerVehicleID(playerid),pX,pY,pZ+2);
  1365. }
  1366. else
  1367. {
  1368. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1369. SetPlayerPos(playerid,pX,pY,pZ+2);
  1370. }
  1371. SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
  1372. }
  1373. else if(giveplayerid == INVALID_PLAYER_ID)
  1374. {
  1375. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1376. SendClientMessage(playerid, RED, string);
  1377. }
  1378. }
  1379. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1380. return 1;
  1381. }
  1382.  
  1383. if(strcmp(cmd, "/get", true) == 0) // Teleports the player to your position
  1384. {
  1385. new Float:pX,Float:pY,Float:pZ;
  1386. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1387. {
  1388. tmp = strtok(cmdtext, idx);
  1389. if(!strlen(tmp))
  1390. {
  1391. SendClientMessage(playerid, ORANGE, "USAGE: /get [playername/id]");
  1392. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport the specified player to you.");
  1393. return 1;
  1394. }
  1395. new giveplayerid = ReturnUser(tmp);
  1396. if(giveplayerid != INVALID_PLAYER_ID)
  1397. {
  1398. if (GetPlayerState(giveplayerid) == PLAYER_STATE_DRIVER)
  1399. {
  1400. GetPlayerPos(playerid,pX,pY,pZ);
  1401. SetVehiclePos(GetPlayerVehicleID(giveplayerid),pX,pY,pZ+2);
  1402. }
  1403. else
  1404. {
  1405. GetPlayerPos(playerid,pX,pY,pZ);
  1406. SetPlayerPos(giveplayerid,pX,pY,pZ+2);
  1407. }
  1408. SetPlayerInterior(giveplayerid,GetPlayerInterior(playerid));
  1409. }
  1410. else if(giveplayerid == INVALID_PLAYER_ID)
  1411. {
  1412. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1413. SendClientMessage(playerid, RED, string);
  1414. }
  1415. }
  1416. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1417. return 1;
  1418. }
  1419.  
  1420. if(strcmp(cmd, "/teleport", true) == 0) // Teleports the player to the other player
  1421. {
  1422. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  1423. {
  1424. tmp = strtok(cmdtext, idx);
  1425. if(!strlen(tmp))
  1426. {
  1427. SendClientMessage(playerid, ORANGE, "USAGE: /teleport [playername/id] [targetname/id]");
  1428. SendClientMessage(playerid, ORANGE, "FUNCTION: Will teleport the player to the target.");
  1429. return 1;
  1430. }
  1431. new giveplayerid = ReturnUser(tmp);
  1432. if(giveplayerid != INVALID_PLAYER_ID)
  1433. {
  1434. tmp = strtok(cmdtext, idx);
  1435. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /teleport [playername/id] [targetname/id]");
  1436. new targetid = ReturnUser(tmp, playerid);
  1437. if (targetid == INVALID_PLAYER_ID) return 1;
  1438. new Float:tX,Float:tY,Float:tZ;
  1439. if (GetPlayerState(giveplayerid) == PLAYER_STATE_DRIVER)
  1440. {
  1441. GetPlayerPos(targetid,tX,tY,tZ);
  1442. SetVehiclePos(GetPlayerVehicleID(giveplayerid),tX,tY,tZ+2);
  1443. }
  1444. else
  1445. {
  1446. GetPlayerPos(targetid,tX,tY,tZ);
  1447. SetPlayerPos(giveplayerid,tX,tY,tZ+2);
  1448. }
  1449. SetPlayerInterior(giveplayerid,GetPlayerInterior(targetid));
  1450. }
  1451. else if(giveplayerid == INVALID_PLAYER_ID)
  1452. {
  1453. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1454. SendClientMessage(playerid, RED, string);
  1455. }
  1456. }
  1457. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1458. return 1;
  1459. }
  1460.  
  1461. if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
  1462. {
  1463. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1464. {
  1465. if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "USAGE: //<text>"), SendClientMessage(playerid, ORANGE, "HELP: Example: //Hi");
  1466. GetPlayerName(playerid, sendername, sizeof(sendername));
  1467. format(string, sizeof(string), "Admin [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
  1468. SendClientMessageToAdmins(DARKPINK, string, 1);
  1469. return 1;
  1470. }
  1471. else return SendClientMessage(playerid, RED, "You are not an admin!");
  1472. }
  1473.  
  1474. if(strcmp(cmd, "/slap", true) == 0) // Slap a player
  1475. {
  1476. new Float:pX,Float:pY,Float:pZ;
  1477. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1478. {
  1479. tmp = strtok(cmdtext, idx);
  1480. if(!strlen(tmp))
  1481. {
  1482. SendClientMessage(playerid, ORANGE, "USAGE: /slap [playername/id]");
  1483. SendClientMessage(playerid, ORANGE, "FUNCTION: Will slap the specified player");
  1484. return 1;
  1485. }
  1486.  
  1487. new giveplayerid = ReturnUser(tmp);
  1488. if(giveplayerid != INVALID_PLAYER_ID)
  1489. {
  1490. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1491. GetPlayerName(playerid, sendername, sizeof(sendername));
  1492. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1493. SetPlayerPos(giveplayerid,pX,pY,pZ+5);
  1494. format(string, sizeof(string), "-| Administrator %s slapped %s |-",sendername, giveplayername);
  1495. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1496. }
  1497. else if(giveplayerid == INVALID_PLAYER_ID)
  1498. {
  1499. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1500. SendClientMessage(playerid, RED, string);
  1501. }
  1502. }
  1503. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1504. return 1;
  1505. }
  1506.  
  1507. if(strcmp(cmd, "/bslap", true) == 0)
  1508. {
  1509. new Float:pX,Float:pY,Float:pZ;
  1510. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1511. {
  1512. tmp = strtok(cmdtext, idx);
  1513. if(!strlen(tmp))
  1514. {
  1515. SendClientMessage(playerid, ORANGE, "USAGE: /bslap [playername/id]");
  1516. SendClientMessage(playerid, ORANGE, "FUNCTION: Will double slap the specified player");
  1517. return 1;
  1518. }
  1519.  
  1520. new giveplayerid = ReturnUser(tmp);
  1521. if(giveplayerid != INVALID_PLAYER_ID)
  1522. {
  1523. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1524. GetPlayerName(playerid, sendername, sizeof(sendername));
  1525. GetPlayerPos(giveplayerid,pX,pY,pZ);
  1526. SetPlayerPos(giveplayerid,pX,pY,pZ+10);
  1527. format(string, sizeof(string), "-| Administrator %s bitch slapped %s |-",sendername, giveplayername);
  1528. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1529. }
  1530. else if(giveplayerid == INVALID_PLAYER_ID)
  1531. {
  1532. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1533. SendClientMessage(playerid, RED, string);
  1534. }
  1535. }
  1536. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1537. return 1;
  1538. }
  1539.  
  1540.  
  1541. if(strcmp(cmd, "/disarm", true) == 0) // Reset the player's weapons
  1542. {
  1543. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1544. {
  1545. tmp = strtok(cmdtext, idx);
  1546. if(!strlen(tmp))
  1547. {
  1548. SendClientMessage(playerid, ORANGE, "USAGE: /disarm [playername/id]");
  1549. SendClientMessage(playerid, ORANGE, "FUNCTION: Will disarm the player.");
  1550. return 1;
  1551. }
  1552.  
  1553. new giveplayerid = ReturnUser(tmp);
  1554. if(giveplayerid != INVALID_PLAYER_ID)
  1555. {
  1556. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1557. GetPlayerName(playerid, sendername, sizeof(sendername));
  1558. ResetPlayerWeapons(giveplayerid);
  1559. format(string, sizeof(string), "-| Administrator %s disarmed %s |-",sendername, giveplayername);
  1560. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1561. }
  1562. else if(giveplayerid == INVALID_PLAYER_ID)
  1563. {
  1564. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1565. SendClientMessage(playerid, RED, string);
  1566. }
  1567. }
  1568.  
  1569. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1570. return 1;
  1571. }
  1572.  
  1573. if(strcmp(cmd, "/say", true) == 0) // Publicly says an admin message. Exact same as RCON's 'say' but in a red color.
  1574. {
  1575. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1576. {
  1577. GetPlayerName(playerid, sendername, sizeof(sendername));
  1578. new result[128];
  1579. result = bigstrtok(cmdtext, idx);
  1580. if(!strlen(result))
  1581. {
  1582. SendClientMessage(playerid, ORANGE, "USAGE: /say [message]");
  1583. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast an admin message.");
  1584. return 1;
  1585. }
  1586. format(string, sizeof(string), "* Admin: %s", result);
  1587. SendClientMessageToAll(LIGHTRED, string);
  1588. printf("%s", string);
  1589. }
  1590. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1591. return 1;
  1592. }
  1593.  
  1594. if(strcmp(cmd, "/bc", true) == 0 || strcmp(cmd, "/broadcast", true) == 0) // Displays a screen message
  1595. {
  1596. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  1597. {
  1598. GetPlayerName(playerid, sendername, sizeof(sendername));
  1599. new result[128];
  1600. result = bigstrtok(cmdtext, idx);
  1601. if(!strlen(result))
  1602. {
  1603. SendClientMessage(playerid, ORANGE, "USAGE: /bc [message] [time in seconds(if non entered, 5 seconds will be the time by default)]");
  1604. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast a screen message");
  1605. return 1;
  1606. }
  1607. new time;
  1608. tmp = strtok(cmdtext, idx);
  1609. if (!strlen(tmp)) time = 5;
  1610. else time = strval(tmp);
  1611. format(string, sizeof(string), "~w~%s", result);
  1612. GameTextForAll(string, time*1000, 4);
  1613. printf("%s", string);
  1614. }
  1615. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1616. return 1;
  1617. }
  1618.  
  1619. if(strcmp(cmd, "/veh", true) == 0) // Spawn a vehicle. Name supported too.
  1620. {
  1621. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  1622. {
  1623. tmp = strtok(cmdtext, idx);
  1624. if(!strlen(tmp))
  1625. {
  1626. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1627. return 1;
  1628. }
  1629. new car = GetVehicleModelIDFromName(tmp);
  1630. if (car == -1)
  1631. {
  1632. car = strval(tmp);
  1633. if(car < 400 || car > 611) return SendClientMessage(playerid, RED, "Vehicle ID can't be below 400 nor above 611 !");
  1634. }
  1635.  
  1636. tmp = strtok(cmdtext, idx);
  1637. if(!strlen(tmp))
  1638. {
  1639. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1640. return 1;
  1641. }
  1642. new color1 = strval(tmp);
  1643.  
  1644. tmp = strtok(cmdtext, idx);
  1645. if(!strlen(tmp))
  1646. {
  1647. SendClientMessage(playerid, ORANGE, "USAGE: /veh [modelname/id] [color1] [color2]");
  1648. return 1;
  1649. }
  1650. new color2 = strval(tmp);
  1651.  
  1652. new Float:X,Float:Y,Float:Z,Float:A;
  1653. GetPlayerPos(playerid, X,Y,Z);
  1654. GetPlayerFacingAngle(playerid, A);
  1655. X += (5 * floatsin(-A, degrees));
  1656. Y += (5 * floatcos(-A, degrees));
  1657. new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 600000000);
  1658. format(string, sizeof(string), "Vehicle %s(%d) spawned.", VehNames[GetVehicleModel(carid)-400], carid);
  1659. SendClientMessage(playerid, GREEN, string);
  1660. GetPlayerName(playerid,sendername,sizeof(sendername));
  1661. format(string, sizeof(string), "-| Administrator %s spawned a vehicle(%d) [ Model: %s ] |-", sendername, carid, VehNames[GetVehicleModel(carid)-400]);
  1662. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1663. }
  1664. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1665. return 1;
  1666. }
  1667.  
  1668. if(strcmp(cmd, "/pweapons", true) == 0) // Checks a player's weapons
  1669. {
  1670. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  1671. {
  1672. tmp = strtok(cmdtext, idx);
  1673. if(!strlen(tmp))
  1674. {
  1675. SendClientMessage(playerid, ORANGE, "USAGE: /pweapons [playerid/name]");
  1676. return 1;
  1677. }
  1678. new giveplayerid = ReturnUser(tmp);
  1679. if (giveplayerid != INVALID_PLAYER_ID)
  1680. {
  1681. new bullets[12];
  1682. new weapons[12];
  1683. new weapname[12][20];
  1684. for(new i = 0; i < 12; i++)
  1685. {
  1686. GetPlayerWeaponData(giveplayerid, i+1, weapons[i], bullets[i]);
  1687. GetWeaponName(weapons[i], weapname[i], 20);
  1688. }
  1689. GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
  1690. format(string,sizeof(string)," |- %s's Weapons -|",giveplayername);
  1691. SendClientMessage(playerid,LIGHTGREEN,string);
  1692. 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]);
  1693. SendClientMessage(playerid,YELLOW,string);
  1694. 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]);
  1695. SendClientMessage(playerid,YELLOW,string);
  1696. }
  1697. else SendClientMessage(playerid, RED, "Player is not active.");
  1698. }
  1699. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1700. return 1;
  1701. }
  1702.  
  1703. if(strcmp(cmd, "/sethp", true) == 0) // Sets a player's health
  1704. {
  1705. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 5)
  1706. {
  1707. tmp = strtok(cmdtext, idx);
  1708. if(!strlen(tmp))
  1709. {
  1710. SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
  1711. return 1;
  1712. }
  1713. new targetid = ReturnUser(tmp);
  1714. tmp = strtok(cmdtext, idx);
  1715. new Float:hp = floatstr(tmp);
  1716. if (targetid != INVALID_PLAYER_ID)
  1717. {
  1718. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
  1719. SetPlayerHealth(targetid,hp);
  1720. if (hp < 1) Drugs[targetid] = 0;
  1721. GetPlayerName(playerid, sendername, sizeof(sendername));
  1722. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1723. format(string,sizeof(string),"|- Administrator %s has changed %s's HP. [HP: %.2f] -|",sendername,giveplayername,hp);
  1724. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  1725. }
  1726. else SendClientMessage(playerid, RED, "Player is not active.");
  1727. }
  1728. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1729. return 1;
  1730. }
  1731.  
  1732. if (strcmp(cmd, "/logout", true) == 0) // Logs off the admin
  1733. {
  1734. if(AccountInfo[playerid][Logged] == 1)
  1735. {
  1736. if(AccountInfo[playerid][AdminLevel] >= 1)
  1737. {
  1738. OnPlayerUpdateAccount(playerid);
  1739. AccountInfo[playerid][Logged] = 0;
  1740. AccountInfo[playerid][AdminLevel] = 0;
  1741. SendClientMessage(playerid, GREEN, "You have successfuly logged out.");
  1742. }
  1743. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1744. }
  1745. else return SendClientMessage(playerid, RED, "You're not logged in! ( /login [password] )");
  1746. return 1;
  1747. }
  1748.  
  1749. if(strcmp(cmd, "/warn", true) == 0) // Warns a player. 3 warnings = auto-ban
  1750. {
  1751. if (AccountInfo[playerid][AdminLevel] >= 2)
  1752. {
  1753. tmp = strtok(cmdtext, idx);
  1754. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /warn [playername/id] [reason]");
  1755. new targetid = ReturnUser(tmp);
  1756. if(IsPlayerConnected(targetid))
  1757. {
  1758. if(targetid != INVALID_PLAYER_ID)
  1759. {
  1760. new reason[128];
  1761. reason = bigstrtok(cmdtext, idx);
  1762. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /warn [playername/id] [reason]");
  1763. new sstring[128];
  1764. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1765. GetPlayerName(playerid, sendername, sizeof(sendername));
  1766. AccountInfo[targetid][Warns] += 1;
  1767. format(string, sizeof(string), "You got warned by Admin %s. Reason: %s", sendername, reason);
  1768. SendClientMessage(targetid, ADMIN_RED, string);
  1769. format(string, sizeof(string), "-| Administrator %s warned %s. [Reason: %s ] |-", sendername,giveplayername, reason);
  1770. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1771. format(string, sizeof(string), "-| %s's warnings: %d |-",giveplayername, AccountInfo[targetid][Warns]);
  1772. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1773. if (AccountInfo[targetid][Warns] == 1) strmid(AccountInfo[targetid][WarnReason1], reason, 0, strlen(reason), 128);
  1774. else if (AccountInfo[targetid][Warns] == 2) strmid(AccountInfo[targetid][WarnReason2], reason, 0, strlen(reason), 128);
  1775. else if (AccountInfo[targetid][Warns] == 3) strmid(AccountInfo[targetid][WarnReason3], reason, 0, strlen(reason), 128);
  1776. SendClientMessage(targetid, RED, "3 Warnings = Auto-Ban!");
  1777. if(AccountInfo[targetid][Warns] >= 3)
  1778. {
  1779. new ip[128];
  1780. format(string, sizeof(string), "-| Administrator %s banned %s. [Reason: 3 Warnings...] |-", sendername,giveplayername);
  1781. BanLog(string);
  1782. SendClientMessageToAll(ADMIN_RED, string);
  1783. for(new i = 0; i < 3; i++)
  1784. {
  1785. if (i == 0) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason1]);
  1786. else if (i == 1) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason2]);
  1787. else if (i == 2) format(string, sizeof (string), "-| Reason #%d: %s |-", i+1, AccountInfo[targetid][WarnReason3]);
  1788. SendClientMessageToAll(ADMIN_RED, string);
  1789. }
  1790. GetPlayerIp(targetid,ip,128);
  1791. format(sstring, sizeof(sstring), "-| Banned Player's IP: %s |-", ip);
  1792. SendClientMessageToAdmins(ADMIN_RED, sstring,1);
  1793. AccountInfo[targetid][AdminLevel]= 0;
  1794. AccountInfo[targetid][Warns] = 0;
  1795. format(AccountInfo[targetid][WarnReason1], 128, "NONE");
  1796. format(AccountInfo[targetid][WarnReason2], 128, "NONE");
  1797. format(AccountInfo[targetid][WarnReason3], 128, "NONE");
  1798. Ban(giveplayerid);
  1799. return 1;
  1800. }
  1801. }
  1802. else
  1803. {
  1804. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1805. SendClientMessage(playerid, RED, string);
  1806. }
  1807. }
  1808. else
  1809. {
  1810. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1811. SendClientMessage(playerid, RED, string);
  1812. }
  1813. }
  1814. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1815. return 1;
  1816. }
  1817.  
  1818. if(strcmp(cmd, "/pstats", true) == 0) // Views the player's stats
  1819. {
  1820. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  1821. {
  1822. tmp = strtok(cmdtext, idx);
  1823. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /pstats [playername/id]");
  1824. new targetid = ReturnUser(tmp);
  1825. if (targetid != INVALID_PLAYER_ID)
  1826. {
  1827. new Float:health,Float:armor;
  1828. GetPlayerHealth(targetid,health);
  1829. GetPlayerArmour(targetid,armor);
  1830. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1831. format(string, sizeof(string), "Stats of %s: Health: '%.2f' - Cash: '$%d' - Warnings: '%d' - Armor: '%.2f'",giveplayername, health,GetPlayerMoney(targetid),AccountInfo[targetid][Warns],armor);
  1832. SendClientMessage(playerid,PURPLE,string);
  1833. if(AccountInfo[giveplayerid][Logged] == 1) SendClientMessage(playerid, PURPLE, "Logged In: Yes");
  1834. else if(AccountInfo[giveplayerid][Logged] == 0) SendClientMessage(playerid, PURPLE, "Logged In: No");
  1835. SendClientMessage(playerid,YELLOW,"Type /pweapons [playername/id] to check the player's weapons");
  1836. }
  1837. else SendClientMessage(playerid, RED, "Player is not active.");
  1838. }
  1839. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  1840. return 1;
  1841. }
  1842.  
  1843.  
  1844.  
  1845. if(strcmp(cmd, "/giveweapon", true) == 0) // Gives a weapon to a player
  1846. {
  1847. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  1848. {
  1849. tmp = strtok(cmdtext, idx);
  1850. if(!strlen(tmp))
  1851. {
  1852. SendClientMessage(playerid, ORANGE, "USAGE: /giveweapon [playername/id] [weaponid] [ammo]");
  1853. return 1;
  1854. }
  1855. new gun;
  1856. new ammo;
  1857. new targetid = ReturnUser(tmp);
  1858. tmp = strtok(cmdtext, idx);
  1859. gun = strval(tmp);
  1860. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /giveweapon [playername/id] [weaponid] [ammo]");
  1861. tmp = strtok(cmdtext, idx);
  1862. ammo = strval(tmp);
  1863. if(targetid != INVALID_PLAYER_ID)
  1864. {
  1865. new weap[50];
  1866. GetPlayerName(playerid, sendername, sizeof(sendername));
  1867. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1868. GivePlayerWeapon(targetid, gun, ammo);
  1869. GetWeaponName(gun, weap, sizeof weap);
  1870. format(string, sizeof(string), "-| Administrator %s gave a weapon(%s) to %s |-",sendername, weap, giveplayername);
  1871. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1872. }
  1873. else if(targetid == INVALID_PLAYER_ID)
  1874. {
  1875. format(string, sizeof(string), "%d is not an active player.", targetid);
  1876. SendClientMessage(playerid, RED, string);
  1877. }
  1878. }
  1879. else SendClientMessage(playerid, RED, "You are not an admin with the required level!");
  1880. return 1;
  1881. }
  1882.  
  1883.  
  1884. if(strcmp(cmd, "/setwarn", true) == 0) // Sets the player's warnings
  1885. {
  1886. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  1887. {
  1888. tmp = strtok(cmdtext, idx);
  1889. if(!strlen(tmp))
  1890. {
  1891. SendClientMessage(playerid, ORANGE, "USAGE: /setwarn [playername/id] [warning]");
  1892. SendClientMessage(playerid, ORANGE, "FUNCTION: Will set a certain player's warning.");
  1893. return 1;
  1894. }
  1895. new targetid = ReturnUser(tmp);
  1896. if(targetid != INVALID_PLAYER_ID)
  1897. {
  1898. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1899. GetPlayerName(playerid, sendername, sizeof(sendername));
  1900. tmp = strtok(cmdtext, idx);
  1901. new warnings = strval(tmp);
  1902. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setwarn [playername/id] [warning]");
  1903. AccountInfo[targetid][Warns] = warnings;
  1904. format(string, sizeof(string), "Admin %s changed your warnings to %d", sendername, warnings);
  1905. SendClientMessage(targetid, GREEN, string);
  1906. SendClientMessage(targetid, RED, "3 Warnings = Auto-Ban! Ask an admin to check how many warnings you have");
  1907. format(string, sizeof(string), "-| Administrator %s changed %s's warnings. [Warnings: %d ] |-",sendername,giveplayername, AccountInfo[giveplayerid][Warns]);
  1908. SendClientMessageToAdmins(ADMIN_RED,string,1);
  1909. }
  1910. else if(giveplayerid == INVALID_PLAYER_ID)
  1911. {
  1912. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  1913. SendClientMessage(playerid, RED, string);
  1914. }
  1915. }
  1916. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1917. return 1;
  1918. }
  1919.  
  1920. if(strcmp(cmd, "/an", true) == 0 || strcmp(cmd, "/announce", true) == 0) // Broadcasts an 'announcement' message.
  1921. {
  1922. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  1923. {
  1924. GetPlayerName(playerid, sendername, sizeof(sendername));
  1925. new result[128];
  1926. result = bigstrtok(cmdtext, idx);
  1927. if(!strlen(result))
  1928. {
  1929. SendClientMessage(playerid, ORANGE, "USAGE: /(an)nounce [message]");
  1930. SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast an announcement.");
  1931. return 1;
  1932. }
  1933. format(string, sizeof(string), "%s", result);
  1934. SendClientMessageToAll(AQUAGREEN, string);
  1935. printf("Announcement by %s: %s", sendername, string);
  1936. }
  1937. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1938. return 1;
  1939. }
  1940.  
  1941.  
  1942. if(strcmp(cmd, "/viewcmds", true) == 0) // Views unknown commands and commands mentioned in 'ViewCommands' variable entered by players
  1943. {
  1944. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  1945. {
  1946. tmp = strtok(cmdtext,idx);
  1947. if(!strlen(tmp))
  1948. {
  1949. SendClientMessage(playerid, ORANGE, "USAGE: /viewcmds [on/off]");
  1950. SendClientMessage(playerid, ORANGE, "FUNCTION: Will see the players typing some commands and wrong commands.");
  1951. }
  1952. else if(strcmp(tmp,"on",true) == 0)
  1953. {
  1954. ViewCmds[playerid] = 1;
  1955. SendClientMessage(playerid,GREEN,"You can know view players typing some commands and wrong commands.");
  1956. }
  1957. else if(strcmp(tmp,"off",true) == 0)
  1958. {
  1959. ViewCmds[playerid] = 0;
  1960. SendClientMessage(playerid,GREEN,"You can no longer view players typing some commands and wrong commands.");
  1961. }
  1962. }
  1963. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  1964. return 1;
  1965. }
  1966.  
  1967. if(strcmp(cmd, "/jail", true) == 0) // Jails a player
  1968. {
  1969. if (AccountInfo[playerid][AdminLevel] >= 1)
  1970. {
  1971. tmp = strtok(cmdtext, idx);
  1972. if(!strlen(tmp))
  1973. {
  1974. SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
  1975. return 1;
  1976. }
  1977. new targetid = ReturnUser(tmp);
  1978. if(IsPlayerConnected(targetid))
  1979. {
  1980. if(targetid != INVALID_PLAYER_ID)
  1981. {
  1982. if(AccountInfo[giveplayerid][Jail] == 0)
  1983. {
  1984. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  1985. GetPlayerName(playerid, sendername, sizeof(sendername));
  1986. new reason[128];
  1987. reason = bigstrtok(cmdtext, idx);
  1988. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
  1989. format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
  1990. SendClientMessage(targetid, ADMIN_RED, string);
  1991. format(string, sizeof(string), "-| Administrator %s jailed %s. [ Reason: %s ] |-",sendername,giveplayername, reason);
  1992. SendClientMessageToAll(ADMIN_RED,string);
  1993. AccountInfo[targetid][Jail] = 1;
  1994. OnPlayerJailed(targetid);
  1995. return 1;
  1996. }
  1997. else SendClientMessage(playerid, RED, "Player is already jailed!");
  1998. }
  1999. else
  2000. {
  2001. format(string, sizeof(string), "%d is not an active player.", targetid);
  2002. SendClientMessage(playerid, RED, string);
  2003. }
  2004. }
  2005. else
  2006. {
  2007. format(string, sizeof(string), "%d is not an active player.", targetid);
  2008. SendClientMessage(playerid, RED, string);
  2009. }
  2010. }
  2011. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2012. return 1;
  2013. }
  2014.  
  2015. if(strcmp(cmd, "/unjail", true) == 0) // Unjails a player
  2016. {
  2017. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  2018. {
  2019. tmp = strtok(cmdtext, idx);
  2020. if(!strlen(tmp))
  2021. {
  2022. SendClientMessage(playerid, ORANGE, "USAGE: /unjail [playername/id]");
  2023. return 1;
  2024. }
  2025.  
  2026. new targetid = ReturnUser(tmp);
  2027. if(targetid != INVALID_PLAYER_ID)
  2028. {
  2029. if(AccountInfo[giveplayerid][Jail] == 1)
  2030. {
  2031. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2032. GetPlayerName(playerid, sendername, sizeof(sendername));
  2033. format(string, sizeof(string), "-| Administrator %s unjailed %s |-",sendername, giveplayername);
  2034. SendClientMessageToAll(ADMIN_RED,string);
  2035. AccountInfo[targetid][Jail] = 0;
  2036. OnPlayerUnjailed(targetid);
  2037. }
  2038. else SendClientMessage(playerid, RED, "Player is not jailed!");
  2039. }
  2040. else
  2041. {
  2042. format(string, sizeof(string), "%d is not an active player.", targetid);
  2043. SendClientMessage(playerid, RED, string);
  2044. }
  2045. }
  2046. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2047. return 1;
  2048. }
  2049.  
  2050. if(strcmp(cmd, "/gotoveh", true) == 0) // Teleports to a vehicle's position
  2051. {
  2052. tmp = strtok(cmdtext, idx);
  2053. if(!strlen(tmp))
  2054. {
  2055. SendClientMessage(playerid, ORANGE, "USAGE: /gotoveh [vehicleid]");
  2056. return 1;
  2057. }
  2058. new car = strval(tmp);
  2059. if (AccountInfo[playerid][AdminLevel] >= 3)
  2060. {
  2061. new Float:vx,Float:vy,Float:vz;
  2062. GetVehiclePos(car,vx,vy,vz);
  2063. if (GetPlayerState(playerid) == 2)
  2064. SetVehiclePos(GetPlayerVehicleID(playerid),vx,vy+2,vz);
  2065. else
  2066. SetPlayerPos(playerid,vx,vy,vz+1);
  2067. SetPlayerInterior(playerid,0);
  2068. format(string,256,"You have teleported to vehicle id %d(%s)",car, VehNames[GetVehicleModel(car)-400]);
  2069. SendClientMessage(playerid,GREEN,string);
  2070. }
  2071. else SendClientMessage(playerid,RED,"You're not an admin with the required level");
  2072. return 1;
  2073. }
  2074. if(!strcmp(cmdtext, "/aclearchat", true)) // Clears the chatbox for everyone
  2075. {
  2076. if(AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  2077. {
  2078. for(new chat = 0; chat <= 50; chat++) SendClientMessageToAll(GREEN, " ");
  2079. GetPlayerName(playerid, sendername, 20);
  2080. format(string, 256, "-| Administrator %s cleared the chat |-", sendername);
  2081. SendClientMessageToAll(ADMIN_RED, string);
  2082. return 1;
  2083. }
  2084. else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
  2085. return 1;
  2086. }
  2087. if(strcmp(cmd, "/hide", true) == 0) // Hides you from the admin list
  2088. {
  2089. if (AccountInfo[playerid][AdminLevel] >= 5)
  2090. {
  2091. Hide[playerid] = 1;
  2092. SendClientMessage(playerid,GREEN,"|- You're now hidden from the admin list -|");
  2093. }
  2094. return 1;
  2095. }
  2096. if(strcmp(cmd, "/unhide", true) == 0)
  2097. {
  2098. if (AccountInfo[playerid][AdminLevel] >= 5) // Unhides you from the admin list
  2099. {
  2100. if (Hide[playerid] != 1) return SendClientMessage(playerid,RED,"You're not hidden in the admin list!");
  2101. Hide[playerid] = 0;
  2102. SendClientMessage(playerid,GREEN,"|- You're now visible in the admin list -|");
  2103. }
  2104. return 1;
  2105. }
  2106.  
  2107. if(strcmp(cmd, "/virtual", true) == 0) // Sets the player's virtual world
  2108. {
  2109. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
  2110. {
  2111. tmp = strtok(cmdtext, idx);
  2112. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /virtual [playerid/name] [virtual world (0-255)]");
  2113. new targetid = ReturnUser(tmp);
  2114. tmp = strtok(cmdtext, idx);
  2115. new v = strval(tmp);
  2116. if (targetid != INVALID_PLAYER_ID)
  2117. {
  2118. if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /virtual [playerid/name] [virtual world (0-255)]");
  2119. SetPlayerVirtualWorld(targetid,v);
  2120. GetPlayerName(playerid, sendername, sizeof(sendername));
  2121. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2122. format(string,sizeof(string),"|- Administrator %s has changed %s's Virtual World. [World: %d] -|",sendername,giveplayername,v);
  2123. SendClientMessageToAdmins(ADMIN_RED,string,1);
  2124. }
  2125. else SendClientMessage(playerid, RED, "Player is not active.");
  2126. }
  2127. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2128. return 1;
  2129. }
  2130.  
  2131. if(strcmp(cmd,"/count", true) == 0) // Starts a count down
  2132. {
  2133. tmp = strtok(cmdtext, idx);
  2134. new count = strval(tmp);
  2135. if (!strlen(tmp)) count = 5;
  2136. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin");
  2137. if (Count > 0) return SendClientMessage(playerid, RED, "Countdown is already in progress.");
  2138. GetPlayerName(playerid, sendername, sizeof(sendername));
  2139. format(string,sizeof(string),"|- Administrator %s started a countdown from %d -|", sendername, count);
  2140. SendClientMessageToAll(LIGHTGREEN, string);
  2141. Count = count;
  2142. CountDown();
  2143. return 1;
  2144. }
  2145.  
  2146. if(strcmp(cmd, "/view", true) == 0) // Spectates a player
  2147. {
  2148. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin !");
  2149. tmp = strtok(cmdtext, idx);
  2150. if(!strlen(tmp))
  2151. {
  2152. SendClientMessage(playerid, ORANGE, "|__________________________________|");
  2153. SendClientMessage(playerid, ORANGE, "USAGE: /view [playerid]");
  2154. SendClientMessage(playerid, ORANGE, "FUNCTION: Will spectate a player.");
  2155. SendClientMessage(playerid, ORANGE, "HELP: /view off to stop spectating");
  2156. SendClientMessage(playerid, ORANGE, "|__________________________________|");
  2157. return 1;
  2158. }
  2159. new targetid = ReturnUser(tmp);
  2160. if (giveplayerid != INVALID_PLAYER_ID)
  2161. {
  2162. if (AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED,"You're not an admin !");
  2163. TogglePlayerSpectating(playerid, 1);
  2164. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(targetid));
  2165. SetPlayerInterior(playerid,GetPlayerInterior(targetid));
  2166. if (IsPlayerInAnyVehicle(targetid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(targetid));
  2167. else PlayerSpectatePlayer(playerid, targetid);
  2168. SendClientMessage(playerid, ORANGE, "HELP: '/view off' to stop spectating");
  2169. }
  2170. else if(strcmp(tmp, "off", true) == 0)
  2171. {
  2172. TogglePlayerSpectating(playerid, 0);
  2173. SetPlayerVirtualWorld(playerid,0);
  2174. }
  2175. else
  2176. {
  2177. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2178. SendClientMessage(playerid, RED, string);
  2179. }
  2180. return 1;
  2181. }
  2182.  
  2183. if(strcmp(cmd, "/blockpm", true) == 0) // Blocks PMs
  2184. {
  2185. if (AccountInfo[playerid][AdminLevel] >= 5)
  2186. {
  2187. if (PMBlock[playerid] == true)
  2188. {
  2189. PMBlock[playerid] = false;
  2190. SendClientMessage(playerid, GREEN, "|- Private messages BLOCKED -|");
  2191. return 1;
  2192. }
  2193. if (PMBlock[playerid] == false)
  2194. {
  2195. PMBlock[playerid] = true;
  2196. SendClientMessage(playerid, GREEN, "|- Private messages UNBLOCKED -|");
  2197. return 1;
  2198. }
  2199. }
  2200. else return SendClientMessage(playerid, RED, "You're not a lead admin!");
  2201. }
  2202.  
  2203.  
  2204. if(!strcmp(cmd, "/missile", true)) // Spawns a missile 50 Z higher than player's and drops it to the ground, toggling a huge explosion
  2205. {
  2206. if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  2207. {
  2208. if (IsValidObject(Missile[playerid])) return SendClientMessage(playerid, RED, "You already dropped a missile that's currently in progress of exploding");
  2209. new Float:X,Float:Y,Float:Z;
  2210. GetPlayerPos(playerid, X,Y,Z);
  2211. Missile[playerid] = CreateObject(3786, X, Y, Z+50, 357.6293, 272.3375, 6.8755);
  2212. MoveObject(Missile[playerid], X, Y, Z, 20.0);
  2213. }
  2214. else return SendClientMessage(playerid, RED, "You're not a lead admin!");
  2215. return 1;
  2216. }
  2217.  
  2218. if (!strcmp(cmd, "/push", true)) // Pushes a player back. Player gets pushed back in motions
  2219. {
  2220. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 3)
  2221. {
  2222. tmp = strtok(cmdtext, idx);
  2223. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /push [playername/id]");
  2224. new targetid = ReturnUser(tmp);
  2225. if (targetid != INVALID_PLAYER_ID)
  2226. {
  2227. PushPlayer(targetid, 20, true);
  2228. GetPlayerName(playerid, sendername, sizeof(sendername));
  2229. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2230. format(string,sizeof(string),"|- Administrator %s has pushed %s -|", sendername, giveplayername);
  2231. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  2232. }
  2233. else SendClientMessage(playerid, RED, "Player is not active.");
  2234. }
  2235. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2236. return 1;
  2237. }
  2238.  
  2239. if (!strcmp(cmd, "/setgravity", true)) // Changes gravity
  2240. {
  2241. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 4)
  2242. {
  2243. tmp = strtok(cmdtext, idx);
  2244. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /pussetgravity [gravity float]");
  2245. new Float:gravity = floatstr(tmp);
  2246. SetGravity(gravity);
  2247. GetPlayerName(playerid, sendername, sizeof(sendername));
  2248. format(string,sizeof(string),"|- Administrator %s has changed gravity [ Gravity: %.4f ] -|", sendername, gravity);
  2249. SendClientMessageToAll(ADMIN_RED, string);
  2250. }
  2251. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2252. return 1;
  2253. }
  2254.  
  2255. if (!strcmp(cmd, "/settime", true)) // Changes time
  2256. {
  2257. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 3)
  2258. {
  2259. tmp = strtok(cmdtext, idx);
  2260. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /settime [time(0-23)]");
  2261. new time = strval(tmp);
  2262. if (time < 0 || time > 23) return SendClientMessage(playerid, RED, "Time can only be from 0 to 23!");
  2263. SetWorldTime(time);
  2264. GetPlayerName(playerid, sendername, sizeof(sendername));
  2265. format(string,sizeof(string),"|- Administrator %s has changed time [ Hour: %d ] -|", sendername, time);
  2266. SendClientMessageToAll(ADMIN_RED, string);
  2267. }
  2268. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2269. return 1;
  2270. }
  2271.  
  2272. if (!strcmp(cmd, "/setweather", true)) // Changes time
  2273. {
  2274. if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 4)
  2275. {
  2276. tmp = strtok(cmdtext, idx);
  2277. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /setweather [weather id]");
  2278. new weather = strval(tmp);
  2279. SetWeather(weather);
  2280. GetPlayerName(playerid, sendername, sizeof(sendername));
  2281. format(string,sizeof(string),"|- Administrator %s has changed weather [ Weather: %d ] -|", sendername, weather);
  2282. SendClientMessageToAdmins(ADMIN_RED, string, 1);
  2283. }
  2284. else SendClientMessage(playerid, RED, "You're not an admin with the required level.");
  2285. return 1;
  2286. }
  2287.  
  2288. if(strcmp(cmd, "/report", true) == 0) // Available for everyone: reports a player to the admins
  2289. {
  2290. tmp = strtok(cmdtext, idx);
  2291. if(!strlen(tmp))
  2292. {
  2293. SendClientMessage(playerid, ORANGE, "USAGE: /report [playername/id] [reason]");
  2294. SendClientMessage(playerid, ORANGE, "FUNCTION: Will report the specified player to the administrators(online).");
  2295. return 1;
  2296. }
  2297. new targetid = ReturnUser(tmp);
  2298. if(targetid != INVALID_PLAYER_ID)
  2299. {
  2300. GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
  2301. GetPlayerName(playerid, sendername, sizeof(sendername));
  2302. new reason[128];
  2303. reason = bigstrtok(cmdtext, idx);
  2304. if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /report [playerid] [reason]");
  2305. format(string, sizeof(string), "|- %s reported %s [ Reason: %s ]", sendername,giveplayername,reason);
  2306. SendClientMessageToAdmins(ADMIN_RED, string,1);
  2307. format(string, sizeof(string), "Your report on '%s' has been sent to the current online admins. Thank you.", giveplayername);
  2308. SendClientMessage(playerid, GREEN, string);
  2309. }
  2310.  
  2311. else if(giveplayerid == INVALID_PLAYER_ID)
  2312. {
  2313. format(string, sizeof(string), "%d is not an active player.", giveplayerid);
  2314. SendClientMessage(playerid, RED, string);
  2315. }
  2316. return 1;
  2317. }
  2318.  
  2319. if(strcmp(cmd, "/ah", true) == 0 || strcmp(cmd, "/ahelp", true) == 0 || strcmp(cmd, "/acommands", true) == 0) // List of admin commands
  2320. {
  2321. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  2322. {
  2323. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2324. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /kick/kill /goto /ip /pweapons /view /changepassword /virtual /disarm");
  2325. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: // Example: //hello");
  2326. }
  2327. if (AccountInfo[playerid][AdminLevel] >= 2 || IsPlayerAdmin(playerid))
  2328. {
  2329. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2330. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /kick/kill /goto /ip /pweapons /view /changepassword");
  2331. SendClientMessage(playerid, ORANGE, "LEVEL 2+: /(un)mute /get /pstats /warn /viewcmds /logout /virtual/an");
  2332. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: // Example: //hello");
  2333. }
  2334. if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
  2335. {
  2336. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2337. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /kick/kill /goto /ip /pweapons /view /changepassword /disarm");
  2338. SendClientMessage(playerid, ORANGE, "LEVEL 2+: /(un)mute /get /pstats /warn /viewcmds /logout /virtual /an");
  2339. SendClientMessage(playerid, ORANGE, "LEVEL 3+: /ban /say /giveweapon /slap /gotoveh /(un)jail /sethp /push /settime /bslap");
  2340. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: / Example: /hello");
  2341. }
  2342. if (AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid))
  2343. {
  2344. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2345. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /setscore /angle /kick/kill /goto /ip /pweapons /view /changepassword /virtual /slap /disarm ");
  2346. SendClientMessage(playerid, ORANGE, "LEVEL 2+: /(un)mute /get /pstats /warn /viewcmds /logout /virtual/an");
  2347. SendClientMessage(playerid, ORANGE, "LEVEL 3+: /ban /say /giveweapon /slap /gotoveh /(un)jail /sethp /push /settime /bslap");
  2348. SendClientMessage(playerid, ORANGE, "LEVEL 4+: /fuck /bc /setwarn /announce /aclearchat /(un)hide /rangeban /teleport /setgravity /setweather");
  2349. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: // Example: //hello");
  2350.  
  2351. }
  2352. if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
  2353. {
  2354. SendClientMessage(playerid, YELLOW, " |- Server Admin Commands -|");
  2355. SendClientMessage(playerid, ORANGE, "LEVEL 1+: /(un)freeze /setscore /angle /kick/kill /goto /ip /pweapons /view /changepassword /virtual /slap /disarm ");
  2356. SendClientMessage(playerid, ORANGE, "LEVEL 2+: /(un)mute /get /pstats /warn /viewcmds /logout /virtual/an");
  2357. SendClientMessage(playerid, ORANGE, "LEVEL 3+: /ban /say /giveweapon /slap /gotoveh /(un)jail /sethp /push /settime /bslap");
  2358. SendClientMessage(playerid, ORANGE, "LEVEL 4+: /fuck /bc /setwarn /announce /aclearchat /(un)hide /rangeban /teleport /setgravity /setweather");
  2359. SendClientMessage(playerid, ORANGE, "LEAD(5): /gmx /makeadmin /missile");
  2360. SendClientMessage(playerid, ORANGE, "ADMIN CHAT: // Example: //hello");
  2361. }
  2362. else SendClientMessage(playerid, RED, "You are not an admin!");
  2363. return 1;
  2364. }
  2365.  
  2366.  
  2367. if (strcmp(cmd, "/admins", true) == 0) // Admin list if they're online
  2368. {
  2369. new count = 0;
  2370. SendClientMessage(playerid, GREEN, " [Online Admins]");
  2371. for(new i = 0; i < MAX_PLAYERS; i++)
  2372. {
  2373. if (IsPlayerConnected(i))
  2374. {
  2375. if(AccountInfo[i][AdminLevel] >= 1 && AccountInfo[i][AdminLevel] <= 5 && Hide[i] == 0)
  2376. {
  2377. GetPlayerName(i, sendername, sizeof(sendername));
  2378. format(string, 128, "Level %d [%i]%s", AccountInfo[i][AdminLevel],i,sendername);
  2379. SendClientMessage(playerid, LIGHTGREEN, string);
  2380. count++;
  2381. }
  2382. }
  2383. }
  2384. if (count == 0) SendClientMessage(playerid,RED,"No admin online in the list");
  2385. SendClientMessage(playerid, GREEN, "[____________________________________]");
  2386. return 1;
  2387. }
  2388.  
  2389. if (strcmp(cmd, "/register", true) == 0) // Registers an account
  2390. {
  2391. if(IsPlayerConnected(playerid))
  2392. {
  2393. if(AccountInfo[playerid][Logged] == 1)
  2394. {
  2395. SendClientMessage(playerid, RED, "You are already logged in.");
  2396. return 1;
  2397. }
  2398. GetPlayerName(playerid, sendername, sizeof(sendername));
  2399. format(string, sizeof(string), "/sHAccounts/%s.seifadmin", sendername);
  2400. new File: hFile = fopen(string, io_read);
  2401. if (hFile)
  2402. {
  2403. SendClientMessage(playerid, RED, "That name is already taken. Please reconnect using a different username.");
  2404. fclose(hFile);
  2405. return 1;
  2406. }
  2407. new tmppass[128];
  2408. tmp = strtok(cmdtext, idx);
  2409. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /register [password]");
  2410. strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
  2411. OnPlayerRegister(playerid, MD5_Hash(tmppass));
  2412. }
  2413. return 1;
  2414. }
  2415.  
  2416. if (strcmp(cmd, "/login", true) == 0) // Logins
  2417. {
  2418. new tmppass[128];
  2419. if(AccountInfo[playerid][Logged] == 1) return SendClientMessage(playerid, RED, "You are already logged in.");
  2420. tmp = strtok(cmdtext, idx);
  2421. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /login [password]");
  2422. new plname[MAX_PLAYER_NAME];
  2423. GetPlayerName(playerid, plname, sizeof(plname));
  2424. format(string, sizeof(string), "/sHAccounts/%s.seifadmin", plname);
  2425. if(!fexist(string)) return SendClientMessage(playerid, RED, "That account isn't registered! Please register: /register [password]");
  2426. strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
  2427. OnPlayerLogin(playerid, MD5_Hash(tmppass));
  2428. return 1;
  2429. }
  2430.  
  2431. if (!strcmp(cmd, "/changepassword", true)) // Changes your password
  2432. {
  2433. if (!AccountInfo[playerid][Logged]) return SendClientMessage(playerid, RED, "You're not logged in.");
  2434. if (AccountInfo[playerid][AdminLevel] >= 1)
  2435. {
  2436. new oldpass[128];
  2437. oldpass = strtok(cmdtext, idx);
  2438. if(!strlen(oldpass)) return SendClientMessage(playerid, ORANGE, "USAGE: /changepassword [CURRENT PASSWORD] [new password]");
  2439. if (strcmp(MD5_Hash(oldpass), AccountInfo[playerid][Password], true)) return SendClientMessage(playerid, RED, "Invalid password.");
  2440. tmp = strtok(cmdtext, idx);
  2441. if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /changepassword [current password] [NEW PASSWORD]");
  2442. format(oldpass, 128, "|- You've changed your password to '%s' -|", tmp);
  2443. SendClientMessage(playerid, LIGHTGREEN, oldpass);
  2444. strmid(AccountInfo[playerid][Password], MD5_Hash(tmp), 0, strlen(MD5_Hash(tmp)), 128);
  2445. }
  2446. return 1;
  2447. }
  2448.  
  2449. /*»»»»»»»»»»»»»»»»»»»»»»»»»»»» [WRONG COMMAND] «««««««««««««««««««««««««««*/
  2450. else
  2451. {
  2452. for(new i = 0; i < GetMaxPlayers(); i++)
  2453. {
  2454. if (IsPlayerConnected(i))
  2455. {
  2456. if (AccountInfo[i][AdminLevel] > 0 && ViewCmds[i] == 1)
  2457. {
  2458. GetPlayerName(playerid, sendername, sizeof sendername);
  2459. format(tmp, 128, "[VIEWCMDS] [%d]%s: %s", playerid, sendername, cmdtext);
  2460. SendClientMessage(i, PURPLE, tmp);
  2461. }
  2462. }
  2463. }
  2464. return 0;
  2465. }
  2466. }
  2467.  
  2468. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2469. {
  2470. if (SuperPunch[playerid] == 1)
  2471. {
  2472. if (GetPlayerState(playerid) != 2)
  2473. {
  2474. if (newkeys & KEY_FIRE && Drugs[playerid] == 0)
  2475. {
  2476. new Float:X,Float:Y,Float:Z,Float:Health;
  2477. GetPlayerHealth(playerid,Health);
  2478. if (GetPlayerWeapon(playerid) == 0)
  2479. {
  2480. GetPlayerPos(playerid,X,Y,Z);
  2481. CreateExplosion(X,Y,Z,7,7.0);
  2482. SetPlayerHealth(playerid,Health);
  2483. }
  2484. }
  2485. else if (newkeys & KEY_FIRE && Drugs[playerid] == 1)
  2486. {
  2487. new Float:X,Float:Y,Float:Z;
  2488. if (GetPlayerWeapon(playerid) == 0)
  2489. {
  2490. SetPlayerHealth(playerid,999999999);
  2491. GetPlayerPos(playerid,X,Y,Z);
  2492. CreateExplosion(X,Y,Z,7,7.0);
  2493. SetPlayerHealth(playerid,999999999);
  2494. }
  2495. }
  2496. }
  2497. }
  2498. }
  2499.  
  2500. OnPlayerJailed(playerid)
  2501. {
  2502. SetPlayerInterior(playerid, 6);
  2503. SetPlayerPos(playerid, 264.3700,77.5700,1001.0391);
  2504. SetPlayerFacingAngle(playerid, 272.6900);
  2505. TogglePlayerControllable(playerid, 0);
  2506. return 1;
  2507. }
  2508.  
  2509. OnPlayerUnjailed(playerid)
  2510. {
  2511. SetPlayerInterior(playerid, 6);
  2512. SetPlayerPos(playerid, 266.9272,78.6098,1001.0391);
  2513. SetPlayerFacingAngle(playerid, 266.9169);
  2514. TogglePlayerControllable(playerid, 1);
  2515. return 1;
  2516. }
  2517.  
  2518. public CountDown()
  2519. {
  2520. if (Count > 0)
  2521. {
  2522. new str[5];
  2523. format(str, sizeof str, "~w~%d", Count);
  2524. GameTextForAll(str,2500,3);
  2525. Count--;
  2526. SetTimer("CountDown",1000,0);
  2527. }
  2528. else
  2529. {
  2530. GameTextForAll("~g~~h~Go ~w~!!",2500,3);
  2531. Count = 999;
  2532. }
  2533. return 1;
  2534. }
  2535.  
  2536.  
  2537.  
  2538. public OnObjectMoved(objectid)
  2539. {
  2540. for(new i; i < MAX_PLAYERS; i++) if (objectid == Missile[i])
  2541. {
  2542. new Float:X,Float:Y,Float:Z,Float:x,Float:y,Float:z;
  2543. GetObjectPos(objectid, X, Y, Z);
  2544. GetObjectPos(objectid, x, y, z);
  2545. DestroyObject(objectid);
  2546. CreateExplosion(X, Y, Z, 7, 5);
  2547. //front
  2548. X += (5.0 * floatsin(0, degrees));
  2549. Y += (5.0 * floatcos(0, degrees));
  2550. CreateExplosion(X, Y, Z, 7, 5);
  2551. X += (3.0 * floatsin(0+45, degrees));
  2552. Y += (3.0 * floatcos(0+45, degrees));
  2553. CreateExplosion(X, Y, Z, 7, 5);
  2554. X += (3.0 * floatsin(0-45, degrees));
  2555. Y += (3.0 * floatcos(0-45, degrees));
  2556. CreateExplosion(X, Y, Z, 7, 5);
  2557. //right-left
  2558. X += (5.0 * floatcos(0, degrees));
  2559. Y += (5.0 * floatsin(0, degrees));
  2560. CreateExplosion(X, Y, Z, 7, 5);
  2561. //back
  2562. X -= (5.0 * floatcos(0, degrees));
  2563. Y -= (5.0 * floatsin(0, degrees));
  2564. CreateExplosion(X, Y, Z, 7, 5);
  2565. X -= (5.0 * floatsin(0, degrees));
  2566. Y -= (5.0 * floatcos(0, degrees));
  2567. CreateExplosion(X, Y, Z, 7, 5);
  2568. X -= (3.0 * floatsin(0+45, degrees));
  2569. Y -= (3.0 * floatcos(0+45, degrees));
  2570. CreateExplosion(X, Y, Z, 7, 5);
  2571. X -= (3.0 * floatsin(0-45, degrees));
  2572. Y -= (3.0 * floatcos(0-45, degrees));
  2573. CreateExplosion(X, Y, Z, 7, 5);
  2574. SetTimerEx("MissileExplosion", 700, 0, "fffd", x, y, z, 3);
  2575. break;
  2576. }
  2577. }
  2578.  
  2579. forward MissileExplosion(Float:X, Float:Y, Float:Z, times);
  2580. public MissileExplosion(Float:X, Float:Y, Float:Z, times)
  2581. {
  2582. new Float:x = X;
  2583. new Float:y = Y;
  2584. new Float:z = Z;
  2585. if (times == 3)
  2586. {
  2587. //front
  2588. X += (10.0 * floatsin(0, degrees));
  2589. Y += (10.0 * floatcos(0, degrees));
  2590. CreateExplosion(X, Y, Z, 7, 5);
  2591. X += (6.0 * floatsin(0+45, degrees));
  2592. Y += (6.0 * floatcos(0+45, degrees));
  2593. CreateExplosion(X, Y, Z, 7, 5);
  2594. X += (6.0 * floatsin(0-45, degrees));
  2595. Y += (6.0 * floatcos(0-45, degrees));
  2596. CreateExplosion(X, Y, Z, 7, 5);
  2597. //right-left
  2598. X += (10.0 * floatcos(0, degrees));
  2599. Y += (10.0 * floatsin(0, degrees));
  2600. CreateExplosion(X, Y, Z, 7, 5);
  2601. //back
  2602. X -= (10.0 * floatcos(0, degrees));
  2603. Y -= (10.0 * floatsin(0, degrees));
  2604. CreateExplosion(X, Y, Z, 7, 5);
  2605. X -= (10.0 * floatsin(0, degrees));
  2606. Y -= (10.0 * floatcos(0, degrees));
  2607. CreateExplosion(X, Y, Z, 7, 5);
  2608. X -= (6.0 * floatsin(0+45, degrees));
  2609. Y -= (6.0 * floatcos(0+45, degrees));
  2610. CreateExplosion(X, Y, Z, 7, 5);
  2611. X -= (6.0 * floatsin(0-45, degrees));
  2612. Y -= (6.0 * floatcos(0-45, degrees));
  2613. CreateExplosion(X, Y, Z, 7, 5);
  2614. }
  2615. else if (times == 2)
  2616. {
  2617. //front
  2618. X += (15.0 * floatsin(0, degrees));
  2619. Y += (15.0 * floatcos(0, degrees));
  2620. CreateExplosion(X, Y, Z, 7, 5);
  2621. X += (9.0 * floatsin(0+45, degrees));
  2622. Y += (9.0 * floatcos(0+45, degrees));
  2623. CreateExplosion(X, Y, Z, 7, 5);
  2624. X += (9.0 * floatsin(0-45, degrees));
  2625. Y += (9.0 * floatcos(0-45, degrees));
  2626. CreateExplosion(X, Y, Z, 7, 5);
  2627. //right-left
  2628. X += (15.0 * floatcos(0, degrees));
  2629. Y += (15.0 * floatsin(0, degrees));
  2630. CreateExplosion(X, Y, Z, 7, 5);
  2631. //back
  2632. X -= (15.0 * floatcos(0, degrees));
  2633. Y -= (15.0 * floatsin(0, degrees));
  2634. CreateExplosion(X, Y, Z, 7, 5);
  2635. X -= (15.0 * floatsin(0, degrees));
  2636. Y -= (15.0 * floatcos(0, degrees));
  2637. CreateExplosion(X, Y, Z, 7, 5);
  2638. X -= (9.0 * floatsin(0+45, degrees));
  2639. Y -= (9.0 * floatcos(0+45, degrees));
  2640. CreateExplosion(X, Y, Z, 7, 5);
  2641. X -= (9.0 * floatsin(0-45, degrees));
  2642. Y -= (9.0 * floatcos(0-45, degrees));
  2643. CreateExplosion(X, Y, Z, 7, 5);
  2644. }
  2645. else if (times == 1)
  2646. {
  2647. //front
  2648. X += (20.0 * floatsin(0, degrees));
  2649. Y += (20.0 * floatcos(0, degrees));
  2650. CreateExplosion(X, Y, Z, 7, 5);
  2651. X += (12.0 * floatsin(0+45, degrees));
  2652. Y += (12.0 * floatcos(0+45, degrees));
  2653. CreateExplosion(X, Y, Z, 7, 5);
  2654. X += (12.0 * floatsin(0-45, degrees));
  2655. Y += (12.0 * floatcos(0-45, degrees));
  2656. CreateExplosion(X, Y, Z, 7, 5);
  2657. //right-left
  2658. X += (20.0 * floatcos(0, degrees));
  2659. Y += (20.0 * floatsin(0, degrees));
  2660. CreateExplosion(X, Y, Z, 7, 5);
  2661. //back
  2662. X -= (20.0 * floatcos(0, degrees));
  2663. Y -= (20.0 * floatsin(0, degrees));
  2664. CreateExplosion(X, Y, Z, 7, 5);
  2665. X -= (20.0 * floatsin(0, degrees));
  2666. Y -= (20.0 * floatcos(0, degrees));
  2667. CreateExplosion(X, Y, Z, 7, 5);
  2668. X -= (12.0 * floatsin(0+45, degrees));
  2669. Y -= (12.0 * floatcos(0+45, degrees));
  2670. CreateExplosion(X, Y, Z, 7, 5);
  2671. X -= (12.0 * floatsin(0-45, degrees));
  2672. Y -= (12.0 * floatcos(0-45, degrees));
  2673. CreateExplosion(X, Y, Z, 7, 5);
  2674. }
  2675.  
  2676. if (times > 0) SetTimerEx("MissileExplosion", 700, 0, "fffd", x, y, z, times-1);
  2677. }
  2678.  
  2679. forward PushPlayer(playerid, distance, zup);
  2680. public PushPlayer(playerid, distance, zup)
  2681. {
  2682. new Float:X,Float:Y,Float:Z,Float:A;
  2683. GetPlayerPos(playerid, X, Y, Z);
  2684. GetPlayerFacingAngle(playerid, A);
  2685. if (zup == 1) SetPlayerPos(playerid, X, Y, Z+5);
  2686. GetPlayerPos(playerid, X, Y, Z);
  2687. X -= (2.0 * floatsin(-A, degrees));
  2688. Y -= (2.0 * floatcos(-A, degrees));
  2689. SetPlayerPos(playerid, X, Y, Z);
  2690. if (distance > 0) SetTimerEx("PushPlayer", 100, 0, "ddd", playerid, distance-1, 0);
  2691. }
  2692.  
  2693. stock GetVehicleModelIDFromName(vehname[])
  2694. {
  2695. for(new i = 0; i < 211; i++)
  2696. {
  2697. if (strfind(VehNames[i], vehname, true) != -1) return i + 400;
  2698. }
  2699. return -1;
  2700. }
  2701.  
  2702. stock GetWeaponModelIDFromName(weapname[])
  2703. {
  2704. for(new i = 0; i < 48; i++)
  2705. {
  2706. if (i == 19 || i == 20 || i == 21) continue;
  2707. if (strfind(WeapNames[i], weapname, true) != -1) return i;
  2708. }
  2709. return -1;
  2710. }
  2711.  
  2712. stock bigstrtok(const string[], &idx)
  2713. {
  2714. new length = strlen(string);
  2715. while ((idx < length) && (string[idx] <= ' '))
  2716. {
  2717. idx++;
  2718. }
  2719. new offset = idx;
  2720. new result[128];
  2721. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2722. {
  2723. result[idx - offset] = string[idx];
  2724. idx++;
  2725. }
  2726. result[idx - offset] = EOS;
  2727. return result;
  2728. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement