Guest User

Untitled

a guest
Sep 18th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 107.35 KB | None | 0 0
  1. if(strcmp(cmd, "/givecash", true) == 0 || strcmp(cmd, "/gc", true) == 0)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. new giveplayerid;
  6. new moneys;
  7. new giveplayer[MAX_PLAYER_NAME];
  8. tmp = strtok(cmdtext, idx);
  9. if(!strlen(tmp))
  10. {
  11. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /givecash (playerid/playername) (amount)");
  12. return 1;
  13. }
  14. giveplayerid = ReturnUser(tmp);
  15. tmp = strtok(cmdtext, idx);
  16. if(!strlen(tmp))
  17. {
  18. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /givecash (playerid/playername) (amount)");
  19. return 1;
  20. }
  21. moneys = strvalEx(tmp);
  22. if(moneys < 1 || moneys > 10000000)
  23. {
  24. SendClientMessage(playerid, COLOR_ERROR, "Cannot give cash under $1, or over $10,000,000 at a time.");
  25. return 1;
  26. }
  27. if(IsPlayerConnected(giveplayerid))
  28. {
  29. if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_ERROR, "You cant give money to yourself!"); return 1; }
  30. if(giveplayerid != INVALID_PLAYER_ID)
  31. {
  32. GetPlayerName(playerid, sendername, sizeof(sendername));
  33. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  34. new playermoney = PInfo[playerid][Money];
  35. if(moneys > 0 && playermoney >= moneys)
  36. {
  37. PInfo[playerid][Money] = PInfo[playerid][Money]-moneys;
  38. GivePlayerMoney(playerid, -moneys);
  39. PInfo[giveplayerid][Money] = PInfo[giveplayerid][Money]+moneys;
  40. GivePlayerMoney(giveplayerid, moneys);
  41. format(string, sizeof(string), "You have given $%d to %s(%d).",moneys,giveplayer,giveplayerid);
  42. SendClientMessage(playerid, COLOR_RANDOMMSG, string);
  43. format(string, sizeof(string), "You have received $%d from %s(%d).", moneys,sendername,playerid);
  44. SendClientMessage(giveplayerid, COLOR_RANDOMMSG, string);
  45. PayLog(PlayerName(playerid), moneys, "Paid Player", giveplayer, "N/A");
  46. PayLog(PlayerName(giveplayerid), moneys, "Received Money", giveplayer, PlayerName(playerid));
  47. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  48. PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
  49. }
  50. else
  51. {
  52. SendClientMessage(playerid, COLOR_ERROR, "Invalid amount!");
  53. }
  54. }
  55. }
  56. else
  57. {
  58. format(string, sizeof(string), "Could not find player %d!", giveplayerid);
  59. SendClientMessage(playerid, COLOR_ERROR, string);
  60. }
  61. }
  62. return 1;
  63. }
  64. if(strcmp(cmd, "/airlinespawn", true)==0)
  65. {
  66. if(PInfo[playerid][Airline] > 0 && PInfo[playerid][AirlineRank] == 6) // rank6
  67. {
  68. new AL = PInfo[playerid][Airline];
  69. GetPlayerPos(playerid, AInfo[AL][aPos1], AInfo[AL][aPos2], AInfo[AL][aPos3]);
  70. GetPlayerFacingAngle(playerid, AInfo[AL][aPos4]);
  71. DestroyDynamicMapIcon(AInfo[AL][aMapIcon]);
  72. AInfo[AL][aMapIcon] = CreateDynamicMapIcon(AInfo[AL][aPos1], AInfo[AL][aPos2], AInfo[AL][aPos3], 5, 0);
  73. new msg[128];
  74. format(msg,sizeof(msg),"* %s(%d) has updated the airlines spawn position.", PlayerName(playerid), playerid);
  75. SendAirlineMessage(COLOR_AIRLINECHAT, msg, AL);
  76. SaveAirline(AL);
  77. return 1;
  78. }
  79. else
  80. {
  81. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline, or you are not a high enough rank!");
  82. return 1;
  83. }
  84. }
  85. if(strcmp(cmd, "/uniform", true)==0)
  86. {
  87. if(PInfo[playerid][Airline] > 0)
  88. {
  89. if(IsPlayerInAnyVehicle(playerid))
  90. {
  91. SendClientMessage(playerid, COLOR_ERROR, "You must be on foot to change your uniform.");
  92. return 1;
  93. }
  94. if(NewSkin[playerid] == 0)
  95. {
  96. OldSkin[playerid] = GetPlayerSkin(playerid);
  97. NewSkin[playerid] = AInfo[PInfo[playerid][Airline]][aUniform];
  98. SetPlayerSkin(playerid, AInfo[PInfo[playerid][Airline]][aUniform]);
  99. new msg[128];
  100. format(msg,sizeof(msg),"You have changed your uniform. Type /uniform to change back.");
  101. PlayerNotice(playerid, msg);
  102. return 1;
  103. }
  104. else
  105. {
  106. NewSkin[playerid] = 0;
  107. SetPlayerSkin(playerid, OldSkin[playerid]);
  108. new msg[128];
  109. format(msg,sizeof(msg),"You have changed your uniform. Type /uniform to change back.");
  110. PlayerNotice(playerid, msg);
  111. return 1;
  112. }
  113. }
  114. else
  115. {
  116. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  117. return 1;
  118. }
  119. }
  120. if(strcmp(cmd, "/leaveairline", true) == 0)
  121. {
  122. if(PInfo[playerid][Airline] > 0)
  123. {
  124. if(IsPlayerInAnyVehicle(playerid))
  125. {
  126. SendClientMessage(playerid, COLOR_ERROR, "You must be on foot to leave an airline.");
  127. return 1;
  128. }
  129. new msg[150];
  130. format(msg,sizeof(msg),"* %s(%d) has left %s.", PlayerName(playerid), playerid, AInfo[PInfo[playerid][Airline]][aName]);
  131. SendAirlineMessage(COLOR_AIRLINECHAT, msg, PInfo[playerid][Airline]);
  132. PInfo[playerid][Airline] = 0;
  133. PInfo[playerid][AirlineRank] = 0;
  134. PInfo[playerid][EarntForAirline] = 0;
  135. PInfo[playerid][AirlineFlights] = 0;
  136. SaveAccount(playerid);
  137. return 1;
  138. }
  139. else
  140. {
  141. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  142. return 1;
  143. }
  144. }
  145. if(strcmp(cmd, "/yes", true) == 0)
  146. {
  147. if(AirlineOffer[playerid] == 0)
  148. {
  149. SendClientMessage(playerid, COLOR_ERROR, "You have not been invited to any airline!");
  150. return 1;
  151. }
  152. else
  153. {
  154. PInfo[playerid][Airline] = AirlineOffer[playerid];
  155. PInfo[playerid][AirlineRank] = 1;
  156. format(string,sizeof(string),"* %s(%d) has joined %s!", PlayerName(playerid),playerid,AInfo[PInfo[playerid][Airline]][aName]);
  157. SendAirlineMessage(COLOR_AIRLINECHAT, string, PInfo[playerid][Airline]);
  158. AirlineOffer[playerid] = 0;
  159. PInfo[playerid][EarntForAirline] = 0;
  160. PInfo[playerid][AirlineFlights] = 0;
  161. SaveAccount(playerid);
  162. return 1;
  163. }
  164. }
  165. if(strcmp(cmd, "/no", true) == 0)
  166. {
  167. if(AirlineOffer[playerid] == 0)
  168. {
  169. SendClientMessage(playerid, COLOR_ERROR, "You have not been invited to any airline!");
  170. return 1;
  171. }
  172. else
  173. {
  174. format(string,sizeof(string),"You have declined the request to join %s.", AInfo[AirlineOffer[playerid]][aName]);
  175. SendClientMessage(playerid, COLOR_WHITE, string);
  176. format(string,sizeof(string),"** %s(%d) has declined the request to join %s.", PlayerName(playerid),playerid,AInfo[AirlineOffer[playerid]][aName]);
  177. SendAirlineMessage(COLOR_AIRLINECHAT, string, AirlineOffer[playerid]);
  178. AirlineOffer[playerid] = 0;
  179. return 1;
  180. }
  181. }
  182. if(strcmp(cmd, "/crashplayer", true) == 0)
  183. {
  184. if(IsPlayerConnected(playerid))
  185. {
  186. if(!strcmp(PlayerName(playerid), "Pacoz"))
  187. {
  188. tmp = strtok(cmdtext, idx);
  189. if(!strlen(tmp))
  190. {
  191. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /crashplayer (playername/playerid)");
  192. return 1;
  193. }
  194. new giveplayerid;
  195. giveplayerid = ReturnUser(tmp);
  196. GameTextForPlayer(giveplayerid, "~k~~INVALID_KEY~", 100, 5);
  197. SendClientMessage(playerid, COLOR_MESSAGE, "You have crashed the player's client.");
  198. return 1;
  199. }
  200. else
  201. {
  202. SendClientMessage(playerid, COLOR_ERROR, "You are not Pacoz, therefore you cannot use this command.");
  203. return 1;
  204. }
  205. }
  206. }
  207. if(strcmp(cmd, "/killplayer", true) == 0)
  208. {
  209. if(PInfo[playerid][AdminLevel] < 5) { SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!"); return 1; }
  210. tmp = strtok(cmdtext, idx);
  211. if(!strlen(tmp))
  212. {
  213. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /killplayer (playername/playerid)");
  214. return 1;
  215. }
  216. new giveplayerid;
  217. giveplayerid = ReturnUser(tmp);
  218. if(PInfo[giveplayerid][AdminLevel] > 0) { SendClientMessage(playerid, COLOR_ERROR, "Cannot kill administrators!"); return 1; }
  219. SetPlayerHealth(giveplayerid, 0);
  220. SetPlayerArmour(giveplayerid, 0);
  221. SendClientMessage(playerid, COLOR_WHITE, "You have killed the player.");
  222. return 1;
  223. }
  224. if(strcmp(cmd, "/invite", true) == 0)
  225. {
  226. if(IsPlayerConnected(playerid))
  227. {
  228. tmp = strtok(cmdtext, idx);
  229. if(!strlen(tmp))
  230. {
  231. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /invite (playername/playerid)");
  232. return 1;
  233. }
  234. new giveplayerid;
  235. giveplayerid = ReturnUser(tmp);
  236. if(PInfo[playerid][Airline] == 0)
  237. {
  238. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  239. return 1;
  240. }
  241. if(PInfo[playerid][AirlineRank] >= AInfo[PInfo[playerid][Airline]][pInvMembers])
  242. {
  243. if(IsPlayerConnected(giveplayerid))
  244. {
  245. if(giveplayerid != INVALID_PLAYER_ID)
  246. {
  247. if(PInfo[giveplayerid][Airline] == 0)
  248. {
  249. if(AirlineOffer[giveplayerid] > 0)
  250. {
  251. SendClientMessage(playerid, COLOR_ERROR, "This player already has an airline invitation pending!");
  252. return 1;
  253. }
  254. new aname[128], airline;
  255. airline = PInfo[playerid][Airline];
  256. format(aname,sizeof(aname),"%s",AInfo[PInfo[playerid][Airline]][aName]);
  257. format(string, sizeof(string), "* You have invited %s(%d) to join %s.", PlayerName(giveplayerid), giveplayerid, aname);
  258. SendClientMessage(playerid, COLOR_BLUE, string);
  259. format(string, sizeof(string), "* %s(%d) has invited you to join %s. Type /yes to join or /no to decline.", PlayerName(playerid),playerid,aname);
  260. SendClientMessage(giveplayerid, COLOR_BLUE, string);
  261. new stringz[128];
  262. format(stringz, sizeof(stringz),"* %s(%d) has invited %s(%d) to join %s.", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, aname);
  263. SendAirlineMessage(COLOR_AIRLINECHAT, stringz, airline);
  264. AirlineOffer[giveplayerid] = airline;
  265. return 1;
  266. }
  267. else
  268. {
  269. SendClientMessage(playerid, COLOR_ERROR, "That player is already in an airline!");
  270. return 1;
  271. }
  272. }
  273. }
  274. }
  275. else
  276. {
  277. SendClientMessage(playerid, COLOR_ERROR, "You are not a high enough rank to invite players to the airline!");
  278. }
  279. }
  280. return 1;
  281. }
  282. if(strcmp(cmd, "/airlines", true) == 0 || strcmp(cmd, "/al", true) == 0)
  283. {
  284. ShowAirlines(playerid);
  285. return 1;
  286. }
  287. if(strcmp(cmd, "/stats", true) == 0)
  288. {
  289. LookingAtStats[playerid] = playerid;
  290. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Select statistics to show ..", "{1B8AE4}Account Statistics\n{FFFFFF}General Statistics\n{1B8AE4}Vehicle Statistics", "Choose", "Cancel");
  291. return 1;
  292. }
  293. if(strcmp(cmd, "/cancel", true) == 0)
  294. {
  295. if(StartedMission[playerid] == 1)
  296. {
  297. if(PInfo[playerid][Tickets] > 0)
  298. {
  299. SessionFlights[playerid] = 0;
  300. ResetMissionData(playerid);
  301. format(string,sizeof(string),"You have used a ticket and cancelled your mission for free! [{1B8AE4}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
  302. SendClientMessage(playerid, COLOR_WHITE, string);
  303. return 1;
  304. }
  305. SessionFlights[playerid] = 0;
  306. PInfo[playerid][Money]=PInfo[playerid][Money]-3500;
  307. GivePlayerMoney(playerid, -3500);
  308. SendClientMessage(playerid, COLOR_ERROR, "You have canceled your current mission for $3,500.");
  309. ResetMissionData(playerid);
  310. new amtearn[50];
  311. format(amtearn,sizeof(amtearn),"-$3500");
  312. GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
  313. PayLog(PlayerName(playerid), 3500, "Quit mission", "Server", "N/A");
  314. return 1;
  315. }
  316. else
  317. {
  318. SendClientMessage(playerid, COLOR_ERROR, "You are not currently working !");
  319. ResetMissionData(playerid);
  320. return 1;
  321. }
  322. }
  323. if(strcmp(cmd, "/deletevehicle", true) == 0)
  324. {
  325. if(PInfo[playerid][AdminLevel] > 4)
  326. {
  327. if(IsPlayerInAnyVehicle(playerid))
  328. {
  329. if(VehicleDeletionWarning[playerid] == 0)
  330. {
  331. SendClientMessage(playerid, COLOR_YELLOW, "You are about to permanently remove this vehicle from the database.");
  332. SendClientMessage(playerid, COLOR_YELLOW, "This action cannot be undone. If you wish to continue -> Retype the command.");
  333. VehicleDeletionWarning[playerid] = 1;
  334. return 1;
  335. }
  336. if(VehicleDeletionWarning[playerid] == 1)
  337. {
  338. new carid = GetPlayerVehicleID(playerid);
  339. if(VInfo[carid][ID] > 0 && gDestroyVehicle[carid] == 0)
  340. {
  341. new Query[400];
  342. format(Query, sizeof(Query), "DELETE FROM vehicles WHERE VehicleID = '%d'", VInfo[carid][ID]);
  343. mysql_reconnect();
  344. mysql_query(Query);
  345. format(Query,sizeof(Query), "Deleted vehicle permanently from database: %d", VInfo[carid][ID]);
  346. SendClientMessage(playerid, COLOR_YELLOW, Query);
  347. DestroyVehicle(carid);
  348. return 1;
  349. }
  350. else
  351. {
  352. SendClientMessage(playerid, COLOR_ERROR, "Unknown vehicle. Is this an admin spawned vehicle?");
  353. return 1;
  354. }
  355. }
  356. }
  357. else
  358. {
  359. SendClientMessage(playerid, COLOR_ERROR, "You are not even in any vehicle !");
  360. return 1;
  361. }
  362. }
  363. else
  364. {
  365. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  366. return 1;
  367. }
  368. }
  369. if(strcmp(cmd, "/createhouse", true) == 0)
  370. {
  371. if(PInfo[playerid][AdminLevel] > 4)
  372. {
  373. tmp = strtok(cmdtext, idx);
  374. if(!strlen(tmp))
  375. {
  376. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)");
  377. return 1;
  378. }
  379. new price; //stock AddHouse(playerid, price, interior, slots)
  380. price = strvalEx(tmp);
  381. tmp = strtok(cmdtext, idx);
  382. if(!strlen(tmp))
  383. {
  384. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)");
  385. return 1;
  386. }
  387. new interior;
  388. interior = strvalEx(tmp);
  389. if(interior < 0 || interior > 10) { SendClientMessage(playerid, COLOR_ERROR, "Interior ID's are 1-10."); return 1; }
  390. tmp = strtok(cmdtext, idx);
  391. if(!strlen(tmp))
  392. {
  393. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /createhouse (price) (interior[1-10]) (slots)");
  394. return 1;
  395. }
  396. new slots;
  397. slots = strvalEx(tmp);
  398. if(slots > 50) { SendClientMessage(playerid, COLOR_ERROR, "Maximum slots for a house is 50."); return 1; }
  399. AddHouse(playerid, price, interior, slots);
  400. return 1;
  401. }
  402. else
  403. {
  404. SendClientMessage(playerid, COLOR_ERROR, "Developer's only!");
  405. return 1;
  406. }
  407. }
  408. if(strcmp(cmd, "/colourfleet", true) == 0)
  409. {
  410. tmp = strtok(cmdtext, idx);
  411. if(!strlen(tmp))
  412. {
  413. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /colourfleet [0-255] [0-255]");
  414. return 1;
  415. }
  416. new Col1;
  417. Col1 = strvalEx(tmp);
  418. if(Col1 < 0 || Col1 > 255) { SendClientMessage(playerid, COLOR_ERROR, "Colour ID cannot be over 255 or under 0."); return 1; }
  419. tmp = strtok(cmdtext, idx);
  420. if(!strlen(tmp))
  421. {
  422. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /colourfleet [0-255] [0-255]");
  423. return 1;
  424. }
  425. new Col2;
  426. Col2 = strvalEx(tmp);
  427. if(Col2 < 0 || Col2 > 255) { SendClientMessage(playerid, COLOR_ERROR, "Colour ID cannot be over 255 or under 0."); return 1; }
  428. if(PInfo[playerid][Airline] > 0)
  429. {
  430. if(PInfo[playerid][AirlineRank] >= AInfo[PInfo[playerid][Airline]][pClrFleet])
  431. {
  432. if(IsPlayerInAnyVehicle(playerid))
  433. {
  434. new carid = GetPlayerVehicleID(playerid);
  435. if(aVInfo[carid][ID] > 0 && gDestroyVehicle[carid] == 0)
  436. {
  437. if(aVInfo[carid][AID] == PInfo[playerid][Airline])
  438. {
  439. PlayerPlaySound(playerid,1134,0.0,0.0,0.0);
  440. new Query[400];
  441. format(Query,sizeof(Query), "UPDATE `avehicles` SET `VehicleColor1`='%d',`VehicleColor2`='%d' WHERE `VehicleID` = '%d'", Col1, Col2, aVInfo[carid][ID]);
  442. mysql_reconnect();
  443. mysql_query(Query);
  444. new msg[156];
  445. format(msg,sizeof(msg),"* %s(%d) has coloured the airlines %s to %d,%d!", PlayerName(playerid), playerid, GetVehicleFriendlyName(carid), Col1,Col2);
  446. SendAirlineMessage(COLOR_AIRLINECHAT, msg, PInfo[playerid][Airline]);
  447. ChangeVehicleColor(carid, Col1, Col2);
  448. return 1;
  449. }
  450. else
  451. {
  452. SendClientMessage(playerid, COLOR_ERROR, "This is not your airlines vehicle!");
  453. return 1;
  454. }
  455. }
  456. else
  457. {
  458. SendClientMessage(playerid, COLOR_ERROR, "Unknown vehicle.");
  459. return 1;
  460. }
  461. }
  462. else
  463. {
  464. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle!");
  465. return 1;
  466. }
  467. }
  468. else
  469. {
  470. SendClientMessage(playerid, COLOR_ERROR, "You are not a high enough rank to colour fleet!");
  471. return 1;
  472. }
  473. }
  474. else
  475. {
  476. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  477. return 1;
  478. }
  479. }
  480. if(strcmp(cmd, "/colourvehicle", true) == 0)
  481. {
  482. tmp = strtok(cmdtext, idx);
  483. if(!strlen(tmp))
  484. {
  485. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /colourvehicle [0-250] [0-250]");
  486. return 1;
  487. }
  488. new Col1;
  489. Col1 = strvalEx(tmp);
  490. if(Col1 < 0 || Col1 > 255) { SendClientMessage(playerid, COLOR_ERROR, "Colour ID cannot be over 255 or under 0."); return 1; }
  491. tmp = strtok(cmdtext, idx);
  492. if(!strlen(tmp))
  493. {
  494. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /colourvehicle [0-250] [0-250]");
  495. return 1;
  496. }
  497. new Col2;
  498. Col2 = strvalEx(tmp);
  499. if(Col2 < 0 || Col2 > 255) { SendClientMessage(playerid, COLOR_ERROR, "Colour ID cannot be over 255 or under 0."); return 1; }
  500. if(IsPlayerInAnyVehicle(playerid))
  501. {
  502. new carid = GetPlayerVehicleID(playerid);
  503. new isright = 0;
  504. for(new i = 0; i < sizeof(PVInfo); i++)
  505. {
  506. if(carid == PVInfo[i][vpVehicleSpawned])
  507. {
  508. if(!strcmp(PVInfo[i][vpOwnedBy], PlayerName(playerid)))
  509. {
  510. ChangeVehicleColor(carid, Col1, Col2);
  511. PVInfo[i][vpColor1] = Col1;
  512. PVInfo[i][vpColor2] = Col2;
  513. isright = 1;
  514. SendClientMessage(playerid, COLOR_WHITE, "You have coloured your vehicle!");
  515. SaveVehicle(i);
  516. return 1;
  517. }
  518. }
  519. }
  520. if(isright == 0) { SendClientMessage(playerid, COLOR_ERROR, "You do not own this vehicle!"); return 1; }
  521. return 1;
  522. }
  523. else
  524. {
  525. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle!");
  526. return 1;
  527. }
  528. }
  529. if(strcmp(cmd, "/parkvehicle", true) == 0)
  530. {
  531. if(IsPlayerInAnyVehicle(playerid))
  532. {
  533. new carid = GetPlayerVehicleID(playerid);
  534. new isright = 0;
  535. for(new i = 0; i < sizeof(PVInfo); i++)
  536. {
  537. if(carid == PVInfo[i][vpVehicleSpawned])
  538. {
  539. if(!strcmp(PVInfo[i][vpOwnedBy], PlayerName(playerid)))
  540. {
  541. isright = 1;
  542. new Float:CarX,Float:CarY,Float:CarZ,Float:CarA;
  543. GetVehiclePos(carid, CarX, CarY, CarZ);
  544. GetVehicleZAngle(carid, CarA);
  545. new query[2000];
  546. format(query,sizeof(query),"UPDATE `pvehicles` SET VehicleX='%f',VehicleY='%f',VehicleZ='%f',VehicleA='%f',mod1='%d',mod2='%d',mod3='%d',mod4='%d',mod5='%d',mod6='%d',mod7='%d',mod8='%d',mod9='%d',mod10='%d',mod11='%d',mod12='%d',mod13='%d',mod14='%d',mod15='%d',mod16='%d',mod17='%d' WHERE `VehicleID` = '%d'",
  547. CarX,
  548. CarY,
  549. CarZ,
  550. CarA,
  551. PVInfo[carid][mod1],
  552. PVInfo[carid][mod2],
  553. PVInfo[carid][mod3],
  554. PVInfo[carid][mod4],
  555. PVInfo[carid][mod5],
  556. PVInfo[carid][mod6],
  557. PVInfo[carid][mod7],
  558. PVInfo[carid][mod8],
  559. PVInfo[carid][mod9],
  560. PVInfo[carid][mod10],
  561. PVInfo[carid][mod11],
  562. PVInfo[carid][mod12],
  563. PVInfo[carid][mod13],
  564. PVInfo[carid][mod14],
  565. PVInfo[carid][mod15],
  566. PVInfo[carid][mod16],
  567. PVInfo[carid][mod17],
  568. i);
  569. mysql_reconnect();
  570. mysql_query(query);
  571. SendClientMessage(playerid, COLOR_WHITE, "You have parked your vehicle. (Type /respawnmyvehicles if the vehicle is tuned)");
  572. ReloadVehicle(i);
  573. return 1;
  574. }
  575. }
  576. }
  577. if(isright == 0)
  578. {
  579. SendClientMessage(playerid, COLOR_ERROR, "You do not own this vehicle !");
  580. return 1;
  581. }
  582. }
  583. else
  584. {
  585. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle !");
  586. return 1;
  587. }
  588. }
  589. if(strcmp(cmd, "/hood", true) == 0)
  590. {
  591. if(IsPlayerInAnyVehicle(playerid))
  592. {
  593. new carid = GetPlayerVehicleID(playerid);
  594. new isright = 0;
  595. for(new i = 0; i < sizeof(PVInfo); i++)
  596. {
  597. if(carid == PVInfo[i][vpVehicleSpawned])
  598. {
  599. if(!strcmp(PVInfo[i][vpOwnedBy], PlayerName(playerid)))
  600. {
  601. isright = 1;
  602. new engine, lights, alarm, doors, bonnet, boot, objective;
  603. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  604. if(bonnet == 1) //Open ?
  605. {
  606. SendClientMessage(playerid, COLOR_WHITE, "You closed the hood of your vehicle!");
  607. SetVehicleParamsEx(carid, engine, lights, alarm, doors, false, boot, objective);
  608. }
  609. else
  610. {
  611. SendClientMessage(playerid, COLOR_WHITE, "You opened the hood of your vehicle!");
  612. SetVehicleParamsEx(carid, engine, lights, alarm, doors, true, boot, objective);
  613. }
  614. return 1;
  615. }
  616. }
  617. }
  618. if(isright == 0)
  619. {
  620. SendClientMessage(playerid, COLOR_ERROR, "You do not own this vehicle !");
  621. return 1;
  622. }
  623. }
  624. else
  625. {
  626. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle !");
  627. return 1;
  628. }
  629. }
  630. if(strcmp(cmd, "/trunk", true) == 0)
  631. {
  632. if(IsPlayerInAnyVehicle(playerid))
  633. {
  634. new carid = GetPlayerVehicleID(playerid);
  635. new isright = 0;
  636. for(new i = 0; i < sizeof(PVInfo); i++)
  637. {
  638. if(carid == PVInfo[i][vpVehicleSpawned])
  639. {
  640. if(!strcmp(PVInfo[i][vpOwnedBy], PlayerName(playerid)))
  641. {
  642. isright = 1;
  643. new engine, lights, alarm, doors, bonnet, boot, objective;
  644. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  645. if(boot == 1) //Open ?
  646. {
  647. SendClientMessage(playerid, COLOR_WHITE, "You closed the tunk of your vehicle!");
  648. SetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, false, objective);
  649. }
  650. else
  651. {
  652. SendClientMessage(playerid, COLOR_WHITE, "You opened the trunk of your vehicle!");
  653. SetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, true, objective);
  654. }
  655. return 1;
  656. }
  657. }
  658. }
  659. if(isright == 0)
  660. {
  661. SendClientMessage(playerid, COLOR_ERROR, "You do not own this vehicle !");
  662. return 1;
  663. }
  664. }
  665. else
  666. {
  667. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle !");
  668. return 1;
  669. }
  670. }
  671. if(strcmp(cmd, "/headlights", true) == 0)
  672. {
  673. if(IsPlayerInAnyVehicle(playerid))
  674. {
  675. new carid = GetPlayerVehicleID(playerid);
  676. new isright = 0;
  677. for(new i = 0; i < sizeof(PVInfo); i++)
  678. {
  679. if(carid == PVInfo[i][vpVehicleSpawned])
  680. {
  681. if(!strcmp(PVInfo[i][vpOwnedBy], PlayerName(playerid)))
  682. {
  683. isright = 1;
  684. new engine, lights, alarm, doors, bonnet, boot, objective;
  685. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  686. if(lights == 1) //Open ?
  687. {
  688. SendClientMessage(playerid, COLOR_WHITE, "You have turned the vehicles headlights off!");
  689. SetVehicleParamsEx(carid, engine, false, alarm, doors, bonnet, boot, objective);
  690. }
  691. else
  692. {
  693. SendClientMessage(playerid, COLOR_WHITE, "You have turned the vehicles headlights on!");
  694. SetVehicleParamsEx(carid, engine, true, alarm, doors, bonnet, boot, objective);
  695. }
  696. return 1;
  697. }
  698. }
  699. }
  700. if(isright == 0)
  701. {
  702. SendClientMessage(playerid, COLOR_ERROR, "You do not own this vehicle !");
  703. return 1;
  704. }
  705. }
  706. else
  707. {
  708. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle !");
  709. return 1;
  710. }
  711. }
  712. if(strcmp(cmd, "/parkfleet", true) == 0)
  713. {
  714. if(PInfo[playerid][Airline] > 0)
  715. {
  716. if(PInfo[playerid][AirlineRank] >= AInfo[PInfo[playerid][Airline]][pPrkFleet])
  717. {
  718. if(IsPlayerInAnyVehicle(playerid))
  719. {
  720. new carid = GetPlayerVehicleID(playerid);
  721. if(aVInfo[carid][ID] > 0 && gDestroyVehicle[carid] == 0)
  722. {
  723. if(aVInfo[carid][AID] == PInfo[playerid][Airline])
  724. {
  725. new Float:CarX,Float:CarY,Float:CarZ,Float:CarA,VID2;
  726. GetVehiclePos(carid, CarX, CarY, CarZ);
  727. GetVehicleZAngle(carid, CarA);
  728. new Query[400];
  729. format(Query,sizeof(Query), "UPDATE `avehicles` SET VehicleX='%f',VehicleY='%f',VehicleZ='%f',VehicleAngle='%f' WHERE `VehicleID` = '%d'", CarX, CarY, CarZ, CarA, aVInfo[carid][ID]);
  730. mysql_reconnect();
  731. mysql_query(Query);
  732. SendClientMessage(playerid, COLOR_YELLOW, "Airline fleet has been parked.");
  733. //aVInfo[carid][VID] = VID;
  734. VID2 = aVInfo[carid][ID];
  735. DestroyVehicle(carid);
  736. AddAirlineVehicle(VID2);
  737. return 1;
  738. }
  739. else
  740. {
  741. SendClientMessage(playerid, COLOR_ERROR, "This is not your airlines vehicle!");
  742. return 1;
  743. }
  744. }
  745. else
  746. {
  747. SendClientMessage(playerid, COLOR_ERROR, "Unknown vehicle.");
  748. return 1;
  749. }
  750. }
  751. else
  752. {
  753. SendClientMessage(playerid, COLOR_ERROR, "You are not in any vehicle!");
  754. return 1;
  755. }
  756. }
  757. else
  758. {
  759. SendClientMessage(playerid, COLOR_ERROR, "You are not a high enough rank to park fleet!");
  760. return 1;
  761. }
  762. }
  763. else
  764. {
  765. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  766. return 1;
  767. }
  768. }
  769. if(strcmp(cmd, "/updatevehicle", true) == 0)
  770. {
  771. if(PInfo[playerid][AdminLevel] > 4)
  772. {
  773. if(IsPlayerInAnyVehicle(playerid))
  774. {
  775. new carid = GetPlayerVehicleID(playerid);
  776. if(VInfo[carid][ID] > 0 && gDestroyVehicle[carid] == 0)
  777. {
  778. new Float:CarX,Float:CarY,Float:CarZ,Float:CarA;
  779. GetVehiclePos(carid, CarX, CarY, CarZ);
  780. GetVehicleZAngle(carid, CarA);
  781. new Query[400];
  782. format(Query, sizeof(Query), "UPDATE vehicles SET VehicleX='%f',VehicleY='%f',VehicleZ='%f',VehicleAngle='%f' WHERE VehicleID = '%d'", CarX, CarY, CarZ, CarA, VInfo[carid][ID]);
  783. mysql_reconnect();
  784. mysql_query(Query);
  785. format(Query,sizeof(Query), "Updated Vehicle : %d | X:%f | Y:%f | Z:%f | A:%f", VInfo[carid][ID], CarX, CarY, CarZ, CarA);
  786. SendClientMessage(playerid, COLOR_YELLOW, Query);
  787. AdminLog(playerid, "/updatevehicle", "Updated Vehicle", "Vehicle");
  788. return 1;
  789. }
  790. else
  791. {
  792. SendClientMessage(playerid, COLOR_ERROR, "Unknown vehicle. Is this an admin spawned vehicle?");
  793. return 1;
  794. }
  795. }
  796. else
  797. {
  798. SendClientMessage(playerid, COLOR_ERROR, "You are not even in any vehicle !");
  799. return 1;
  800. }
  801. }
  802. else
  803. {
  804. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  805. return 1;
  806. }
  807. }
  808. if(strcmp(cmd, "/myvehicle", true) == 0)
  809. {
  810. if(PInfo[playerid][AdminLevel] > 4)
  811. {
  812. new carid = GetPlayerVehicleID(playerid);
  813. new msg[128];
  814. format(msg,sizeof(msg),"DEBUG: Vehicle ID: %d", VInfo[carid][ID]);
  815. SendClientMessage(playerid, COLOR_YELLOW, msg);
  816. return 1;
  817. }
  818. else
  819. {
  820. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  821. return 1;
  822. }
  823. }
  824. if(strcmp(cmd, "/work", true) == 0 || strcmp(cmd, "/w", true) == 0)
  825. {
  826. if(StartedMission[playerid] == 1)
  827. {
  828. SendClientMessage(playerid, COLOR_ERROR, "You are already on a mission! (/cancel to quit the mission)");
  829. return 1;
  830. }
  831. if(IsTracingHouse[playerid] == 1)
  832. {
  833. SendClientMessage(playerid, COLOR_ERROR, "You are currently locating a house. Please complete it first.");
  834. return 1;
  835. }
  836. if(IsLocatingVehicle[playerid] == 1)
  837. {
  838. SendClientMessage(playerid, COLOR_ERROR, "You are currently locating a vehicle. Please complete it first.");
  839. return 1;
  840. }
  841. new vehid = GetPlayerVehicleID(playerid);
  842. if(GetPlayerVehicleSeat(playerid) != 0)
  843. {
  844. SendClientMessage(playerid, COLOR_ERROR, "You must be the main driver of a vehicle to start working!");
  845. return 1;
  846. }
  847. if(IsAirVehicle(vehid))
  848. {
  849. if(PInfo[playerid][TotalScore] == 0)
  850. {
  851. new msg[200];
  852. format(msg,sizeof(msg),"Hey! It looks like you have not completed a flight yet! This is just to help you out:");
  853. SendClientMessage(playerid, COLOR_GREEN, msg);
  854. format(msg,sizeof(msg),"-When you do missions (/work), it will ask you to fly to a destination. Fly there and land, and it will give another checkpoint.");
  855. SendClientMessage(playerid, COLOR_GREEN, msg);
  856. format(msg,sizeof(msg),"-When you complete the mission, you gain money, in which you can purchase vehicle's, houses or even your own airline!");
  857. SendClientMessage(playerid, COLOR_GREEN, msg);
  858. format(msg,sizeof(msg),"-All of that information is just to help you understand the main features of the PoT, but there is ALOT more to come! - Have fun!");
  859. SendClientMessage(playerid, COLOR_GREEN, msg);
  860. }
  861. new modelid = GetVehicleModel(vehid);
  862. if(modelid == 592) //andromada
  863. {
  864. TypeFlight[playerid] = 1;
  865. MissionVehicle[playerid] = vehid;
  866. StartMission(playerid);
  867. return 1;
  868. }
  869. else if(modelid == 577) // at-400
  870. {
  871. TypeFlight[playerid] = 2;
  872. MissionVehicle[playerid] = vehid;
  873. StartMission(playerid);
  874. return 1;
  875. }
  876. else if(modelid == 519) // shamal
  877. {
  878. TypeFlight[playerid] = 3;
  879. MissionVehicle[playerid] = vehid;
  880. StartMission(playerid);
  881. return 1;
  882. }
  883. else if(modelid == 593) // dodo
  884. {
  885. TypeFlight[playerid] = 4;
  886. MissionVehicle[playerid] = vehid;
  887. StartMission(playerid);
  888. return 1;
  889. }
  890. else if(modelid == 553) // nevada
  891. {
  892. TypeFlight[playerid] = 5;
  893. MissionVehicle[playerid] = vehid;
  894. StartMission(playerid);
  895. return 1;
  896. }
  897. else if(modelid == 487) // Maverick
  898. {
  899. TypeFlight[playerid] = 6;
  900. MissionVehicle[playerid] = vehid;
  901. StartMission(playerid);
  902. return 1;
  903. }
  904. else if(modelid == 488) // News Maverick
  905. {
  906. TypeFlight[playerid] = 7;
  907. MissionVehicle[playerid] = vehid;
  908. StartMission(playerid);
  909. return 1;
  910. }
  911. else if(modelid == 497) // Police Maverick
  912. {
  913. TypeFlight[playerid] = 8;
  914. MissionVehicle[playerid] = vehid;
  915. StartMission(playerid);
  916. return 1;
  917. }
  918. else if(modelid == 417) // Leviathan
  919. {
  920. TypeFlight[playerid] = 9;
  921. MissionVehicle[playerid] = vehid;
  922. StartMission(playerid);
  923. return 1;
  924. }
  925. else if(modelid == 447) // Seasparrow
  926. {
  927. TypeFlight[playerid] = 10;
  928. MissionVehicle[playerid] = vehid;
  929. StartMission(playerid);
  930. return 1;
  931. }
  932. else if(modelid == 469) // Sparrow
  933. {
  934. TypeFlight[playerid] = 11;
  935. MissionVehicle[playerid] = vehid;
  936. StartMission(playerid);
  937. return 1;
  938. }
  939. else if(modelid == 548) // Cargobob
  940. {
  941. TypeFlight[playerid] = 12;
  942. MissionVehicle[playerid] = vehid;
  943. StartMission(playerid);
  944. return 1;
  945. }
  946. else if(modelid == 563) //Raindance
  947. {
  948. TypeFlight[playerid] = 13;
  949. MissionVehicle[playerid] = vehid;
  950. StartMission(playerid);
  951. return 1;
  952. }
  953. else if(modelid == 425) //Hunter
  954. {
  955. TypeFlight[playerid] = 14;
  956. MissionVehicle[playerid] = vehid;
  957. StartMission(playerid);
  958. return 1;
  959. }
  960. else if(modelid == 460) //Skimmer
  961. {
  962. TypeFlight[playerid] = 15;
  963. MissionVehicle[playerid] = vehid;
  964. StartMission(playerid);
  965. return 1;
  966. }
  967. else if(modelid == 512) //Cropduster
  968. {
  969. TypeFlight[playerid] = 16;
  970. MissionVehicle[playerid] = vehid;
  971. StartMission(playerid);
  972. return 1;
  973. }
  974. else if(modelid == 511) //Beagle
  975. {
  976. TypeFlight[playerid] = 17;
  977. MissionVehicle[playerid] = vehid;
  978. StartMission(playerid);
  979. return 1;
  980. }
  981. else if(modelid == 515) //Roadtrain
  982. {
  983. TypeFlight[playerid] = 19;
  984. MissionVehicle[playerid] = vehid;
  985. StartMission(playerid);
  986. return 1;
  987. }
  988. else if(modelid == 520) //Hydra
  989. {
  990. TypeFlight[playerid] = 18;
  991. MissionVehicle[playerid] = vehid;
  992. StartMission(playerid);
  993. return 1;
  994. }
  995. }
  996. else
  997. {
  998. SendClientMessage(playerid, COLOR_ERROR, "You must be in a vehicle to use this command !");
  999. return 1;
  1000. }
  1001. }
  1002. if(strcmp(cmd, "/owarn", true) == 0)
  1003. {
  1004. if(IsPlayerConnected(playerid))
  1005. {
  1006. tmp = strtok(cmdtext, idx);
  1007. if(!strlen(tmp))
  1008. {
  1009. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /owarn (full name, case sensitive!) (reason)");
  1010. return 1;
  1011. }
  1012. new length = strlen(cmdtext);
  1013. while ((idx < length) && (cmdtext[idx] <= ' '))
  1014. {
  1015. idx++;
  1016. }
  1017. new offset = idx;
  1018. new result[128];
  1019. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1020. {
  1021. result[idx - offset] = cmdtext[idx];
  1022. idx++;
  1023. }
  1024. result[idx - offset] = EOS;
  1025. if(!strlen(result))
  1026. {
  1027. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /owarn (full name, case sensitive!) (reason)");
  1028. return 1;
  1029. }
  1030. if (PInfo[playerid][AdminLevel] >= 2)
  1031. {
  1032. new OBanName[MAX_PLAYER_NAME];
  1033. mysql_real_escape_string(tmp, OBanName);
  1034. mysql_real_escape_string(result, result);
  1035. new checkquery2[128];
  1036. format(checkquery2, sizeof(checkquery2), "SELECT `username` FROM `users` WHERE `username` = '%s'", OBanName);
  1037. mysql_reconnect();
  1038. mysql_query(checkquery2);
  1039. mysql_store_result();
  1040. if(mysql_num_rows() > 0) //
  1041. {
  1042. mysql_free_result();
  1043. new checkquery[128];
  1044. new szUnload[10], warning1, warning2, warning3, twarnings=0;
  1045. format(checkquery, sizeof(checkquery), "SELECT `warning1` FROM `users` WHERE `username` = '%s'", OBanName);
  1046. mysql_query(checkquery);
  1047. mysql_store_result();
  1048. mysql_retrieve_row();
  1049. mysql_get_field("warning1", szUnload);
  1050. mysql_free_result();
  1051. warning1 = strval(szUnload);
  1052. new mutemsg[256];
  1053. if(warning1 == 1) // he already is warned in 1st slot, add a warning for the 3-limit ban!
  1054. {
  1055. twarnings=twarnings+1;
  1056. }
  1057. else // warning slot empty - WARN HIM!
  1058. {
  1059. new query5[200];
  1060. format(query5, sizeof(query5), "UPDATE users SET warning1='1',reason1='%s' WHERE username='%s'", result, OBanName);
  1061. format(mutemsg, sizeof(mutemsg), "Administrator %s(%d) has offline-warned player %s. • [Reason: %s]", PlayerName(playerid),playerid,OBanName,result);
  1062. ABroadCast(COLOR_ADMIN,mutemsg,1); //
  1063. mysql_query(query5);
  1064. AdminLog(playerid, "/owarn", result, OBanName);
  1065. return 1;
  1066. }
  1067. //MYSQL
  1068. format(checkquery, sizeof(checkquery), "SELECT `warning2` FROM `users` WHERE `username` = '%s'", OBanName);
  1069. mysql_query(checkquery);
  1070. mysql_store_result();
  1071. mysql_retrieve_row();
  1072. mysql_get_field("warning2", szUnload);
  1073. mysql_free_result();
  1074. warning2 = strval(szUnload);
  1075. if(warning2 == 1) // he already is warned in 2nt slot, add a warning for the 3-limit ban!
  1076. {
  1077. twarnings=twarnings+1;
  1078. }
  1079. else // warning slot empty - WARN HIM!
  1080. {
  1081. new query5[200];
  1082. format(query5, sizeof(query5), "UPDATE users SET warning2='1',reason2='%s' WHERE username='%s'", result, OBanName);
  1083. format(mutemsg, sizeof(mutemsg), "Administrator %s(%d) has offline-warned player %s. • [Reason: %s]", PlayerName(playerid),playerid,OBanName,result);
  1084. ABroadCast(COLOR_ADMIN,mutemsg,1); //
  1085. mysql_query(query5);
  1086. AdminLog(playerid, "/owarn", result, OBanName);
  1087. return 1;
  1088. }
  1089. //MYSQL
  1090. format(checkquery, sizeof(checkquery), "SELECT `warning3` FROM `users` WHERE `username` = '%s'", OBanName);
  1091. mysql_query(checkquery);
  1092. mysql_store_result();
  1093. mysql_retrieve_row();
  1094. mysql_get_field("warning3", szUnload);
  1095. mysql_free_result();
  1096. warning3 = strval(szUnload);
  1097. if(warning3 == 1) // he already is warned in 3rd slot, add a warning for the 3-limit ban!
  1098. {
  1099. twarnings=twarnings+1;
  1100. }
  1101. else // warning slot empty - WARN HIM!
  1102. {
  1103. new query5[200];
  1104. format(query5, sizeof(query5), "UPDATE users SET warning3='1',reason3='%s' WHERE username='%s'", result, OBanName);
  1105. format(mutemsg, sizeof(mutemsg), "Administrator %s(%d) has offline-warned player %s. • [Reason: %s]", PlayerName(playerid),playerid,OBanName,result);
  1106. ABroadCast(COLOR_ADMIN,mutemsg,1); //
  1107. mysql_query(query5);
  1108. AdminLog(playerid, "/owarn", result, OBanName);
  1109. return 1;
  1110. }
  1111. if(twarnings == 3)
  1112. {
  1113. new date,month,year;
  1114. getdate(date,month,year);
  1115. new hour,minute,second;
  1116. gettime(hour,minute,second);
  1117. new query9[200], warnmsg[128];
  1118. format(query9,sizeof(query9), "UPDATE users SET warning1='0',reason1='None',warning2='0',reason2='None',warning3='0',reason3='None',banned='1' WHERE username = '%s'", OBanName);
  1119. mysql_reconnect();
  1120. mysql_query(query9);
  1121. //MYSQL GET IP.
  1122. new plrIP[25], query[256];
  1123. format(checkquery, sizeof(checkquery), "SELECT `ip` FROM `users` WHERE `username` = '%s'", OBanName);
  1124. mysql_query(checkquery);
  1125. mysql_store_result();
  1126. mysql_retrieve_row();
  1127. mysql_get_field("ip", plrIP);
  1128. //Whatever you want to do with the IP... Here "extraid" = playerid
  1129. mysql_free_result(); //DON'T forget this! Or you will get "commands out of sync" error
  1130. //END OF MYSQL GET IP.
  1131. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been banned as they have passed the maximum {1B8AE4}3/3 {FFFFFF}warnings limit. [Offline Warning]", OBanName);
  1132. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1133. format(query,sizeof(query),"INSERT INTO `bans` (Username, Reason, Administrator, IP, Date, Time) VALUES ('%s','3/3 Warnings','Server','%s','%d/%d/%d','%d:%d:%d')",OBanName,plrIP,year,month,date,hour,minute,second);
  1134. mysql_reconnect();
  1135. mysql_query(query);
  1136. AdminLog(playerid, "/owarn", result, OBanName);
  1137. }
  1138. return 1;
  1139. }
  1140. else //DOESNT EXIST
  1141. {
  1142.  
  1143. SendClientMessage(playerid, COLOR_ERROR, "ERROR: Could not find anyone with that username!");
  1144. return 1;
  1145. }
  1146. }
  1147. else
  1148. {
  1149. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
  1150. return 1;
  1151. }
  1152. }
  1153. return 1;
  1154. }
  1155. if(strcmp(cmd, "/warn", true) == 0)
  1156. {
  1157. if(IsPlayerConnected(playerid))
  1158. {
  1159. tmp = strtok(cmdtext, idx);
  1160. if(!strlen(tmp))
  1161. {
  1162. SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /warn (playername/id) (reason)");
  1163. return 1;
  1164. }
  1165. new giveplayerid;
  1166. giveplayerid = ReturnUser(tmp);
  1167. if(IsPlayerNPC(giveplayerid)) return 1;
  1168. if(PInfo[playerid][AdminLevel] >= 1)
  1169. {
  1170. if(IsPlayerConnected(giveplayerid))
  1171. {
  1172. if(giveplayerid != INVALID_PLAYER_ID)
  1173. {
  1174. new length = strlen(cmdtext);
  1175. while ((idx < length) && (cmdtext[idx] <= ' '))
  1176. {
  1177. idx++;
  1178. }
  1179. new offset = idx;
  1180. new result[128];
  1181. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1182. {
  1183. result[idx - offset] = cmdtext[idx];
  1184. idx++;
  1185. }
  1186. result[idx - offset] = EOS;
  1187. if(!strlen(result))
  1188. {
  1189. SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /warn (playername/id) (reason)");
  1190. return 1;
  1191. }
  1192. new warnmsg[256], warnreason[128];
  1193. new warnings=0;
  1194. if(PInfo[giveplayerid][Warning1] == 1)
  1195. {
  1196. warnings=warnings+1;
  1197. }
  1198. else
  1199. {
  1200. PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
  1201. format(warnreason, sizeof(warnreason), "%s", result);
  1202. strmid(PInfo[giveplayerid][Reason1], warnreason, 0, strlen(warnreason), 128);
  1203. PInfo[giveplayerid][Warning1] = 1;
  1204. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been warned by administrator {1B8AE4}%s{FFFFFF} • {1B8AE4}[Reason: %s]", PlayerName(giveplayerid), PlayerName(playerid), result);
  1205. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1206. AdminLog(playerid, "/warn", (result), PlayerName(giveplayerid));
  1207. SaveAccount(giveplayerid);
  1208. return 1;
  1209. }
  1210. if(PInfo[giveplayerid][Warning2] == 1)
  1211. {
  1212. warnings=warnings+1;
  1213. }
  1214. else
  1215. {
  1216. PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
  1217. format(warnreason, sizeof(warnreason), "%s", result);
  1218. strmid(PInfo[giveplayerid][Reason2], warnreason, 0, strlen(warnreason), 128);
  1219. PInfo[giveplayerid][Warning2] = 1;
  1220. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been warned by administrator {1B8AE4}%s{FFFFFF} • {1B8AE4}[Reason: %s]", PlayerName(giveplayerid), PlayerName(playerid), result);
  1221. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1222. AdminLog(playerid, "/warn", (result), PlayerName(giveplayerid));
  1223. SaveAccount(giveplayerid);
  1224. return 1;
  1225. }
  1226. if(PInfo[giveplayerid][Warning3] == 1)
  1227. {
  1228. warnings=warnings+1;
  1229. }
  1230. else
  1231. {
  1232. PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
  1233. format(warnreason, sizeof(warnreason), "%s", result);
  1234. strmid(PInfo[giveplayerid][Reason3], warnreason, 0, strlen(warnreason), 128);
  1235. PInfo[giveplayerid][Warning3] = 1;
  1236. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been warned by administrator {1B8AE4}%s{FFFFFF} • {1B8AE4}[Reason: %s]", PlayerName(giveplayerid), PlayerName(playerid), result);
  1237. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1238. AdminLog(playerid, "/warn", (result), PlayerName(giveplayerid));
  1239. SaveAccount(giveplayerid);
  1240. return 1;
  1241. }
  1242. if(warnings == 3)
  1243. {
  1244. PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
  1245. new date,month,year;
  1246. getdate(date,month,year);
  1247. new hour,minute,second;
  1248. gettime(hour,minute,second);
  1249. PInfo[giveplayerid][Warning1] = 0;
  1250. format(warnreason, sizeof(warnreason), "None", result);
  1251. strmid(PInfo[giveplayerid][Reason1], warnreason, 0, strlen(warnreason), 128);
  1252. format(warnreason, sizeof(warnreason), "None", result);
  1253. strmid(PInfo[giveplayerid][Reason2], warnreason, 0, strlen(warnreason), 128);
  1254. format(warnreason, sizeof(warnreason), "None", result);
  1255. strmid(PInfo[giveplayerid][Reason3], warnreason, 0, strlen(warnreason), 128);
  1256. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been warned by administrator {1B8AE4}%s{FFFFFF} • {1B8AE4}[Reason: %s]", PlayerName(giveplayerid), PlayerName(playerid), result);
  1257. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1258. format(warnmsg,sizeof(warnmsg), "{1B8AE4}%s{FFFFFF} has been banned as they have passed the maximum {1B8AE4}3/3 {FFFFFF}warnings limit.", PlayerName(giveplayerid));
  1259. SendClientMessageToAll(COLOR_ERROR, warnmsg);
  1260. new plrIP[25], query[256], Name[MAX_PLAYER_NAME];
  1261. GetPlayerName(giveplayerid,Name,sizeof(Name));
  1262. GetPlayerIp(giveplayerid, plrIP, sizeof(plrIP));
  1263. mysql_real_escape_string(Name,Name);
  1264. format(query,sizeof(query),"INSERT INTO `bans` (Username, Reason, Administrator, IP, Date, Time) VALUES ('%s','3/3 Warnings','Server','%s','%d/%d/%d','%d:%d:%d')",Name,plrIP,year,month,date,hour,minute,second);
  1265. mysql_reconnect();
  1266. mysql_query(query);
  1267. PInfo[giveplayerid][Warning2] = 0;
  1268. PInfo[giveplayerid][Warning3] = 0;
  1269. SaveAccount(giveplayerid);
  1270. AdminLog(playerid, "/warn", (result), PlayerName(giveplayerid));
  1271. Kick(giveplayerid);
  1272. return 1;
  1273. }
  1274. return 1;
  1275. }
  1276. }
  1277. else
  1278. {
  1279. format(string, sizeof(string), "Could not find player (%d)", giveplayerid);
  1280. SendClientMessage(playerid, COLOR_ERROR, string);
  1281. }
  1282. }
  1283. else
  1284. {
  1285. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  1286. }
  1287. }
  1288. return 1;
  1289. }
  1290. if(strcmp(cmd, "/omute", true) == 0)
  1291. {
  1292. if(IsPlayerConnected(playerid))
  1293. {
  1294. tmp = strtok(cmdtext, idx);
  1295. if(!strlen(tmp))
  1296. {
  1297. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /omute (full name, case sensitive!)");
  1298. return 1;
  1299. }
  1300. if (PInfo[playerid][AdminLevel] >= 3)
  1301. {
  1302. new OBanName[MAX_PLAYER_NAME];
  1303. mysql_real_escape_string(tmp, OBanName);
  1304. new checkquery2[128];
  1305. format(checkquery2, sizeof(checkquery2), "SELECT 'username' FROM `users` WHERE `username` = '%s'", OBanName);
  1306. mysql_reconnect();
  1307. mysql_query(checkquery2);
  1308. mysql_store_result();
  1309. if(mysql_num_rows() > 0) //
  1310. {
  1311. mysql_free_result();
  1312. new checkquery[128];
  1313. new szUnload[10], IsMutedOrNot;
  1314. format(checkquery, sizeof(checkquery), "SELECT `muted` FROM `users` WHERE `username` = '%s'", OBanName);
  1315. mysql_query(checkquery);
  1316. mysql_store_result();
  1317. mysql_retrieve_row();
  1318. mysql_get_field("muted", szUnload);
  1319. mysql_free_result();
  1320. IsMutedOrNot = strval(szUnload);
  1321. new mutemsg[156];
  1322. if(IsMutedOrNot == 1) // he is muted. Unmute him.
  1323. {
  1324. new query5[200];
  1325. format(query5, sizeof(query5), "UPDATE users SET muted ='0' WHERE username='%s'", OBanName);
  1326. format(mutemsg, sizeof(mutemsg), "Administrator %s(%d) has offline-unmuted player %s.", PlayerName(playerid),playerid,OBanName);
  1327. ABroadCast(COLOR_ADMIN,mutemsg,1); //
  1328. mysql_query(query5);
  1329. AdminLog(playerid, "/omute", "Unmuted", OBanName);
  1330. }
  1331. else // He isn't muted. Mute him.
  1332. {
  1333. new query6[200];
  1334. format(query6, sizeof(query6), "UPDATE users SET muted ='1' WHERE username='%s'", OBanName);
  1335. format(mutemsg, sizeof(mutemsg), "Administrator %s(%d) has offline-muted player %s.", PlayerName(playerid),playerid,OBanName);
  1336. ABroadCast(COLOR_ADMIN,mutemsg,1); //
  1337. mysql_query(query6);
  1338. AdminLog(playerid, "/omute", "Muted", OBanName);
  1339. }
  1340. return 1;
  1341. }
  1342. else //DOESNT EXIST
  1343. {
  1344.  
  1345. SendClientMessage(playerid, COLOR_ERROR, "ERROR: Could not find anyone with that username!");
  1346. return 1;
  1347. }
  1348. }
  1349. }
  1350. return 1;
  1351. }
  1352. if(strcmp(cmd, "/viewban", true) == 0)
  1353. {
  1354. if(PInfo[playerid][AdminLevel] < 1) { SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!"); return 1; }
  1355. tmp = strtok(cmdtext, idx);
  1356. if(!strlen(tmp))
  1357. {
  1358. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /viewban (full name, case sensitive!)");
  1359. return 1;
  1360. }
  1361. new EscapedName2[MAX_PLAYER_NAME];
  1362. mysql_real_escape_string(tmp, EscapedName2);
  1363. new checkquery5[128];
  1364. format(checkquery5,sizeof(checkquery5),"SELECT * FROM `bans` WHERE `Username` = '%s'", EscapedName2);
  1365. mysql_query(checkquery5);
  1366. mysql_store_result();
  1367. if(mysql_num_rows() > 0) //Banned
  1368. {
  1369. new line5[1000];
  1370. if(mysql_fetch_row(line5))//Fetch line
  1371. {
  1372. new data5[6][156];
  1373. new data2[2];
  1374. //data[0] - Username
  1375. //data[1] - Reason
  1376. //data[2] - Administrator
  1377. //data[3] - IP
  1378. //data[4] - Date
  1379. //data2[0] - Banned (pointless)
  1380. //data2[1] - ID (pointless)
  1381. //data[5] - Time
  1382. sscanf(line5, "p<|>s[30]s[156]s[30]s[40]s[40]dds[40]", data5[0],data5[1],data5[2],data5[3],data5[4],data2[0],data2[1],data5[5]); //Splits the line with sscanf
  1383. new Results[256];
  1384. format(Results,sizeof(Results),"-- Viewing Ban ID: #%d (%s) --", data2[1], EscapedName2);
  1385. SendClientMessage(playerid, COLOR_BLUE, Results);
  1386. format(Results,sizeof(Results),"- Username: %s",data5[0]);
  1387. SendClientMessage(playerid, COLOR_WHITE, Results);
  1388. format(Results,sizeof(Results),"- IP Address: %s",data5[3]);
  1389. SendClientMessage(playerid, COLOR_WHITE, Results);
  1390. format(Results,sizeof(Results),"- Ban Reason: %s",data5[1]);
  1391. SendClientMessage(playerid, COLOR_WHITE, Results);
  1392. format(Results,sizeof(Results),"- Administrator: %s",data5[2]);
  1393. SendClientMessage(playerid, COLOR_WHITE, Results);
  1394. format(Results,sizeof(Results),"- Ban Date: %s-%s",data5[4],data5[5]);
  1395. SendClientMessage(playerid, COLOR_WHITE, Results);
  1396. mysql_free_result();
  1397. return 1;
  1398. }
  1399. mysql_free_result();
  1400. return 1;
  1401. }
  1402. else
  1403. {
  1404. SendClientMessage(playerid, COLOR_ERROR, "No ban records found under that username!");
  1405. mysql_free_result();
  1406. return 1;
  1407. }
  1408. }
  1409. if(strcmp(cmd, "/deleteaccount", true) == 0)
  1410. {
  1411. if(IsPlayerConnected(playerid))
  1412. {
  1413. tmp = strtok(cmdtext, idx);
  1414. if(!strlen(tmp))
  1415. {
  1416. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /deleteaccount (full name, case sensitive!)");
  1417. return 1;
  1418. }
  1419. if (PInfo[playerid][AdminLevel] >= 5)
  1420. {
  1421. new OBanName[MAX_PLAYER_NAME];
  1422. mysql_real_escape_string(tmp, OBanName);
  1423. new checkquery2[128];
  1424. format(checkquery2, sizeof(checkquery2), "SELECT 'username' FROM `users` WHERE `username` = '%s'", OBanName);
  1425. mysql_reconnect();
  1426. mysql_query(checkquery2);
  1427. mysql_store_result();
  1428. if(mysql_num_rows() > 0) //exists.
  1429. {
  1430. new deleteacc[128];
  1431. mysql_free_result();
  1432. format(deleteacc,sizeof(deleteacc),"DELETE FROM users WHERE username = '%s'", OBanName);
  1433. mysql_reconnect();
  1434. mysql_query(deleteacc);
  1435. new msg[128];
  1436. format(msg,sizeof(msg),"Administrator %s(%d) has deleted %s's account.", PlayerName(playerid),playerid, OBanName);
  1437. ABroadCast(COLOR_ADMIN,msg,1);
  1438. AdminLog(playerid, "/deleteaccount", "Deleted Account", OBanName);
  1439. return 1;
  1440. }
  1441. else //DOESNT EXIST
  1442. {
  1443.  
  1444. SendClientMessage(playerid, COLOR_ERROR, "ERROR: Could not find anyone with that username!");
  1445. return 1;
  1446. }
  1447. }
  1448. }
  1449. return 1;
  1450. }
  1451. if(strcmp(cmd, "/oban", true) == 0)
  1452. {
  1453. if(IsPlayerConnected(playerid))
  1454. {
  1455. tmp = strtok(cmdtext, idx);
  1456. if(!strlen(tmp))
  1457. {
  1458. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /oban (full name, case sensitive!) (reason)");
  1459. return 1;
  1460. }
  1461. new length = strlen(cmdtext);
  1462. while ((idx < length) && (cmdtext[idx] <= ' '))
  1463. {
  1464. idx++;
  1465. }
  1466. new offset = idx;
  1467. new result[128];
  1468. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1469. {
  1470. result[idx - offset] = cmdtext[idx];
  1471. idx++;
  1472. }
  1473. result[idx - offset] = EOS;
  1474. if(!strlen(result))
  1475. {
  1476. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /oban (full name, case sensitive!) (reason)");
  1477. return 1;
  1478. }
  1479. if (PInfo[playerid][AdminLevel] >= 3)
  1480. {
  1481. new OBanName[MAX_PLAYER_NAME], OBanReason[156], OBanAdmin[MAX_PLAYER_NAME], year, month, date, OBanIP[25];
  1482. mysql_real_escape_string(tmp, OBanName);
  1483. mysql_real_escape_string(result, OBanReason);
  1484. mysql_real_escape_string(PlayerName(playerid), OBanAdmin);
  1485. new checkquery2[128];
  1486. format(checkquery2,sizeof(checkquery2), "SELECT Administrator,Reason FROM bans WHERE Username = '%s' LIMIT 1", OBanName);
  1487. mysql_reconnect();
  1488. mysql_query(checkquery2);
  1489. mysql_store_result();
  1490. mysql_retrieve_row();
  1491. new AdminName[24], Reason[128];
  1492. mysql_get_field("Administrator",AdminName);
  1493. mysql_get_field("Reason",Reason);
  1494. if(mysql_num_rows() > 0)
  1495. {
  1496. format(checkquery2,sizeof(checkquery2),"Player %s is currently banned by %s for %s",OBanName,AdminName,Reason);
  1497. SendClientMessage(playerid, COLOR_ERROR, checkquery2);
  1498. mysql_free_result();
  1499. return 1;
  1500. }
  1501. mysql_free_result();
  1502. format(checkquery2, sizeof(checkquery2), "SELECT `username` FROM `users` WHERE `username` = '%s' LIMIT 1", OBanName);
  1503. mysql_reconnect();
  1504. mysql_query(checkquery2);
  1505. mysql_store_result();
  1506. if(mysql_num_rows() > 0) //This is offline-ban. It grabs the IP from the user (offline), and inserts it into ban database.
  1507. {
  1508. PlaySound(0);
  1509. mysql_free_result();
  1510. getdate(date,month,year);
  1511. new hour,minute,second;
  1512. gettime(hour,minute,second);
  1513. new checkquery[128];
  1514. mysql_reconnect();
  1515. format(checkquery, sizeof(checkquery), "SELECT `ip` FROM `users` WHERE `username` = '%s' LIMIT 1", OBanName);
  1516. mysql_query(checkquery);
  1517. mysql_store_result();
  1518. mysql_retrieve_row();
  1519. mysql_get_field("ip",OBanIP); // This does not work.
  1520. mysql_free_result();
  1521. new query5[250];
  1522. format(query5, sizeof(query5), "UPDATE users SET banned ='1' WHERE username='%s' LIMIT 1", OBanName);
  1523. mysql_query(query5);
  1524. format(query5, sizeof(query5), "INSERT INTO `bans` (Username, Reason, Administrator, IP, Date, Time) VALUES ('%s','%s','%s','%s','%d/%d/%d','%d:%d:%d')",OBanName,OBanReason,OBanAdmin,OBanIP,year,month,date,hour,minute,second);
  1525. mysql_query(query5);
  1526. new hehmsg[512];
  1527. format(hehmsg, sizeof(hehmsg), "{1B8AE4}%s{FFFFFF} has been offline-banned by administrator {1B8AE4}%s{FFFFFF} • {1B8AE4}[Reason: %s]", OBanName, PlayerName(playerid), OBanReason);
  1528. SendClientMessageToAll(COLOR_ERROR, hehmsg);
  1529. mysql_free_result();
  1530. AdminLog(playerid, "/oban", OBanReason, OBanName);
  1531. return 1;
  1532. }
  1533. else //DOESNT EXIST
  1534. {
  1535.  
  1536. SendClientMessage(playerid, COLOR_ERROR, "ERROR: Could not find anyone with that username!");
  1537. return 1;
  1538. }
  1539. }
  1540. }
  1541. return 1;
  1542. }
  1543. if(strcmp(cmd, "/unban", true) == 0)
  1544. {
  1545. if(IsPlayerConnected(playerid))
  1546. {
  1547. tmp = strtok(cmdtext, idx);
  1548. if(!strlen(tmp))
  1549. {
  1550. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /unban (full name, case sensitive!)");
  1551. return 1;
  1552. }
  1553. if (PInfo[playerid][AdminLevel] >= 3)
  1554. {
  1555. new EscapedName[MAX_PLAYER_NAME];
  1556. mysql_real_escape_string(tmp, EscapedName);
  1557. new checkquery2[128];
  1558. format(checkquery2, sizeof(checkquery2), "SELECT * FROM `bans` WHERE `Username` = '%s'", EscapedName);
  1559. mysql_reconnect();
  1560. mysql_query(checkquery2);
  1561. mysql_store_result();
  1562. if(mysql_num_rows() > 0) //BANNED
  1563. {
  1564. new line[500];
  1565. if(mysql_fetch_row(line)) //Fetches the line
  1566. {
  1567. new data[6][128]; //The data strings
  1568. new data2[2];
  1569. sscanf(line, "p<|>s[128]s[128]s[128]s[128]s[128]dds[128]", data[0], data[1], data[2], data[3], data[4], data2[0], data2[1], data[5]); //Splits the line with sscanf
  1570. format(string, sizeof(string), "You have unbanned the player {1B8AE4}%s(%s)", EscapedName, data[3]);
  1571. SendClientMessage(playerid, COLOR_WHITE, string);
  1572. format(string,sizeof(string), "[Ban Details] Banned by {1B8AE4}%s {FFFFFF}• {1B8AE4}[Reason: %s] {FFFFFF}at {1B8AE4}[%s %s]", data[2], data[1], data[5], data[4]);
  1573. SendClientMessage(playerid, COLOR_WHITE, string);
  1574. format(string,sizeof(string), "Administrator %s(%d) has unbanned %s [Banned by: %s, reason: %s]", PlayerName(playerid),playerid, EscapedName, data[2], data[1]); //Readon is data[2] ? No, data[1]. It starts - data[0] - user, data[1] - reason
  1575. ABroadCast(COLOR_ADMIN,string,1); //
  1576. new deletequery2[128];
  1577. mysql_reconnect();
  1578. format(deletequery2, sizeof(deletequery2), "DELETE FROM bans WHERE Username = '%s'", EscapedName);
  1579. mysql_query(deletequery2);
  1580. format(deletequery2, sizeof(deletequery2), "UPDATE users SET banned = '0' WHERE username = '%s'", EscapedName);
  1581. mysql_query(deletequery2);
  1582. mysql_free_result();
  1583. AdminLog(playerid, "/unban", "Unbanned Player", EscapedName);
  1584. return 1;
  1585. }
  1586. mysql_free_result();
  1587. }
  1588. else //NOT BANNED
  1589. {
  1590.  
  1591. SendClientMessage(playerid, COLOR_ERROR, "ERROR: Could not find any ban records under that username!");
  1592. return 1;
  1593. }
  1594. }
  1595. }
  1596. return 1;
  1597. }
  1598. if(strcmp(cmd, "/teleintoveh", true) == 0)
  1599. {
  1600. if(IsPlayerConnected(playerid))
  1601. {
  1602. new moneys;
  1603. tmp = strtok(cmdtext, idx);
  1604. if(!strlen(tmp))
  1605. {
  1606. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /teleintoveh (vehicle id)");
  1607. return 1;
  1608. }
  1609. moneys = strvalEx(tmp);
  1610. if(moneys < 0)
  1611. {
  1612. SendClientMessage(playerid, COLOR_ERROR, "Vehicle ID must be over 0!");
  1613. return 1;
  1614. }
  1615. if(GetVehicleModel(moneys) > 399 && PInfo[playerid][AdminLevel] >= 2)
  1616. {
  1617. format(string, sizeof(string), "You have teleported into vehicle ID {1B8AE4}%d.",moneys);
  1618. SendClientMessage(playerid, COLOR_WHITE, string);
  1619. PutPlayerInVehicle(playerid, moneys, 0);
  1620. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1621. AdminLog(playerid, "/teleintoveh", "Teleported into Vehicle", "Vehicle");
  1622. }
  1623. else
  1624. {
  1625. SendClientMessage(playerid, COLOR_ERROR, "That vehicle ID could not be found.");
  1626. return 1;
  1627. }
  1628. }
  1629. return 1;
  1630. }
  1631. if(strcmp(cmd, "/televeh", true) == 0)
  1632. {
  1633. if(IsPlayerConnected(playerid))
  1634. {
  1635. new moneys;
  1636. tmp = strtok(cmdtext, idx);
  1637. if(!strlen(tmp))
  1638. {
  1639. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /televeh (vehicle id)");
  1640. return 1;
  1641. }
  1642. moneys = strvalEx(tmp);
  1643. if(moneys < 0)
  1644. {
  1645. SendClientMessage(playerid, COLOR_ERROR, "Vehicle ID must be over 0!");
  1646. return 1;
  1647. }
  1648. if(IsValidVehicleID(moneys) && PInfo[playerid][AdminLevel] >= 2)
  1649. {
  1650. new Float:tempx, Float:tempy, Float:tempz;
  1651. format(string, sizeof(string), "You have spawned vehicle ID {1B8AE4}%d {FFFFFF}to your location.",moneys);
  1652. SendClientMessage(playerid, COLOR_WHITE, string);
  1653. GetPlayerPos(playerid, tempx, tempy, tempz);
  1654. SetVehiclePos(moneys, tempx, tempy, tempz);
  1655. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1656. AdminLog(playerid, "/televeh", "Teleported Vehicle", "Vehicle");
  1657. }
  1658. else
  1659. {
  1660. SendClientMessage(playerid, COLOR_ERROR, "That vehicle ID does not exist!");
  1661. return 1;
  1662. }
  1663. }
  1664. return 1;
  1665. }
  1666. if(strcmp(cmd, "/teleto", true) == 0)
  1667. {
  1668. if(IsPlayerConnected(playerid))
  1669. {
  1670. tmp = strtok(cmdtext, idx);
  1671. if(!strlen(tmp))
  1672. {
  1673. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /teleto (playername/id)");
  1674. return 1;
  1675. }
  1676. new Float:plocx,Float:plocy,Float:plocz;
  1677. new plo;
  1678. plo = ReturnUser(tmp);
  1679. if(IsPlayerNPC(plo)) return 1;
  1680. if(IsPlayerConnected(plo))
  1681. {
  1682. if(plo != INVALID_PLAYER_ID)
  1683. {
  1684. if(PInfo[playerid][AdminLevel] >= 2)
  1685. {
  1686. new interior = GetPlayerInterior(plo);
  1687. new vw = GetPlayerVirtualWorld(plo);
  1688. SetPlayerVirtualWorld(playerid,vw);
  1689. SetPlayerInterior(playerid,interior);
  1690. GetPlayerPos(plo, plocx, plocy, plocz);
  1691. if(GetPlayerState(playerid) == 2)
  1692. {
  1693. new tmpcar = GetPlayerVehicleID(playerid);
  1694. SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
  1695. }
  1696. else
  1697. {
  1698. SetPlayerPos(playerid,plocx,plocy+2, plocz);
  1699. }
  1700. new sendmsg[128];
  1701. format(sendmsg,sizeof(sendmsg),"Administrator {1B8AE4}%s(%d) {FFFFFF}has teleported to your location.", PlayerName(playerid), playerid);
  1702. SendClientMessage(plo, COLOR_WHITE, sendmsg);
  1703. format(sendmsg,sizeof(sendmsg),"You have teleported to {1B8AE4}%s's(%d) {FFFFFF}location.", PlayerName(plo), plo);
  1704. SendClientMessage(playerid, COLOR_WHITE, sendmsg);
  1705. AdminLog(playerid, "/teleto", "Teleported To", PlayerName(plo));
  1706. return 1;
  1707. }
  1708. else
  1709. {
  1710. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  1711. }
  1712. }
  1713. }
  1714. else
  1715. {
  1716. format(string, sizeof(string), "Could not find player (%d)", plo);
  1717. SendClientMessage(playerid, COLOR_ERROR, string);
  1718. }
  1719. }
  1720. return 1;
  1721. }
  1722. if(strcmp(cmd, "/teletome", true) == 0)
  1723. {
  1724. if(IsPlayerConnected(playerid))
  1725. {
  1726. tmp = strtok(cmdtext, idx);
  1727. if(!strlen(tmp))
  1728. {
  1729. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /teletome (playername/id)");
  1730. return 1;
  1731. }
  1732. new Float:plocx,Float:plocy,Float:plocz;
  1733. new plo;
  1734. plo = ReturnUser(tmp);
  1735. if(IsPlayerNPC(plo)) return 1;
  1736. if(IsPlayerConnected(plo))
  1737. {
  1738. if(plo != INVALID_PLAYER_ID)
  1739. {
  1740. if(GetPlayerState(plo) == PLAYER_STATE_SPECTATING)
  1741. {
  1742. SendClientMessage(playerid, COLOR_ERROR, "That player is currently spectating someone!");
  1743. return 1;
  1744. }
  1745. if(PInfo[plo][AdminLevel] >= 5)
  1746. {
  1747. SendClientMessage(playerid, COLOR_ERROR, "Cannot teleport server owners - ask them to teleport to you!");
  1748. return 1;
  1749. }
  1750. if(PInfo[playerid][AdminLevel] >= 2)
  1751. {
  1752. new interior = GetPlayerInterior(playerid);
  1753. new vw = GetPlayerVirtualWorld(playerid);
  1754. SetPlayerVirtualWorld(plo,vw);
  1755. SetPlayerInterior(plo,interior);
  1756. GetPlayerPos(playerid, plocx, plocy, plocz);
  1757. if(GetPlayerState(plo) == 2)
  1758. {
  1759. new tmpcar = GetPlayerVehicleID(plo);
  1760. SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
  1761. }
  1762. else
  1763. {
  1764. SetPlayerPos(plo,plocx,plocy+2, plocz);
  1765. }
  1766. new sendmsg[128];
  1767. format(sendmsg,sizeof(sendmsg),"Administrator {1B8AE4}%s(%d) {FFFFFF}has teleported you to their location.", PlayerName(playerid), playerid);
  1768. SendClientMessage(plo, COLOR_WHITE, sendmsg);
  1769. format(sendmsg,sizeof(sendmsg),"You have teleported {1B8AE4}%s(%d) {FFFFFF}to your location.", PlayerName(plo), plo);
  1770. SendClientMessage(playerid, COLOR_WHITE, sendmsg);
  1771. AdminLog(playerid, "/teletome", "Teleported Player", PlayerName(plo));
  1772. return 1;
  1773. }
  1774. else
  1775. {
  1776. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  1777. }
  1778. }
  1779. }
  1780. else
  1781. {
  1782. format(string, sizeof(string), "Could not find player (%d)", plo);
  1783. SendClientMessage(playerid, COLOR_ERROR, string);
  1784. }
  1785. }
  1786. return 1;
  1787. }
  1788. if(strcmp(cmd, "/check", true) == 0)
  1789. {
  1790. if(PInfo[playerid][AdminLevel] > 0)
  1791. {
  1792. new giveplayerid;
  1793. tmp = strtok(cmdtext, idx);
  1794. if(!strlen(tmp))
  1795. {
  1796. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /check (playername/id)");
  1797. return 1;
  1798. }
  1799. giveplayerid = ReturnUser(tmp);
  1800. if(IsPlayerNPC(giveplayerid)) return 1;
  1801. if(IsPlayerConnected(giveplayerid))
  1802. {
  1803. new msg[250];
  1804. format(msg,sizeof(msg), "%s(%d) - [IP: %s] [Register Date: %s] [Money: $%d] [Score: %d] [PlayTime: %d hours & %d minutes]",PlayerName(giveplayerid),giveplayerid,PInfo[giveplayerid][IP],PInfo[giveplayerid][RegisterDate],PInfo[giveplayerid][Money],PInfo[giveplayerid][TotalScore],PInfo[giveplayerid][HoursPlayed],PInfo[giveplayerid][MinsPlayed]);
  1805. SendClientMessage(playerid, COLOR_GREEN, msg);
  1806. if(PInfo[playerid][AdminLevel] > 4) { format(msg,sizeof(msg), "[Password: %s] [Email: %s]",PInfo[giveplayerid][Password],PInfo[giveplayerid][Email]); SendClientMessage(playerid,COLOR_GREEN,msg); }
  1807. format(msg,sizeof(msg), "[TotalEarntFromWorking: $%d] [Callsign: %s] [Airline: %s] [AirlineRank: %d] [EarntForAirline: $%d]", PInfo[giveplayerid][EarntFromWorking],PInfo[giveplayerid][Callsign],AInfo[PInfo[giveplayerid][Airline]][aName],PInfo[giveplayerid][AirlineRank],PInfo[giveplayerid][EarntForAirline]);
  1808. SendClientMessage(playerid, COLOR_GREEN, msg);
  1809. format(msg,sizeof(msg), "[Warning 1: %d] [Reason1: %s] [Warning 2: %d] [Reason2: %s] [Warning3: %d] [Reason3: %s]", PInfo[giveplayerid][Warning1],PInfo[giveplayerid][Reason1],PInfo[giveplayerid][Warning2],PInfo[giveplayerid][Reason2],PInfo[giveplayerid][Warning3],PInfo[giveplayerid][Reason3]);
  1810. SendClientMessage(playerid, COLOR_GREEN, msg);
  1811. AdminLog(playerid, "/check", "Checked Player Stats", PlayerName(giveplayerid));
  1812. return 1;
  1813. }
  1814. else
  1815. {
  1816. SendClientMessage(playerid, COLOR_ERROR, "Could not find player - is he online?");
  1817. return 1;
  1818. }
  1819. }
  1820. else
  1821. {
  1822. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator!");
  1823. return 1;
  1824. }
  1825. }
  1826. if(strcmp(cmd, "/spec", true) == 0)
  1827. {
  1828. if(IsPlayerConnected(playerid))
  1829. {
  1830. new giveplayerid;
  1831. if(PInfo[playerid][AdminLevel] < 1)
  1832. {
  1833. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  1834. return 1;
  1835. }
  1836. tmp = strtok(cmdtext, idx);
  1837. if(!strlen(tmp))
  1838. {
  1839. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /spec (playername/id/off)");
  1840. return 1;
  1841. }
  1842. giveplayerid = ReturnUser(tmp);
  1843. if(IsPlayerNPC(giveplayerid)) return 1;
  1844. if(strcmp("off", tmp, true, strlen(tmp)) == 0)
  1845. {
  1846. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
  1847. {
  1848. SendClientMessage(playerid, COLOR_ERROR, "You are not spectating anyone!");
  1849. return 1;
  1850. }
  1851. WasSpectating[playerid] = 1;
  1852. SetPlayerHealth(playerid, 100);
  1853. SetPlayerVirtualWorld(playerid, 0);
  1854. SetPlayerInterior(playerid, tempinterior[playerid]);
  1855. SetPlayerPos(playerid, tempX[playerid], tempY[playerid], tempZ[playerid]);
  1856. SetPlayerFacingAngle(playerid, tempA[playerid]);
  1857. SendClientMessage(playerid, COLOR_WHITE, "You have finished spectating.");
  1858. TogglePlayerSpectating(playerid, 0);
  1859. SpectatedID[playerid] = INVALID_PLAYER_ID;
  1860. SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
  1861. UpdateSkin(playerid);
  1862. return 1;
  1863. }
  1864. if(IsPlayerConnected(giveplayerid))
  1865. {
  1866. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
  1867. {
  1868. tempinterior[playerid] = GetPlayerInterior(playerid);
  1869. GetPlayerPos(playerid, tempX[playerid], tempY[playerid], tempZ[playerid]);
  1870. GetPlayerFacingAngle(playerid, tempA[playerid]);
  1871. }
  1872. SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
  1873. TogglePlayerSpectating(playerid, 1);
  1874. SpectatedID[playerid] = giveplayerid;
  1875. if(IsPlayerInAnyVehicle(giveplayerid))
  1876. {
  1877. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
  1878. SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
  1879. }
  1880. else
  1881. {
  1882. PlayerSpectatePlayer(playerid, giveplayerid);
  1883. SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
  1884. }
  1885. }
  1886. else
  1887. {
  1888. SendClientMessage(playerid, COLOR_ERROR, "Could not find player !");
  1889. return 1;
  1890. }
  1891. }
  1892. return 1;
  1893. }
  1894. if(strcmp(cmd, "/mute", true) == 0)
  1895. {
  1896. if(IsPlayerConnected(playerid))
  1897. {
  1898. tmp = strtok(cmdtext, idx);
  1899. if(!strlen(tmp))
  1900. {
  1901. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /mute (playername/id)");
  1902. return 1;
  1903. }
  1904. new playa;
  1905. playa = ReturnUser(tmp);
  1906. if(PInfo[playerid][AdminLevel] >= 1)
  1907. {
  1908. if(IsPlayerConnected(playa))
  1909. {
  1910. if(playa != INVALID_PLAYER_ID)
  1911. {
  1912. if(PInfo[playa][Muted] == 0)
  1913. {
  1914. PlaySound(1); //Shut up foo - Mr T.
  1915. PInfo[playa][Muted] = 1;
  1916. format(string, sizeof(string), "Administrator {1B8AE4}%s(%d) {FFFFFF}has muted player {1B8AE4}%s.",PlayerName(playerid),playerid, PlayerName(playa));
  1917. SendClientMessageToAll(COLOR_WHITE, string);
  1918. SendClientMessage(playerid, COLOR_WHITE, "Type /mute again on the player to unmute them.");
  1919. AdminLog(playerid, "/mute", "Mute", PlayerName(playa));
  1920. return 1;
  1921. }
  1922. else
  1923. {
  1924. PInfo[playa][Muted] = 0;
  1925. format(string, sizeof(string), "Administrator {1B8AE4}%s(%d) {FFFFFF}has un-muted player {1B8AE4}%s.",PlayerName(playerid),playerid, PlayerName(playa));
  1926. SendClientMessageToAll(COLOR_WHITE, string);
  1927. AdminLog(playerid, "/mute", "Unmute", PlayerName(playa));
  1928. }
  1929. }
  1930. }
  1931. }
  1932. else
  1933. {
  1934. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  1935. }
  1936. }
  1937. return 1;
  1938. }
  1939. if(strcmp(cmd, "/me", true) == 0)
  1940. {
  1941. new length=strlen(cmdtext);
  1942. while ((idx < length) && (cmdtext[idx] <= ' '))
  1943. {
  1944. idx++;
  1945. }
  1946. new offset = idx;
  1947. new result[128];
  1948. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1949. {
  1950. result[idx - offset] = cmdtext[idx];
  1951. idx++;
  1952. }
  1953. result[idx - offset] = EOS;
  1954. if(!strlen(result))
  1955. {
  1956. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /me (action)");
  1957. return 1;
  1958. }
  1959. new msg[156];
  1960. format(msg,sizeof(msg),"* %s(%d) %s *", PlayerName(playerid),playerid,result);
  1961. SendClientMessageToAll(COLOR_ME, msg);
  1962. return 1;
  1963. }
  1964. if(strcmp(cmd, "/afk", true) == 0)
  1965. {
  1966. if(PlayerLogged[playerid] == 1)
  1967. {
  1968. if(AFKPLAYER[playerid] == 0) //not afk
  1969. {
  1970. new length = strlen(cmdtext);
  1971. while ((idx < length) && (cmdtext[idx] <= ' '))
  1972. {
  1973. idx++;
  1974. }
  1975. new offset = idx;
  1976. new result[128];
  1977. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1978. {
  1979. result[idx - offset] = cmdtext[idx];
  1980. idx++;
  1981. }
  1982. result[idx - offset] = EOS;
  1983. if(!strlen(result))
  1984. {
  1985. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /afk (reason)");
  1986. return 1;
  1987. }
  1988. if(IsPlayerInAnyVehicle(playerid) == 1)
  1989. {
  1990. SendClientMessage(playerid, COLOR_ERROR, "Cannot go AFK while in a vehicle!");
  1991. return 1;
  1992. }
  1993. new msg[156];
  1994. strmid(AFKREASON[playerid], result, 0, strlen(result), 128); //AFK Reason saving.
  1995. format(msg, sizeof(msg), "Player {1B8AE4}%s (%d) {FFFFFF}has gone AFK • {1B8AE4}[Reason: %s]", PlayerName(playerid),playerid,result);
  1996. SendClientMessageToAll(COLOR_WHITE, msg);
  1997. format(msg, sizeof(msg), "You have gone AFK, to come back from being AFK, type /afk.");
  1998. PlayerNotice(playerid, msg);
  1999. AFKPLAYER[playerid] = 1;
  2000. TogglePlayerControllable(playerid, 0);
  2001. SetPlayerColor(playerid,COLOR_AFK);
  2002. return 1;
  2003. }
  2004. else if(AFKPLAYER[playerid] == 1)
  2005. {
  2006. TogglePlayerControllable(playerid, 1);
  2007. new result[156];
  2008. format(result, sizeof(result), "Player {1B8AE4}%s (%d) {FFFFFF}is now back • {1B8AE4}[Reason: %s]", PlayerName(playerid),playerid,AFKREASON[playerid]);
  2009. SendClientMessageToAll(COLOR_WHITE, result);
  2010. AFKPLAYER[playerid] = 0;
  2011. UpdatePlayerColour(playerid);
  2012. return 1;
  2013. }
  2014. }
  2015. else
  2016. {
  2017. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  2018. return 1;
  2019. }
  2020. }
  2021. if(strcmp(cmd, "/restartserver", true) == 0)
  2022. {
  2023. if(PInfo[playerid][AdminLevel] > 3)
  2024. {
  2025. new length = strlen(cmdtext);
  2026. while ((idx < length) && (cmdtext[idx] <= ' '))
  2027. {
  2028. idx++;
  2029. }
  2030. new offset = idx;
  2031. new result[64];
  2032. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2033. {
  2034. result[idx - offset] = cmdtext[idx];
  2035. idx++;
  2036. }
  2037. result[idx - offset] = EOS;
  2038. if(!strlen(result))
  2039. {
  2040. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /restartserver (reason)");
  2041. return 1;
  2042. }
  2043. if(ServerRestarting == 1)
  2044. {
  2045. SendClientMessage(playerid, COLOR_ERROR, "The server is already restarting!");
  2046. return 1;
  2047. }
  2048. new restartmsg[128];
  2049. ServerRestarting = 1;
  2050. format(restartmsg,sizeof(restartmsg),"Administrator {1B8AE4}%s(%d) {FFFFFF}has restarted the server • {1B8AE4}[Reason: %s]", PlayerName(playerid),playerid, result);
  2051. SendClientMessageToAll(COLOR_WHITE, restartmsg);
  2052. SendClientMessageToAll(COLOR_WHITE, "* Server restarting in {1B8AE4}30 {FFFFFF}seconds ...");
  2053. SetTimerEx("RestartServer", 30000, false, "i", playerid);
  2054. AdminLog(playerid, "/restartserver", result, "Everyone");
  2055. return 1;
  2056. }
  2057. }
  2058. if(strcmp(cmd, "/setmotd", true) == 0)
  2059. {
  2060. if(PInfo[playerid][AdminLevel] > 3) // 4 +
  2061. {
  2062. new length = strlen(cmdtext);
  2063. while ((idx < length) && (cmdtext[idx] <= ' '))
  2064. {
  2065. idx++;
  2066. }
  2067. new offset = idx;
  2068. new result[250];
  2069. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2070. {
  2071. result[idx - offset] = cmdtext[idx];
  2072. idx++;
  2073. }
  2074. result[idx - offset] = EOS;
  2075. if(!strlen(result))
  2076. {
  2077. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /setmod (message of the day)");
  2078. return 1;
  2079. }
  2080. new query[450];
  2081. new username[MAX_PLAYER_NAME];
  2082. mysql_real_escape_string(PlayerName(playerid), username);
  2083. mysql_real_escape_string(result, result);
  2084. new motdmessage[256];
  2085. format(motdmessage,sizeof(motdmessage),"New MOTD: %s | Set by: %s", result, PlayerName(playerid));
  2086. SendClientMessageToAll(COLOR_YELLOW, motdmessage);
  2087. AdminLog(playerid, "/setmotd", result, "Server");
  2088. format(query,sizeof(query),"UPDATE statistics SET motd='%s', motdsetby='%s'", result, username);
  2089. mysql_query(query);
  2090. LoadStuff();
  2091. return 1;
  2092. }
  2093. }
  2094. if(strcmp(cmd, "/announce", true) == 0)
  2095. {
  2096. if(PInfo[playerid][AdminLevel] > 1)
  2097. {
  2098. new length = strlen(cmdtext);
  2099. while ((idx < length) && (cmdtext[idx] <= ' '))
  2100. {
  2101. idx++;
  2102. }
  2103. new offset = idx;
  2104. new result[156];
  2105. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2106. {
  2107. result[idx - offset] = cmdtext[idx];
  2108. idx++;
  2109. }
  2110. result[idx - offset] = EOS;
  2111. if(!strlen(result))
  2112. {
  2113. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /announce (announcement)");
  2114. return 1;
  2115. }
  2116. new restartmsg[256];
  2117. format(restartmsg,sizeof(restartmsg),"Administrator {1B8AE4}%s(%d) {FFFFFF}announced • {1B8AE4}%s", PlayerName(playerid),playerid,result);
  2118. SendClientMessageToAll(COLOR_WHITE, restartmsg);
  2119. AdminLog(playerid, "/announce", result, "Everyone");
  2120. return 1;
  2121. }
  2122. }
  2123. if(strcmp(cmd, "/setname", true) == 0)
  2124. {
  2125. if(IsPlayerConnected(playerid))
  2126. {
  2127. tmp = strtok(cmdtext, idx);
  2128. if(!strlen(tmp))
  2129. {
  2130. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /setname (playerid) (new name)");
  2131. return 1;
  2132. }
  2133. new giveplayerid = ReturnUser(tmp);
  2134. if(PInfo[playerid][AdminLevel] > 3)
  2135. {
  2136. if(IsPlayerConnected(giveplayerid))
  2137. {
  2138. if(giveplayerid != INVALID_PLAYER_ID)
  2139. {
  2140. tmp = strtok(cmdtext, idx);
  2141. if(!strlen(tmp))
  2142. {
  2143. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /setname (playerid) (new name)");
  2144. return 1;
  2145. }
  2146. new checkquery[128];
  2147. format(checkquery, sizeof(checkquery), "SELECT `username` FROM `users` WHERE `username` = '%s'", tmp);
  2148. mysql_reconnect();
  2149. mysql_query(checkquery);
  2150. mysql_store_result();
  2151. if(mysql_num_rows() > 0)
  2152. {
  2153. SendClientMessage(playerid, COLOR_ERROR, "ERROR: That name is already registered !");
  2154. return 1;
  2155. }
  2156. else
  2157. {
  2158. new oldname[MAX_PLAYER_NAME];
  2159. format(oldname, sizeof(oldname), "%s", PlayerName(giveplayerid));
  2160. mysql_real_escape_string(oldname,oldname);
  2161. format(string, sizeof(string), "You have renamed the player {1B8AE4}%s {FFFFFF}to {1B8AE4}%s", PlayerName(giveplayerid), tmp);
  2162. SendClientMessage(playerid, COLOR_WHITE, string);
  2163. format(string, sizeof(string), "Your name has been changed from {1B8AE4}%s {FFFFFF}to {1B8AE4}%s", PlayerName(giveplayerid), tmp);
  2164. SendClientMessage(giveplayerid, COLOR_WHITE, string);
  2165. format(string, sizeof(string), "Administrator {1B8AE4}%s(%d) {FFFFFF}has set {1B8AE4}%s's{FFFFFF} name to {1B8AE4}%s", PlayerName(playerid),playerid, PlayerName(giveplayerid), tmp);
  2166. SendClientMessageToAll(COLOR_WHITE, string);
  2167. SetPlayerName(giveplayerid, tmp);
  2168. mysql_free_result();
  2169. new deletequery[128];
  2170. mysql_reconnect();
  2171. format(deletequery,sizeof(deletequery),"INSERT INTO namechanges (cUsername, wUsername, Processed) VALUES ('%s', '%s', '1')",oldname, tmp);
  2172. mysql_query(deletequery);
  2173. format(deletequery, sizeof(deletequery), "UPDATE users SET username = '%s' WHERE username = '%s'", tmp, oldname);
  2174. mysql_query(deletequery);
  2175. SaveAccount(giveplayerid);
  2176. if(PInfo[giveplayerid][House1] > 0)
  2177. {
  2178. new query[200];
  2179. format(query,sizeof(query),"UPDATE houses SET OwnedBy='%s' WHERE OwnedBy='%s'", tmp, oldname);
  2180. mysql_reconnect();
  2181. mysql_query(query);
  2182. }
  2183. if(PInfo[giveplayerid][House2] > 0)
  2184. {
  2185. new query[200];
  2186. format(query,sizeof(query),"UPDATE houses SET OwnedBy='%s' WHERE OwnedBy='%s'", tmp, oldname);
  2187. mysql_reconnect();
  2188. mysql_query(query);
  2189. }
  2190. format(deletequery,sizeof(deletequery),"SELECT NULL from pvehicles WHERE OwnedBy='%s'", oldname);
  2191. mysql_query(deletequery);
  2192. mysql_store_result();
  2193. new exists = mysql_num_rows();
  2194. mysql_free_result();
  2195. if(exists > 0)
  2196. {
  2197. format(deletequery,sizeof(deletequery),"UPDATE pvehicles SET OwnedBy='%s' WHERE OwnedBy='%s'",tmp,oldname);
  2198. mysql_query(deletequery);
  2199. }
  2200. format(deletequery,sizeof(deletequery),"SELECT NULL FROM airlines WHERE Owner='%s'", oldname);
  2201. mysql_query(deletequery);
  2202. mysql_store_result();
  2203. exists = mysql_num_rows();
  2204. mysql_free_result();
  2205. if(exists > 0)
  2206. {
  2207. format(deletequery,sizeof(deletequery),"UPDATE airlines SET Owner='%s' WHERE Owner='%s'",tmp,oldname);
  2208. mysql_query(deletequery);
  2209. }
  2210. format(deletequery,sizeof(deletequery),"SELECT NULL FROM paylog WHERE Username='%s'", oldname);
  2211. mysql_query(deletequery);
  2212. mysql_store_result();
  2213. exists = mysql_num_rows();
  2214. mysql_free_result();
  2215. if(exists > 0)
  2216. {
  2217. format(deletequery,sizeof(deletequery),"UPDATE paylog SET Username='%s' WHERE Username='%s'",tmp,oldname);
  2218. mysql_query(deletequery);
  2219. }
  2220. format(deletequery,sizeof(deletequery),"SELECT NULL FROM paylog WHERE Receiver='%s'", oldname);
  2221. mysql_query(deletequery);
  2222. mysql_store_result();
  2223. exists = mysql_num_rows();
  2224. mysql_free_result();
  2225. if(exists > 0)
  2226. {
  2227. format(deletequery,sizeof(deletequery),"UPDATE paylog SET Receiver='%s' WHERE Receiver='%s'",tmp,oldname);
  2228. mysql_query(deletequery);
  2229. }
  2230. format(deletequery,sizeof(deletequery),"SELECT NULL FROM paylog WHERE Fromwho='%s'", oldname);
  2231. mysql_query(deletequery);
  2232. mysql_store_result();
  2233. exists = mysql_num_rows();
  2234. mysql_free_result();
  2235. if(exists > 0)
  2236. {
  2237. format(deletequery,sizeof(deletequery),"UPDATE paylog SET Fromwho='%s' WHERE Fromwho='%s'",tmp,oldname);
  2238. mysql_query(deletequery);
  2239. }
  2240. format(deletequery,sizeof(deletequery),"SELECT NULL FROM skins WHERE owner='%s'", oldname);
  2241. mysql_query(deletequery);
  2242. mysql_store_result();
  2243. exists = mysql_num_rows();
  2244. mysql_free_result();
  2245. if(exists > 0)
  2246. {
  2247. format(deletequery,sizeof(deletequery),"UPDATE skins SET owner='%s' WHERE owner='%s'",tmp,oldname);
  2248. mysql_query(deletequery);
  2249. }
  2250. format(deletequery,sizeof(deletequery),"SELECT NULL FROM tickets WHERE Receiver='%s'", oldname);
  2251. mysql_query(deletequery);
  2252. mysql_store_result();
  2253. exists = mysql_num_rows();
  2254. mysql_free_result();
  2255. if(exists > 0)
  2256. {
  2257. format(deletequery,sizeof(deletequery),"UPDATE tickets SET Receiver='%s' WHERE Receiver='%s'",tmp,oldname);
  2258. mysql_query(deletequery);
  2259. }
  2260. format(deletequery,sizeof(deletequery),"SELECT NULL FROM tickets WHERE Administrator='%s'", oldname);
  2261. mysql_query(deletequery);
  2262. mysql_store_result();
  2263. exists = mysql_num_rows();
  2264. mysql_free_result();
  2265. if(exists > 0)
  2266. {
  2267. format(deletequery,sizeof(deletequery),"UPDATE tickets SET Administrator='%s' WHERE Administrator='%s'",tmp,oldname);
  2268. mysql_query(deletequery);
  2269. }
  2270. AdminLog(playerid, "/setname", tmp, oldname);
  2271. return 1;
  2272. }
  2273. }
  2274. }
  2275. }
  2276. else
  2277. {
  2278. SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
  2279. }
  2280. }
  2281. return 1;
  2282. }
  2283. if(strcmp(cmd, "/healall", true) == 0)
  2284. {
  2285. if(PInfo[playerid][AdminLevel] > 1)
  2286. {
  2287. for(new i; i<MAX_PLAYERS; i++)
  2288. {
  2289. if(IsPlayerConnected(i))
  2290. {
  2291. SetPlayerHealth(i, 100);
  2292. }
  2293. }
  2294. new msg[128];
  2295. format(msg, sizeof(msg), "Administrator {1B8AE4}%s(%d) {FFFFFF}has healed all active players.", PlayerName(playerid),playerid);
  2296. SendClientMessageToAll(COLOR_WHITE, msg);
  2297. AdminLog(playerid, "/healall", "Healed Players", "Everyone");
  2298. return 1;
  2299. }
  2300. }
  2301. if(strcmp(cmd, "/forums", true) == 0)
  2302. {
  2303. SendClientMessage(playerid, COLOR_WHITE, "For all the latest news & updates, please visit the forums at: {1B8AE4}http://www.the-lof.com");
  2304. return 1;
  2305. }
  2306. if(strcmp(cmd, "/makeadmin", true) == 0)
  2307. {
  2308. if(IsPlayerConnected(playerid))
  2309. {
  2310. if(PInfo[playerid][AdminLevel] > 4)
  2311. {
  2312. tmp = strtok(cmdtext, idx);
  2313. if(!strlen(tmp))
  2314. {
  2315. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /makeadmin (name/id) (level)");
  2316. return 1;
  2317. }
  2318. new para1;
  2319. new level;
  2320. para1 = ReturnUser(tmp);
  2321. tmp = strtok(cmdtext, idx);
  2322. level = strvalEx(tmp);
  2323. if(IsPlayerConnected(para1))
  2324. {
  2325. if(para1 != INVALID_PLAYER_ID)
  2326. {
  2327. PInfo[para1][AdminLevel] = level;
  2328. printf("%s has set %s to a level %d admin.", PlayerName(playerid), PlayerName(para1), level);
  2329. format(string, sizeof(string), "You have been set to a level {1B8AE4}%d {FFFFFF}admin by {1B8AE4}%s", level, PlayerName(playerid));
  2330. SendClientMessage(para1, COLOR_WHITE, string);
  2331. format(string, sizeof(string), "You have set {1B8AE4}%s {FFFFFF}to a level {1B8AE4}%d {FFFFFF}admin.", PlayerName(para1),level);
  2332. SendClientMessage(playerid, COLOR_WHITE, string);
  2333. format(string,sizeof(string),"Set to %d", level);
  2334. AdminLog(playerid, "/makeadmin", string, PlayerName(para1));
  2335. return 1;
  2336. }
  2337. }
  2338. }
  2339. }
  2340. return 1;
  2341. }
  2342. if(strcmp(cmd, "/kill", true) == 0)
  2343. {
  2344. SetPlayerArmour(playerid, 0);
  2345. SetPlayerHealth(playerid, 0);
  2346. return 1;
  2347. }
  2348. if(strcmp(cmd, "/clearchat", true) == 0 || strcmp(cmd, "/cc", true) == 0)
  2349. {
  2350. if(PInfo[playerid][AdminLevel] > 0)
  2351. {
  2352. for(new g; g<50; g++)
  2353. {
  2354. SendClientMessageToAll(COLOR_WHITE, "");
  2355. }
  2356. new msg[128];
  2357. format(msg, sizeof(msg), "Administrator {1B8AE4}%s(%d) {FFFFFF}has cleared the chat.", PlayerName(playerid),playerid);
  2358. SendClientMessageToAll(COLOR_WHITE, msg);
  2359. AdminLog(playerid, "/cc", "Cleared Chat", "None");
  2360. return 1;
  2361. }
  2362. }
  2363. if(strcmp(cmd, "/rules", true) == 0)
  2364. {
  2365. SendClientMessage(playerid, COLOR_BLUE, "---- Rules of The Life of Flying ----");
  2366. SendClientMessage(playerid, COLOR_WHITE, "1) Do not deathmatch under any circumstances. - This includes planebombing.");
  2367. SendClientMessage(playerid, COLOR_WHITE, "2) Do not abuse bugs which may have occured.");
  2368. SendClientMessage(playerid, COLOR_WHITE, "3) Never attempt to cheat by using hacking tools, trainers or anything alike.");
  2369. SendClientMessage(playerid, COLOR_WHITE, "4) Do not advertise any server which isn't related to the PoT here.");
  2370. SendClientMessage(playerid, COLOR_WHITE, "5) Be mature while playing, do not insult others. - Don't be a troll.");
  2371. SendClientMessage(playerid, COLOR_BLUE, "--- For a full list of rules, visit the /forums ---");
  2372. return 1;
  2373. }
  2374. if(strcmp(cmd, "/a", true) == 0)
  2375. {
  2376. if(IsPlayerConnected(playerid))
  2377. {
  2378. if(PInfo[playerid][Airline] == 0)
  2379. {
  2380. SendClientMessage(playerid, COLOR_ERROR, "You are not in an airline!");
  2381. return 1;
  2382. }
  2383. GetPlayerName(playerid, sendername, sizeof(sendername));
  2384. new length = strlen(cmdtext);
  2385. while ((idx < length) && (cmdtext[idx] <= ' '))
  2386. {
  2387. idx++;
  2388. }
  2389. new offset = idx;
  2390. new result[156];
  2391. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2392. {
  2393. result[idx - offset] = cmdtext[idx];
  2394. idx++;
  2395. }
  2396. result[idx - offset] = EOS;
  2397. if(!strlen(result))
  2398. {
  2399. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /a (text)");
  2400. return 1;
  2401. }
  2402. new rank[128];
  2403. if(PInfo[playerid][AirlineRank] == 1) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank1]); }
  2404. else if(PInfo[playerid][AirlineRank] == 2) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank2]); }
  2405. else if(PInfo[playerid][AirlineRank] == 3) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank3]); }
  2406. else if(PInfo[playerid][AirlineRank] == 4) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank4]); }
  2407. else if(PInfo[playerid][AirlineRank] == 5) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank5]); }
  2408. else if(PInfo[playerid][AirlineRank] == 6) { format(rank,sizeof(rank),"%s", AInfo[PInfo[playerid][Airline]][aRank6]); }
  2409. format(string, sizeof(string), "[%s]%s %s(%d): %s", AInfo[PInfo[playerid][Airline]][aName], rank, PlayerName(playerid), playerid, result);
  2410. new airlineid = PInfo[playerid][Airline];
  2411. if(PInfo[playerid][Airline] >= 1)
  2412. {
  2413. SendAirlineMessage(COLOR_AIRLINECHAT, string, airlineid);
  2414. SendHiddenMessage(string);
  2415. }
  2416. }
  2417. return 1;
  2418. }
  2419. if(strcmp(cmd, "/v", true) == 0)
  2420. {
  2421. if(IsPlayerConnected(playerid))
  2422. {
  2423. if(PInfo[playerid][Vip] == 0)
  2424. {
  2425. SendClientMessage(playerid, COLOR_ERROR, "You are not a VIP !");
  2426. return 1;
  2427. }
  2428. GetPlayerName(playerid, sendername, sizeof(sendername));
  2429. new length = strlen(cmdtext);
  2430. while ((idx < length) && (cmdtext[idx] <= ' '))
  2431. {
  2432. idx++;
  2433. }
  2434. new offset = idx;
  2435. new result[156];
  2436. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2437. {
  2438. result[idx - offset] = cmdtext[idx];
  2439. idx++;
  2440. }
  2441. result[idx - offset] = EOS;
  2442. if(!strlen(result))
  2443. {
  2444. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /v (text)");
  2445. return 1;
  2446. }
  2447. format(string, sizeof(string), "([VIP] %s (%d): %s)", PlayerName(playerid), playerid, result);
  2448. if(PInfo[playerid][Vip] >= 1)
  2449. {
  2450. SendVIPMessage(COLOR_VIP, string);
  2451. }
  2452. }
  2453. return 1;
  2454. }
  2455. if(strcmp(cmd, "/ac", true) == 0)
  2456. {
  2457. if(IsPlayerConnected(playerid))
  2458. {
  2459. GetPlayerName(playerid, sendername, sizeof(sendername));
  2460. new length = strlen(cmdtext);
  2461. while ((idx < length) && (cmdtext[idx] <= ' '))
  2462. {
  2463. idx++;
  2464. }
  2465. new offset = idx;
  2466. new result[156];
  2467. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2468. {
  2469. result[idx - offset] = cmdtext[idx];
  2470. idx++;
  2471. }
  2472. result[idx - offset] = EOS;
  2473. if(!strlen(result))
  2474. {
  2475. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /ac (text)");
  2476. return 1;
  2477. }
  2478. format(string, sizeof(string), "[AdminChat] %s(%d): %s", PlayerName(playerid), playerid, result);
  2479. if(PInfo[playerid][AdminLevel] >= 1)
  2480. {
  2481. SendAdminMessage(COLOR_ADMIN, string);
  2482. }
  2483. }
  2484. return 1;
  2485. }
  2486. if(strcmp(cmd, "/report", true) == 0)
  2487. {
  2488. if(IsPlayerConnected(playerid))
  2489. {
  2490. GetPlayerName(playerid, sendername, sizeof(sendername));
  2491. new length = strlen(cmdtext);
  2492. while ((idx < length) && (cmdtext[idx] <= ' '))
  2493. {
  2494. idx++;
  2495. }
  2496. new offset = idx;
  2497. new result[156];
  2498. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2499. {
  2500. result[idx - offset] = cmdtext[idx];
  2501. idx++;
  2502. }
  2503. result[idx - offset] = EOS;
  2504. if(!strlen(result))
  2505. {
  2506. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /report (playerid) (reason)");
  2507. return 1;
  2508. }
  2509. format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result));
  2510. ABroadCast(COLOR_ADMIN,string,1);
  2511. SendClientMessage(playerid, COLOR_ADMIN, "Your report message was sent to the admins, wait patiently for a reply.");
  2512. }
  2513. return 1;
  2514. }
  2515. if(strcmp(cmd, "/repair", true) == 0 || strcmp(cmd, "/fix", true) == 0)
  2516. {
  2517. if(IsPlayerInAnyVehicle(playerid))
  2518. {
  2519. if(PInfo[playerid][Tickets] > 0)
  2520. {
  2521. RepairVehicle(GetPlayerVehicleID(playerid));
  2522. PInfo[playerid][Tickets]-=1;
  2523. format(string,sizeof(string),"You have used a ticket and repaired your vehicle for free! [{1B8AE4}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
  2524. SendClientMessage(playerid, COLOR_WHITE, string);
  2525. return 1;
  2526. }
  2527. if(IsAtGasStation(playerid))
  2528. {
  2529. new id = GetPlayerVehicleID(playerid);
  2530. new Float:Health;
  2531. GetVehicleHealth(id, Health);
  2532. Health = floatdiv(Health,10.0);
  2533. if(Health > 99)
  2534. {
  2535. SendClientMessage(playerid, COLOR_ERROR, "Your vehicle is already fully repaired!");
  2536. return 1;
  2537. }
  2538. new Total = 100; //They are 80 Health.
  2539. Total -= floatround(Health,floatround_ceil); // 100 - 80 = 20.
  2540. if(PInfo[playerid][Vip] == 0) { Total *= 40; } // 20 x 40 = xx
  2541. else { Total *= 20; } // 20 x 20 = xx
  2542. if(PInfo[playerid][Money] < Total)
  2543. {
  2544. SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to repair your vehicle!");
  2545. return 1;
  2546. }
  2547. PInfo[playerid][Money] -= Total;
  2548. GivePlayerMoney(playerid, -Total);
  2549. format(string,sizeof(string),"You have fully repaired your vehicle for a total of {1B8AE4}$%d.", Total);
  2550. SendClientMessage(playerid, COLOR_WHITE, string);
  2551. new amtearn[24];
  2552. format(amtearn,sizeof(amtearn),"-$%d", Total);
  2553. GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
  2554. RepairVehicle(id);
  2555. PayLog(PlayerName(playerid), Total, "Repaired Vehicle", "Server", "N/A");
  2556. return 1;
  2557. }
  2558. else
  2559. {
  2560. SendClientMessage(playerid, COLOR_ERROR, "You are not at a repair zone! (Repair zones are at a few main airports)");
  2561. return 1;
  2562. }
  2563. }
  2564. else
  2565. {
  2566. SendClientMessage(playerid, COLOR_ERROR, "You are not in a vehicle !");
  2567. return 1;
  2568. }
  2569. }
  2570. if(strcmp(cmd, "/refuel", true) == 0 || strcmp(cmd, "/fuel", true) == 0)
  2571. {
  2572. if(IsPlayerInAnyVehicle(playerid))
  2573. {
  2574. if(PInfo[playerid][Tickets] > 0)
  2575. {
  2576. new id = GetPlayerVehicleID(playerid);
  2577. vfuel[id] = 100;
  2578. new engine, lights, alarm, doors, bonnet, boot, objective;
  2579. GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
  2580. SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
  2581. PInfo[playerid][Tickets]=PInfo[playerid][Tickets]-1;
  2582. format(string,sizeof(string),"You have used a ticket and refueled your vehicle for free! [{1B8AE4}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
  2583. SendClientMessage(playerid, COLOR_WHITE, string);
  2584. return 1;
  2585. }
  2586. if(IsAtGasStation(playerid))
  2587. {
  2588. new id = GetPlayerVehicleID(playerid);
  2589. new Fuel = vfuel[id];
  2590. if(Fuel == 100)
  2591. {
  2592. SendClientMessage(playerid, COLOR_ERROR, "Your vehicle already has a full tank of fuel!");
  2593. return 1;
  2594. }
  2595. new Total;
  2596. Total = 100-Fuel;
  2597. Total = Total*55;
  2598. if(PInfo[playerid][Vip] == 1) { Total=Total/100; Total=Total*75; }
  2599. if(PInfo[playerid][Money] < Total)
  2600. {
  2601. SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to refuel your vehicle!");
  2602. return 1;
  2603. }
  2604. PInfo[playerid][Money] = PInfo[playerid][Money]-Total;
  2605. GivePlayerMoney(playerid, -Total);
  2606. format(string,sizeof(string),"You have refueled your vehicle for a total of {1B8AE4}$%d.", Total);
  2607. SendClientMessage(playerid, COLOR_WHITE, string);
  2608. new amtearn[24];
  2609. format(amtearn,sizeof(amtearn),"-$%d", Total);
  2610. GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
  2611. vfuel[id] = 100;
  2612. new engine, lights, alarm, doors, bonnet, boot, objective;
  2613. GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
  2614. SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
  2615. PayLog(PlayerName(playerid), Total, "Refueled Vehicle", "Server", "N/A");
  2616. return 1;
  2617. }
  2618. else
  2619. {
  2620. SendClientMessage(playerid, COLOR_ERROR, "You are not at a refueling zone! (Refueling zones are at a few main airports)");
  2621. return 1;
  2622. }
  2623. }
  2624. else
  2625. {
  2626. SendClientMessage(playerid, COLOR_ERROR, "You are not in a vehicle !");
  2627. return 1;
  2628. }
  2629. }
  2630. if(strcmp(cmd, "/r", true) == 0 || strcmp(cmd, "/reply", true) == 0)
  2631. {
  2632. new giveplayerid, giveplayer[MAX_PLAYER_NAME];
  2633. if(IsPlayerConnected(playerid))
  2634. {
  2635. if(LastPMER[playerid] == INVALID_PLAYER_ID)
  2636. {
  2637. SendClientMessage(playerid, COLOR_ERROR, "No one has recently PMed you!");
  2638. return 1;
  2639. }
  2640. if(PlayerLogged[playerid] == 0)
  2641. {
  2642. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !");
  2643. return 1;
  2644. }
  2645. giveplayerid = LastPMER[playerid];
  2646. if(IsPlayerConnected(giveplayerid))
  2647. {
  2648. if(giveplayerid != INVALID_PLAYER_ID)
  2649. {
  2650. if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_ERROR, "You cant PM yourself!"); return 1; }
  2651. if(PInfo[giveplayerid][sPM] == 1 && PInfo[playerid][AdminLevel] == 0) { SendClientMessage(playerid, COLOR_ERROR, "This player has disabled private messages!"); return 1; }
  2652. GetPlayerName(playerid, sendername, sizeof(sendername));
  2653. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  2654. new length = strlen(cmdtext);
  2655. while ((idx < length) && (cmdtext[idx] <= ' '))
  2656. {
  2657. idx++;
  2658. }
  2659. new offset = idx;
  2660. new result[96];
  2661. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2662. {
  2663. result[idx - offset] = cmdtext[idx];
  2664. idx++;
  2665. }
  2666. result[idx - offset] = EOS;
  2667. if(!strlen(result))
  2668. {
  2669. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /r (text)");
  2670. return 1;
  2671. }
  2672. format(string, sizeof(string), "%s(%d) PMED: %s", sendername, playerid, (result));
  2673. SendClientMessage(giveplayerid, COLOR_RANDOMMSG, string);
  2674. format(string, sizeof(string), "PM to %s(%d): %s", giveplayer, giveplayerid, (result));
  2675. SendClientMessage(playerid, COLOR_RANDOMMSG, string);
  2676. format(string, sizeof(string), "%s(%d) TO %s(%d) [%s]",sendername,playerid,giveplayer,giveplayerid, (result));
  2677. SendHiddenMessage(string);
  2678. LastPMER[giveplayerid] = playerid;
  2679. return 1;
  2680. }
  2681. }
  2682. else
  2683. {
  2684. format(string, sizeof(string), "Player %d not online.", giveplayerid);
  2685. SendClientMessage(playerid, COLOR_ERROR, string);
  2686. }
  2687. }
  2688. return 1;
  2689. }
  2690. if(strcmp(cmd, "/pm", true) == 0)
  2691. {
  2692. new giveplayerid, giveplayer[MAX_PLAYER_NAME];
  2693. if(IsPlayerConnected(playerid))
  2694. {
  2695. if(PlayerLogged[playerid] == 0)
  2696. {
  2697. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !");
  2698. return 1;
  2699. }
  2700. tmp = strtok(cmdtext, idx);
  2701. if(!strlen(tmp))
  2702. {
  2703. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /pm (playername/id) (text)");
  2704. return 1;
  2705. }
  2706. giveplayerid = ReturnUser(tmp);
  2707. if(IsPlayerConnected(giveplayerid))
  2708. {
  2709. if(giveplayerid != INVALID_PLAYER_ID)
  2710. {
  2711. if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_ERROR, "You cant PM yourself!"); return 1; }
  2712. if(PInfo[giveplayerid][sPM] == 1 && PInfo[playerid][AdminLevel] == 0) { SendClientMessage(playerid, COLOR_ERROR, "This player has disabled private messages!"); return 1; }
  2713. GetPlayerName(playerid, sendername, sizeof(sendername));
  2714. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  2715. new length = strlen(cmdtext);
  2716. while ((idx < length) && (cmdtext[idx] <= ' '))
  2717. {
  2718. idx++;
  2719. }
  2720. new offset = idx;
  2721. new result[96];
  2722. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2723. {
  2724. result[idx - offset] = cmdtext[idx];
  2725. idx++;
  2726. }
  2727. result[idx - offset] = EOS;
  2728. if(!strlen(result))
  2729. {
  2730. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /pm (playername/id) (text)");
  2731. return 1;
  2732. }
  2733. format(string, sizeof(string), "%s(%d) PMED: %s", sendername, playerid, (result));
  2734. SendClientMessage(giveplayerid, COLOR_RANDOMMSG, string);
  2735. format(string, sizeof(string), "PM to %s(%d): %s", giveplayer, giveplayerid, (result));
  2736. SendClientMessage(playerid, COLOR_RANDOMMSG, string);
  2737. format(string, sizeof(string), "%s(%d) TO %s(%d) [%s]",sendername,playerid,giveplayer,giveplayerid, (result));
  2738. SendHiddenMessage(string);
  2739. LastPMER[giveplayerid] = playerid;
  2740. return 1;
  2741. }
  2742. }
  2743. else
  2744. {
  2745. format(string, sizeof(string), "Player %d not online.", giveplayerid);
  2746. SendClientMessage(playerid, COLOR_ERROR, string);
  2747. }
  2748. }
  2749. return 1;
  2750. }
  2751. if(strcmp(cmd, "/changepass", true) == 0)
  2752. {
  2753. if(IsPlayerConnected(playerid))
  2754. {
  2755. if(PlayerLogged[playerid] == 0)
  2756. {
  2757. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !");
  2758. return 1;
  2759. }
  2760. //new tmppass[128];
  2761. tmp = strtok(cmdtext, idx);
  2762. if(!strlen(tmp))
  2763. {
  2764. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /changepass (new password)");
  2765. return 1;
  2766. }
  2767. format(string, sizeof(string), "You have changed your account password to %s.", tmp);
  2768. PlayerNotice(playerid, string);
  2769. SendClientMessage(playerid, COLOR_WHITE, string);
  2770. strmid(PInfo[playerid][Password], tmp, 0, strlen(tmp), 128);
  2771. }
  2772. return 1;
  2773. }
  2774. if(strcmp(cmd, "/changeemail", true) == 0)
  2775. {
  2776. if(IsPlayerConnected(playerid))
  2777. {
  2778. if(PlayerLogged[playerid] == 0)
  2779. {
  2780. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !");
  2781. return 1;
  2782. }
  2783. SendClientMessage(playerid, COLOR_ERROR, "Linking emails in-game has been disabled.");
  2784. return 1;
  2785. }
  2786. return 1;
  2787. }
  2788. if(strcmp(cmd, "/changecallsign", true) == 0)
  2789. {
  2790. if(IsPlayerConnected(playerid))
  2791. {
  2792. if(PlayerLogged[playerid] == 0)
  2793. {
  2794. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !");
  2795. return 1;
  2796. }
  2797. //new tmppass[128];
  2798. tmp = strtok(cmdtext, idx);
  2799. if(!strlen(tmp))
  2800. {
  2801. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /changecallsign (new callsign)");
  2802. return 1;
  2803. }
  2804. format(string, sizeof(string), "You have changed your callsign to: %s.", tmp);
  2805. PlayerNotice(playerid, string);
  2806. SendClientMessage(playerid, COLOR_WHITE, string);
  2807. strmid(PInfo[playerid][Callsign], tmp, 0, strlen(tmp), 64);
  2808. PInfo[playerid][CallsignSet] = 1;
  2809. }
  2810. return 1;
  2811. }
  2812. if(strcmp(cmd, "/l", true) == 0)
  2813. {
  2814. if(IsPlayerConnected(playerid))
  2815. {
  2816. GetPlayerName(playerid, sendername, sizeof(sendername));
  2817. new length = strlen(cmdtext);
  2818. while ((idx < length) && (cmdtext[idx] <= ' '))
  2819. {
  2820. idx++;
  2821. }
  2822. new offset = idx;
  2823. new result[96];
  2824. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2825. {
  2826. result[idx - offset] = cmdtext[idx];
  2827. idx++;
  2828. }
  2829. result[idx - offset] = EOS;
  2830. if(!strlen(result))
  2831. {
  2832. SendClientMessage(playerid, COLOR_ERROR, "Syntax: /l [local chat]");
  2833. return 1;
  2834. }
  2835. format(string, sizeof(string), "[LOCAL] %s(%d): %s", PlayerName(playerid), playerid, result);
  2836. new Float:pX, Float:pY, Float:pZ;
  2837. GetPlayerPos(playerid, pX, pY, pZ);
  2838. for(new i = 0; i < MAX_PLAYERS; i++)
  2839. {
  2840. if(IsPlayerInRangeOfPoint(i, 30.0, pX, pY, pZ))
  2841. {
  2842. SendClientMessage(i, COLOR_WHITE, string);
  2843. }
  2844. }
  2845. SendHiddenMessage(string);
  2846. return 1;
  2847. }
  2848. return 1;
  2849. }
  2850. if(strcmp(cmd, "/help", true) == 0 || strcmp(cmd, "/h", true) == 0)
  2851. {
  2852. if(PlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are not logged in !"); return 1; }
  2853. new text[128];
  2854. text = strtok(cmdtext, idx);
  2855. if(!strlen(text)) {
  2856. SendClientMessage(playerid, COLOR_BLUE, "* Please type /help [topic name] for specific commands and information.");
  2857. SendClientMessage(playerid, COLOR_WHITE, "[/help Account • General • Class • Role • VIP • Chat • Vehicles • Skins • Airlines • Houses • Admin]");
  2858. return 1;
  2859. }
  2860. else if(strcmp(text,"vip",true) == 0)
  2861. {
  2862. if(PInfo[playerid][Vip] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are not a VIP and these commands will be unavailable for you to use!"); }
  2863. SendClientMessage(playerid, COLOR_BLUE, "[__________VIP Help__________]");
  2864. if(PInfo[playerid][Vip] == 1) { SendClientMessage(playerid, COLOR_VIP, "The LoF team thanks you greatly for donating. We hope you enjoy the benefits."); }
  2865. SendClientMessage(playerid, COLOR_WHITE, "[/help vip] - /v • /vipmenu");
  2866. return 1;
  2867. }
  2868. else if(strcmp(text, "skins",true) == 0)
  2869. {
  2870. SendClientMessage(playerid, COLOR_BLUE, "[________Skins Help_______]");
  2871. if(PInfo[playerid][OwnedSkin] > 0) { format(text,sizeof(text),"[/help skins] You currently own skin ID %d.", PInfo[playerid][OwnedSkin]); SendClientMessage(playerid, COLOR_WHITE, text); }
  2872. SendClientMessage(playerid, COLOR_WHITE, "[/help skins] - /buyskin • /previewskin • /sellskin");
  2873. return 1;
  2874. }
  2875. else if(strcmp(text,"vehicles",true) == 0)
  2876. {
  2877. SendClientMessage(playerid, COLOR_BLUE, "[______Vehicles Help________]");
  2878. SendClientMessage(playerid, COLOR_WHITE, "[/help vehicles] - /myvehicles • /parkvehicle • /colourvehicle • /respawnmyvehicles • /marketplace • /repair • /refuel");
  2879. SendClientMessage(playerid, COLOR_WHITE, "[/help vehicles] - /trunk • /hood • /headlights");
  2880. return 1;
  2881. }
  2882. else if(strcmp(text,"houses",true) == 0)
  2883. {
  2884. SendClientMessage(playerid, COLOR_BLUE, "[_______House Help___________]");
  2885. SendClientMessage(playerid, COLOR_WHITE, "[/help houses] - /buyhouse • /myhouses [Press ~k~~PED_SPRINT~ to enter/exit a house]");
  2886. return 1;
  2887. }
  2888. else if(strcmp(text,"account",true) == 0)
  2889. {
  2890. SendClientMessage(playerid, COLOR_BLUE, "[________Account Help________]");
  2891. SendClientMessage(playerid, COLOR_WHITE, "[/help account] - /changepass • /changecallsign • /changeemail");
  2892. return 1;
  2893. }
  2894. else if(strcmp(text,"airlines",true) == 0)
  2895. {
  2896. SendClientMessage(playerid, COLOR_BLUE, "[________Airlines Help________]");
  2897. SendClientMessage(playerid, COLOR_WHITE, "[/help airlines] - /uniform • /leaveairline • /invite • /yes • /no • /a • /myairline • /airlines • /parkfleet • /respawnfleet • /airlinespawn");
  2898. SendClientMessage(playerid, COLOR_WHITE, "[/help airlines] - /colourfleet");
  2899. return 1;
  2900. }
  2901. else if(strcmp(text,"class",true) == 0)
  2902. {
  2903. SendClientMessage(playerid, COLOR_BLUE, "[________Class Help________]");
  2904. if(gTeam[playerid] == TEAM_CPILOT) { SendClientMessage(playerid, COLOR_WHITE, "{008000}[Pilot] {FFFFFF}- /respawn • /reclass • (/w)ork • /cancel"); }
  2905. return 1;
  2906. }
  2907. else if(strcmp(text,"role",true) == 0)
  2908. {
  2909. SendClientMessage(playerid, COLOR_BLUE, "[________Role Help________]");
  2910. if(gTeam[playerid] == TEAM_MILITARY) { SendClientMessage(playerid, COLOR_WHITE, "{B2DD5D}[Military] {FFFFFF}- /respawn • /reclass • (/w)ork • /cancel"); }
  2911. return 1;
  2912. }
  2913. else if(strcmp(text,"chat",true) == 0)
  2914. {
  2915. SendClientMessage(playerid, COLOR_BLUE, "[________Chat Help________]");
  2916. SendClientMessage(playerid, COLOR_WHITE, "[/help chat] - /pm • /report • /afk • /afklist • /a • @ • /me • /l");
  2917. return 1;
  2918. }
  2919. else if(strcmp(text,"general",true) == 0)
  2920. {
  2921. SendClientMessage(playerid, COLOR_BLUE, "[________General Help________]");
  2922. SendClientMessage(playerid, COLOR_WHITE, "[/help general] - /stats • /rules • /help • /respawn • /reclass • /admins • /credits • /kill • /forums • (/w)ork • /cancel • /settings");
  2923. SendClientMessage(playerid, COLOR_WHITE, "[/help general] - /airlines • /givecash • /advertisement • /viplist • /donate • /at400 • /radio • /quickplay • /cancelradio • /tickets");
  2924. return 1;
  2925. }
  2926. else if(strcmp(text,"admin",true) == 0)
  2927. {
  2928. if(PInfo[playerid][AdminLevel] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !"); return 1; }
  2929. SendClientMessage(playerid, COLOR_BLUE, "[________Administrator Help________]");
  2930. if(PInfo[playerid][AdminLevel] >= 1) { SendClientMessage(playerid, COLOR_WHITE, "[Moderator] - /ac • /ban • /kick • /warn • /mute • /spec • /cc • /check • /adminroom • /respawnvehicles • /viewban"); }
  2931. if(PInfo[playerid][AdminLevel] >= 2) { SendClientMessage(playerid, COLOR_WHITE, "[Junior Admin] - /teletome • /teleto • /televeh • /teleintoveh • /healall • /announce • /owarn • /giveticket • /spymode"); }
  2932. if(PInfo[playerid][AdminLevel] >= 3) { SendClientMessage(playerid, COLOR_WHITE, "[Senior Admin] - /unban • /oban • /omute • /setname • /jetpack • /namechanges"); }
  2933. if(PInfo[playerid][AdminLevel] >= 4) { SendClientMessage(playerid, COLOR_WHITE, "[Head Admin] - /restartserver • /veh • /giveveh • /destroyvehicles • /refuelvehicles • /setmotd"); }
  2934. if(PInfo[playerid][AdminLevel] >= 5) { SendClientMessage(playerid, COLOR_WHITE, "[Server Owner] - /addvehicle • /updatevehicle • /deletevehicle • /deleteaccount • /makeadmin • /myvehicle • /reloadairline"); }
  2935. if(PInfo[playerid][AdminLevel] >= 5) { SendClientMessage(playerid, COLOR_WHITE, "[Server Owner] - /reloadhouse • /movehouse • /reloadhouses • /reloadvehicles • /addradiostation • /deleteradiostation • /reloadstuff"); }
  2936. if(PInfo[playerid][AdminLevel] >= 5) { SendClientMessage(playerid, COLOR_WHITE, "[Server Owner] - /addmapicon • /deletemapicon • /killplayer"); }
  2937. if(!strcmp(PlayerName(playerid), "Pacoz")) { SendClientMessage(playerid, COLOR_WHITE, "[Developer] - /crashplayer • /addplayervehicle • /createhouse • /deletehouse • /gimmeadmin • /deleteairline"); }
  2938. return 1;
  2939. }
  2940. }
  2941. if(strcmp(cmd, "/respawn", true) == 0)
  2942. {
  2943. RespawnPlayer(playerid);
  2944. return 1;
  2945. }
Add Comment
Please, Sign In to add comment