Guest User

Untitled

a guest
Nov 24th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 84.97 KB | None | 0 0
  1. // This gamemode is made WopsS and modify by KnowN
  2. // Bugs: Nu
  3.  
  4. #include <a_samp>
  5. #include <a_mysql>
  6. #include <accounts>
  7. #include <other>
  8. #include <zcmd> // Pentru a putea creea comenzile gen CMD:comandamea(playerid, params[])
  9. #include <sscanf2>
  10. #include <streamer> //Pentru a putea adauga mape pe server
  11.  
  12. // Gamemode
  13. #define gamemode_version "v0.2 Beta"
  14. #define gamemode_map "LS-LV-SF"
  15.  
  16. // MySQL
  17. forward WhenAccountCheck(playerid, password[]);
  18.  
  19. #define SERVER_HOST "localhost"
  20. #define SERVER_USER "root"
  21. #define SERVER_PASS ""
  22. #define SERVER_DB "w3op"
  23. //
  24.  
  25. // Colors
  26. #define COLOR_ADMIN_INFO 0x5CAD5CFF
  27. #define COLOR_ERROR 0x5CAD5CFF
  28. #define COLOR_FADE1 0xE6E6E6E6
  29. #define COLOR_FADE2 0xC8C8C8C8
  30. #define COLOR_FADE3 0xAAAAAAAA
  31. #define COLOR_FADE4 0x8C8C8C8C
  32. #define COLOR_FADE5 0x6E6E6E6E
  33. #define COLOR_GRAD 0xBFC0C2FF
  34. #define COLOR_GREEN 0x33AA33AA
  35. #define COLOR_YELLOW2 0xF5DEB3AA
  36. #define COLOR_YELLOW3 0xFFD633AA
  37. #define COLOR_SERVER_GREEN 0x21DD00FF
  38. #define COLOR_LIGHTBLUE 0x33CCFFAA
  39. #define COLOR_LIGHTRED 0xFF6347AA
  40. #define COLOR_LIGHTRED2 0xE63E3EFF
  41. #define COLOR_SYN 0xB8DBFFFF
  42. #define COLOR_SYN2 0xA9C4E4FF
  43. #define COLOR_WHITE 0xFFFFFFFF
  44. //
  45.  
  46. // Faction colors
  47. #define COLOR_LSPD 0x2641FEAA
  48. #define COLOR_LVPD 0x2641FEAA
  49. #define COLOR_SFPD 0x2641FEAA
  50. #define COLOR_FBI 0x2641FEAA
  51. #define COLOR_NG 0x1E519DAA
  52. #define COLOR_PARAMEDICS 0xFF6347AA
  53.  
  54. #define COLOR_FACTION_CHAT 0x01FCFFC8
  55. #define COLOR_RADIO_CHAT 0x8D8DFF00
  56. //
  57.  
  58. // Dialogs
  59. #define DIALOG_LOGIN 2
  60. #define DIALOG_REGISTER 1
  61. #define DIALOG_SEX 3
  62. #define DIALOG_AGE 4
  63. #define DIALOG_EMAIL 5
  64. #define DIALOG_REGISTER_FINISH 6
  65. //
  66.  
  67. // Login
  68. new gRegistred[MAX_PLAYERS];
  69. new gLogged[MAX_PLAYERS];
  70.  
  71. new RegistrationStep[MAX_PLAYERS];
  72.  
  73. forward OnPlayerRegister(playerid, password[]);
  74. forward OnPlayerLogin(playerid, password[]);
  75. forward WhenPlayerLogin(playerid);
  76. //
  77.  
  78. // Money
  79. #define ResetMoneyBar ResetPlayerMoney
  80. #define UpdateMoneyBar GivePlayerMoney
  81.  
  82. new Cash[MAX_PLAYERS];
  83. //
  84.  
  85. // Tutorial
  86. new TutorialTime[MAX_PLAYERS];
  87. //
  88.  
  89. // Clock
  90. new clockupdate;
  91.  
  92. new Text:ClockTime;
  93. new Text:ClockDate;
  94.  
  95. new pName2[MAX_PLAYER_NAME];
  96. new pNameGive[MAX_PLAYER_NAME];
  97. new Float:x, Float:y, Float:z;
  98.  
  99. forward ClockUpdate();
  100. //
  101.  
  102. // Admin & Helpers & Reports
  103. #define ADMIN_SPEC_TYPE_NONE 0
  104. #define ADMIN_SPEC_TYPE_PLAYER 1
  105. #define ADMIN_SPEC_TYPE_VEHICLE 2
  106.  
  107. new ReportTime[MAX_PLAYERS];
  108. new SpectateType[MAX_PLAYERS];
  109. new SpectatedID[MAX_PLAYERS];
  110. new MySQLConnecting;
  111.  
  112. forward AdminsBroadCast(color, string[]);
  113. forward HelpersBroadCast(color, string[]);
  114.  
  115. forward ReportTimer(playerid);
  116. //
  117.  
  118. // Faction
  119. forward SetPlayerFactionColor(playerid);
  120. forward FactionsBroadCast(faction, color, string[]);
  121. forward RadioBroadCast(faction, color, string[]);
  122. //
  123.  
  124. // Timers
  125. new othertimers;
  126. forward OtherTimers();
  127. //
  128.  
  129. //
  130.  
  131. forward KickPublic(playerid);
  132.  
  133. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  134.  
  135. forward MoneyTimer();
  136.  
  137. main()
  138. {
  139. printf(" ");
  140. printf(" ");
  141. printf(" RPG: %s %s", gamemode_version, gamemode_map);
  142. printf("_____________________");
  143. }
  144.  
  145. public OnGameModeInit()
  146. {
  147. // MySQL Connect (by KnowN)
  148. MySQLConnecting = mysql_connect( SERVER_HOST, SERVER_USER, SERVER_DB, SERVER_PASS, 3306, true, 2 );
  149.  
  150. print( "=======================================================" );
  151. print( "\t\t > MySQL System <" );
  152. print( "=======================================================" );
  153.  
  154. print ( "[MySQL] Conectare la ('"SERVER_HOST"') cu ('"SERVER_USER"') la baza de date ('"SERVER_DB"')." );
  155.  
  156. if( mysql_errno( MySQLConnecting ) != 0 )
  157. print ( "[MySQL] Conectarea la ('"SERVER_HOST"') a esuat !\n" );
  158.  
  159. else
  160. {
  161. print ( "[MySQL] Conectarea la ('"SERVER_HOST"') sa stabilit cu succes !" );
  162. print ( "[MySQL] Baza de date ('"SERVER_DB"') a fost selectata !\n" );
  163. }
  164.  
  165. mysql_log( LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML );
  166.  
  167. // Cars
  168. AddStaticVehicleEx (411, 1741.7678, -1852.7793, 13.4141, 267.4383, 0, 1, 60);
  169.  
  170. // Gamemode and Map text
  171. new string [500];
  172. SetGameModeText(#gamemode_version);
  173. format(string, sizeof(string), "mapname %s", gamemode_map);
  174. SendRconCommand(string);
  175.  
  176. // Timers
  177. SetTimer("MoneyTimer", 1000, true);
  178. othertimers = SetTimer("OtherTimers", 1000, true);
  179.  
  180. // Clock
  181. clockupdate = SetTimer("ClockUpdate", 1000, 1);
  182.  
  183. ClockTime = TextDrawCreate(548.000000,21.000000,"00:00");
  184. TextDrawAlignment(ClockTime,1);
  185. TextDrawFont(ClockTime,3);
  186. TextDrawUseBox(ClockTime, 0);
  187. TextDrawSetOutline(ClockTime,2);
  188. TextDrawColor(ClockTime,0xffffffff);
  189. TextDrawSetShadow(ClockTime,1);
  190. TextDrawLetterSize(ClockTime,0.589999,2.300000);
  191.  
  192. ClockDate = TextDrawCreate(535.000000,6.000000,"00/00/0000");
  193. TextDrawAlignment(ClockDate,1);
  194. TextDrawFont(ClockDate,1);
  195. TextDrawUseBox(ClockDate, 0);
  196. TextDrawSetOutline(ClockDate,1);
  197. TextDrawColor(ClockDate,0xffffffff);
  198. TextDrawSetShadow(ClockDate,1);
  199. TextDrawLetterSize(ClockDate,0.450000,1.400000);
  200. //
  201.  
  202. ShowPlayerMarkers(0);
  203. EnableStuntBonusForAll(0);
  204. UsePlayerPedAnims();
  205.  
  206. return 1;
  207. }
  208.  
  209. public OnGameModeExit()
  210. {
  211. KillTimer(othertimers);
  212. KillTimer(clockupdate);
  213. mysql_close();
  214. return 1;
  215. }
  216.  
  217. public OnPlayerRequestClass(playerid, classid)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnPlayerConnect(playerid)
  223. {
  224. gRegistred[playerid] = 0; gLogged[playerid] = 0;
  225. RegistrationStep[playerid] = 0; TutorialTime[playerid] = 0;
  226. ReportTime[playerid] = 0; SpectatedID[playerid] = 0;
  227.  
  228. PlayerInfo[playerid][pRegistred] = 0;
  229. PlayerInfo[playerid][pTutorial] = 0;
  230. PlayerInfo[playerid][pSex] = 0;
  231.  
  232. new pName[30];
  233. new query[256];
  234. GetPlayerName(playerid, pName, sizeof(pName));
  235. mysql_format(handle, query, sizeof(query), "SELECT * FROM `players` WHERE `username` = '%e'", pName);
  236. mysql_tquery(handle, query, "WhenAccountCheck", "i", playerid);
  237.  
  238. TogglePlayerSpectating(playerid, 0);
  239.  
  240. TextDrawShowForPlayer(playerid, ClockTime);
  241. TextDrawShowForPlayer(playerid, ClockDate);
  242.  
  243. SetPlayerColor(playerid, COLOR_GRAD);
  244.  
  245. return 1;
  246. }
  247.  
  248. public WhenAccountCheck(playerid, password[])
  249. {
  250. new pName[30];
  251. GetPlayerName(playerid, pName, sizeof(pName));
  252.  
  253. cache_get_data(rows, fields, handle);
  254.  
  255. if(rows)
  256. {
  257. gRegistred[playerid] = 1;
  258. }
  259. else
  260. {
  261. gRegistred[playerid] = 0;
  262. }
  263.  
  264. // Login or Register!
  265.  
  266. if(gLogged[playerid] == 0)
  267. {
  268. if(gRegistred[playerid] == 1)
  269. {
  270. if(rows)
  271. {
  272. new string[256];
  273. GetPlayerName(playerid, pName, sizeof(pName));
  274.  
  275. cache_get_field_content(0, "LastLogin", temp), strmid(PlayerInfo[playerid][pLastLogin], temp, 0, 255, 255);
  276.  
  277. format(string,sizeof(string),"{BECBFC}Welcome, {95A3FF}%s{BECBFC}!\n\nPlease enter your password below to login to your account.\n\n* {FFFFFF}Last login: %s *",pName, PlayerInfo[playerid][pLastLogin]);
  278. ShowPlayerDialog(playerid, DIALOG_LOGIN ,DIALOG_STYLE_PASSWORD,"Login",string,"Login","Exit");
  279. }
  280. }
  281. else
  282. {
  283. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Enter your password below:", "Register", "Cancel");
  284. }
  285. }
  286.  
  287. SetPlayerCameraPos(playerid, 1500.7156,-1778.1880,80.3080);
  288. SetPlayerCameraLookAt(playerid, 1500.7156,-1778.1880,80.3080);
  289. SetPlayerPos(playerid, 1437.6957,-2266.6355,13.5469);
  290.  
  291. return 1;
  292. }
  293.  
  294. public OnPlayerRegister(playerid, password[])
  295. {
  296. if(IsPlayerConnected(playerid))
  297. {
  298. new pName[30];
  299. new query[256];
  300. new string[256];
  301. GetPlayerName(playerid, pName, sizeof(pName));
  302.  
  303. mysql_format(handle, query, sizeof(query), "INSERT INTO `players` (`username`,`password`) VALUES ('%e', MD5('%e'))", pName, password);
  304. mysql_tquery(handle, query, "", "");
  305.  
  306. strmid(PlayerInfo[playerid][pPassword], password, 0, strlen(password), 255);
  307.  
  308. format(string, sizeof(string), "Please enter your password below to login to your account.", pName);
  309. ShowPlayerDialog(playerid, DIALOG_LOGIN ,DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Exit");
  310.  
  311. }
  312. return 1;
  313. }
  314.  
  315. public OnPlayerLogin(playerid, password[])
  316. {
  317. if(IsPlayerConnected(playerid))
  318. {
  319. new pName[30];
  320. new query[256];
  321. GetPlayerName(playerid, pName, sizeof(pName));
  322.  
  323. mysql_format(handle, query, sizeof(query), "SELECT * FROM `players` WHERE `username`='%e' AND `password`=MD5('%e')", pName, password);
  324. mysql_tquery(handle, query, "WhenPlayerLogin", "i", playerid);
  325.  
  326. }
  327.  
  328. TogglePlayerSpectating(playerid, 0);
  329.  
  330. return 1;
  331. }
  332.  
  333. public WhenPlayerLogin(playerid)
  334. {
  335. if(IsPlayerConnected(playerid))
  336. {
  337. new string[256];
  338. new pName[30];
  339. GetPlayerName(playerid, pName, sizeof(pName));
  340.  
  341. cache_get_data(rows, fields, handle);
  342.  
  343. if(rows != 0)
  344. {
  345. cache_get_field_content(0, "password", temp), format(PlayerInfo[playerid][pPassword], 128, temp);
  346. cache_get_field_content(0, "Level", temp), PlayerInfo[playerid][pLevel] = strval(temp);
  347. cache_get_field_content(0, "AdminLevel", temp), PlayerInfo[playerid][pAdmin] = strval(temp);
  348. cache_get_field_content(0, "HelperLevel", temp), PlayerInfo[playerid][pHelper] = strval(temp);
  349. cache_get_field_content(0, "Cash", temp), PlayerInfo[playerid][pCash] = strval(temp);
  350. cache_get_field_content(0, "Account", temp), PlayerInfo[playerid][pAccount] = strval(temp);
  351. cache_get_field_content(0, "Email", temp), format(PlayerInfo[playerid][pEmail], 256, temp);
  352. cache_get_field_content(0, "Registred", temp), PlayerInfo[playerid][pRegistred] = strval(temp);
  353. cache_get_field_content(0, "Tutorial", temp), PlayerInfo[playerid][pTutorial] = strval(temp);
  354. cache_get_field_content(0, "Sex", temp), PlayerInfo[playerid][pSex] = strval(temp);
  355. cache_get_field_content(0, "Age", temp), PlayerInfo[playerid][pAge] = strval(temp);
  356. cache_get_field_content(0, "PhoneNumber", temp), PlayerInfo[playerid][pPhoneNumber] = strval(temp);
  357. cache_get_field_content(0, "PremiumAccount", temp), PlayerInfo[playerid][pPremiumAccount] = strval(temp);
  358. cache_get_field_content(0, "Banned", temp), PlayerInfo[playerid][pBanned] = strval(temp);
  359. cache_get_field_content(0, "Warns", temp), PlayerInfo[playerid][pWarns] = strval(temp);
  360. cache_get_field_content(0, "Leader", temp), PlayerInfo[playerid][pLeader] = strval(temp);
  361. cache_get_field_content(0, "Member", temp), PlayerInfo[playerid][pMember] = strval(temp);
  362. cache_get_field_content(0, "Rank", temp), PlayerInfo[playerid][pRank] = strval(temp);
  363. cache_get_field_content(0, "Skin", temp), PlayerInfo[playerid][pSkin] = strval(temp);
  364. cache_get_field_content(0, "IP", temp), PlayerInfo[playerid][pIP] = strval(temp);
  365. }
  366. else
  367. {
  368. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "The passwords don't match!\nType your account's password below:", "Login", "Exit");
  369. return 1;
  370. }
  371.  
  372. if(PlayerInfo[playerid][pRegistred] == 0)
  373. {
  374. PlayerInfo[playerid][pLevel] = 1;
  375. Update(playerid, pLevelu);
  376.  
  377. PlayerInfo[playerid][pAdmin] = 0;
  378. Update(playerid, pAdminu);
  379.  
  380. GivePlayerCash(playerid, 150);
  381.  
  382. PlayerInfo[playerid][pAccount] = 500;
  383. Update(playerid, pAccountu);
  384.  
  385. PlayerInfo[playerid][pRegistred] = 1;
  386. Update(playerid, pRegistredu);
  387.  
  388. new randomphonenumber = 1000000 + random(9999999);
  389. PlayerInfo[playerid][pPhoneNumber] = randomphonenumber;
  390. Update(playerid, pPhoneNumberu);
  391.  
  392. PlayerInfo[playerid][pInterior] = 0;
  393. }
  394.  
  395. if(PlayerInfo[playerid][pBanned] == 1)
  396. {
  397. KickWithMessage(playerid, COLOR_LIGHTRED2, "Your account is currently banned.");
  398. KickWithMessage(playerid, COLOR_LIGHTRED2, "In case you think this is a confusion, request an unban at the forums.");
  399. }
  400.  
  401. GetPlayerCash(playerid);
  402.  
  403. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  404. SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
  405.  
  406. SetSpawnInfo(playerid, 0, 0, 1742.9515, -1862.3721, 13.5764, 359.5591, 0, 0, 0, 0, 0, 0);
  407. SpawnPlayer(playerid);
  408.  
  409. Update(playerid, pLastLoginu);
  410.  
  411. new pNameIP[256];
  412. GetPlayerIp(playerid, pNameIP, sizeof(pNameIP));
  413.  
  414. strmid(PlayerInfo[playerid][pIP], pNameIP, 0, 100, 255);
  415. Update(playerid, pIPu);
  416.  
  417.  
  418. if (PlayerInfo[playerid][pAdmin] >= 1)
  419. {
  420. format(string, sizeof(string), "You're logged in as a level %d admin.", PlayerInfo[playerid][pAdmin]);
  421. SendClientMessage(playerid, COLOR_YELLOW2, string);
  422. }
  423.  
  424. if (PlayerInfo[playerid][pHelper] >= 1)
  425. {
  426. format(string, sizeof(string), "You're logged in as a level %d helper.", PlayerInfo[playerid][pHelper]);
  427. SendClientMessage(playerid, COLOR_YELLOW2, string);
  428. }
  429.  
  430. if (PlayerInfo[playerid][pPremiumAccount] >= 1)
  431. {
  432. SendClientMessage(playerid, COLOR_WHITE,"You're a premium account user. ");
  433. }
  434.  
  435. printf("%s has logged in.", pName);
  436.  
  437. gLogged[playerid] = 1;
  438. }
  439.  
  440. return 1;
  441. }
  442.  
  443. public OnPlayerDisconnect(playerid, reason)
  444. {
  445. return 1;
  446. }
  447.  
  448. public OnPlayerSpawn(playerid)
  449. {
  450. if(IsPlayerConnected(playerid))
  451. {
  452. SetPlayerFactionColor(playerid);
  453. if(gLogged[playerid] == 0)
  454. {
  455. KickWithMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
  456. }
  457.  
  458. if(PlayerInfo[playerid][pSkin] > 0)
  459. {
  460. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  461. }
  462. else
  463. {
  464. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  465. }
  466.  
  467. if(PlayerInfo[playerid][pTutorial] == 0)
  468. {
  469. SetPlayerCameraPos(playerid, 1500.7156,-1778.1880,80.3080);
  470. SetPlayerCameraLookAt(playerid, 1500.7156,-1778.1880,80.3080);
  471. SetPlayerPos(playerid, 1437.6957,-2266.6355,13.5469);
  472.  
  473. ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "Character Gender", "Are you a male or a female?", "Male", "Female");
  474. }
  475.  
  476. if (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)// Los Santos Police Departament spawn
  477. {
  478. SetPlayerFactionColor(playerid);
  479.  
  480. PlayerInfo[playerid][pInterior] = 6;
  481. SetPlayerInterior(playerid, 6);
  482.  
  483. SetPlayerPos(playerid, 216.9725,79.1339,1005.0391);
  484. SetPlayerFacingAngle(playerid, 0);
  485. return 1;
  486. }
  487. if (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)// Las Venturas Police Departament spawn
  488. {
  489. SetPlayerFactionColor(playerid);
  490.  
  491. PlayerInfo[playerid][pInterior] = 3;
  492. SetPlayerInterior(playerid, 3);
  493.  
  494. SetPlayerPos(playerid, 297.3488,186.3873,1007.1719);
  495. SetPlayerFacingAngle(playerid, 0);
  496. return 1;
  497. }
  498. if (PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)// San Fierro Police Departament spawn
  499. {
  500. SetPlayerFactionColor(playerid);
  501.  
  502. PlayerInfo[playerid][pInterior] = 0;
  503. SetPlayerInterior(playerid, 0);
  504.  
  505. SetPlayerPos(playerid, -1606.3876,676.6782,-5.2422);
  506. SetPlayerFacingAngle(playerid, 0);
  507. return 1;
  508. }
  509. if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)// FBI spawn
  510. {
  511. SetPlayerFactionColor(playerid);
  512.  
  513. PlayerInfo[playerid][pInterior] = 10;
  514. SetPlayerInterior(playerid, 0);
  515.  
  516. SetPlayerPos(playerid, 246.375991,109.245994,1003.218750);
  517. SetPlayerFacingAngle(playerid, 90);
  518. return 1;
  519. }
  520. if (PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)// National Guard spawn
  521. {
  522. SetPlayerFactionColor(playerid);
  523.  
  524. PlayerInfo[playerid][pInterior] = 0;
  525. SetPlayerInterior(playerid, 0);
  526.  
  527. SetPlayerPos(playerid, 246.6305,1860.1299,14.0840);
  528. SetPlayerFacingAngle(playerid, 0);
  529. return 1;
  530. }
  531. if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)// Paramedics spawn
  532. {
  533. SetPlayerFactionColor(playerid);
  534.  
  535. PlayerInfo[playerid][pInterior] = 0;
  536. SetPlayerInterior(playerid, 0);
  537.  
  538. SetPlayerPos(playerid, 1607.1846,1818.9738,10.8203);
  539. SetPlayerFacingAngle(playerid, 0);
  540. return 1;
  541. }
  542. }
  543. return 1;
  544. }
  545.  
  546. public OnPlayerDeath(playerid, killerid, reason)
  547. {
  548. return 1;
  549. }
  550.  
  551. public OnVehicleSpawn(vehicleid)
  552. {
  553. return 1;
  554. }
  555.  
  556. public OnVehicleDeath(vehicleid, killerid)
  557. {
  558. return 1;
  559. }
  560.  
  561. public OnPlayerText(playerid, text[])
  562. {
  563. new pName[MAX_PLAYER_NAME];
  564. new string[256];
  565. GetPlayerName(playerid, pName, sizeof(pName));
  566.  
  567. format(string, sizeof(string), "%s says: %s", pName, text);
  568. ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
  569. return 0;
  570. }
  571.  
  572. public OnPlayerCommandText(playerid, cmdtext[])
  573. {
  574. return SendClientMessage(playerid, COLOR_YELLOW2, "Error: Unknown command");
  575. }
  576.  
  577. // General Commands
  578. CMD:help( playerid, params[] )
  579. {
  580. if(IsPlayerConnected(playerid))
  581. {
  582. if(gLogged[playerid] == 1)
  583. {
  584. SendClientMessage(playerid, COLOR_WHITE, "*** ACCOUNT *** /stats");
  585. SendClientMessage(playerid, COLOR_WHITE, "*** CHAT *** -");
  586. SendClientMessage(playerid, COLOR_WHITE, "*** GENERAL *** /report /helpme");
  587. }
  588. else
  589. {
  590. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  591. }
  592. }
  593. return 1;
  594. }
  595.  
  596. CMD:stats( playerid, params[] )
  597. {
  598. new targetid;
  599. if(IsPlayerConnected(playerid))
  600. {
  601. GetPlayerName(playerid, pName2, sizeof(pName2));
  602.  
  603. if(gLogged[playerid] == 1)
  604. {
  605. ShowStats(playerid, targetid);
  606. }
  607. else
  608. {
  609. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  610. }
  611. }
  612. return 1;
  613. }
  614.  
  615. CMD:report( playerid, params[] )
  616. {
  617. new idx, string[256], cmdtext[2048];
  618. if(IsPlayerConnected(playerid))
  619. {
  620. if(gLogged[playerid] == 1)
  621. {
  622. GetPlayerName(playerid, pName2, sizeof(pName2));
  623.  
  624. new length = strlen(cmdtext);
  625.  
  626. while ((idx < length) && (cmdtext[idx] <= ' '))
  627. {
  628. idx++;
  629. }
  630.  
  631. new offset = idx;
  632. new result[128];
  633.  
  634. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  635. {
  636. result[idx - offset] = cmdtext[idx];
  637. idx++;
  638. }
  639.  
  640. //result[idx - offset] = EOS;
  641.  
  642. if(!strlen(result))
  643. {
  644. SendClientMessage(playerid, COLOR_SYN, "Synthax: /report <text>");
  645. return 1;
  646. }
  647.  
  648. if(ReportTime[playerid] == 0)
  649. {
  650. format(string, sizeof(string), "Report from %s (ID:%d): %s", pName2, playerid, result);
  651. AdminsBroadCast(COLOR_LIGHTRED2, string);
  652.  
  653. SendClientMessage(playerid, COLOR_YELLOW2, "Your report got sent to the administrator!");
  654.  
  655. ReportTime[playerid] = 10;
  656. SetTimerEx("ReportTimer", 10000, false, "i", playerid);
  657. }
  658.  
  659. else
  660. {
  661. format(string, sizeof(string), "You need to wait %d seconds before send another report.", ReportTime[playerid]);
  662. SendClientMessage(playerid, COLOR_YELLOW2, string);
  663. }
  664. }
  665. else
  666. {
  667. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  668. }
  669. }
  670. return 1;
  671. }
  672.  
  673. CMD:helpme( playerid, params[] )
  674. {
  675. new idx, string[256], cmdtext[2048];
  676. if(IsPlayerConnected(playerid))
  677. {
  678. if(gLogged[playerid] == 1)
  679. {
  680. GetPlayerName(playerid, pName2, sizeof(pName2));
  681.  
  682. new length = strlen(cmdtext);
  683.  
  684. while ((idx < length) && (cmdtext[idx] <= ' '))
  685. {
  686. idx++;
  687. }
  688.  
  689. new offset = idx;
  690. new result[128];
  691.  
  692. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  693. {
  694. result[idx - offset] = cmdtext[idx];
  695. idx++;
  696. }
  697.  
  698. result[idx - offset] = EOS;
  699.  
  700. if(!strlen(result))
  701. {
  702. SendClientMessage(playerid, COLOR_SYN, "Synthax: /helpme <text>");
  703. return 1;
  704. }
  705.  
  706. if(ReportTime[playerid] == 0)
  707. {
  708. format(string, sizeof(string), "Report from %s (ID:%d): %s", pName2, playerid, result);
  709. AdminsBroadCast(COLOR_LIGHTRED2, string);
  710.  
  711. SendClientMessage(playerid, COLOR_YELLOW2, "Your help request got sent to the helpers!");
  712.  
  713. ReportTime[playerid] = 10;
  714. SetTimerEx("ReportTimer", 10000, false, "i", playerid);
  715. }
  716.  
  717. else
  718. {
  719. format(string, sizeof(string), "You need to wait %d seconds before request another help.", ReportTime[playerid]);
  720. SendClientMessage(playerid, COLOR_YELLOW2, string);
  721. }
  722. }
  723. else
  724. {
  725. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  726. }
  727. }
  728. return 1;
  729. }
  730.  
  731. //
  732. // Admin Commands
  733. CMD:ah( playerid, params[] )
  734. {
  735. if(IsPlayerConnected(playerid))
  736. {
  737. if(gLogged[playerid] == 1)
  738. {
  739. if(PlayerInfo[playerid][pAdmin] >= 1)
  740. {
  741. SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
  742. if(PlayerInfo[playerid][pAdmin] >= 1)
  743. {
  744. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 1 ** (/ah)dminhelp (/a)dmin /goto /gethere /respawn /ban /kick (/checkw)eapons /check /spec (/rcon)");
  745. }
  746. if(PlayerInfo[playerid][pAdmin] >= 2)
  747. {
  748. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 2 ** (/bano)ffline**");
  749. }
  750. if(PlayerInfo[playerid][pAdmin] >= 3)
  751. {
  752. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 3 **");
  753. }
  754. if(PlayerInfo[playerid][pAdmin] >= 4)
  755. {
  756. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 4 **");
  757. }
  758. if(PlayerInfo[playerid][pAdmin] >= 5)
  759. {
  760. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 5 **");
  761. }
  762. if(PlayerInfo[playerid][pAdmin] >= 6)
  763. {
  764. SendClientMessage(playerid, COLOR_WHITE, "** Admin level 6 ** /makeadmin /makehelper /makeleader /auninvite");
  765. }
  766. SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
  767. }
  768.  
  769. else if(PlayerInfo[playerid][pAdmin] < 1)
  770. {
  771. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  772. }
  773. }
  774. else
  775. {
  776. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  777. }
  778. }
  779. return 1;
  780. }
  781.  
  782. CMD:a( playerid, params[] )
  783. {
  784. new idx, string[256], cmdtext[2048];
  785. if(IsPlayerConnected(playerid))
  786. {
  787. if(gLogged[playerid] == 1)
  788. {
  789. GetPlayerName(playerid, pName2, sizeof(pName2));
  790.  
  791. new length = strlen(cmdtext);
  792.  
  793. while ((idx < length) && (cmdtext[idx] <= ' '))
  794. {
  795. idx++;
  796. }
  797.  
  798. new offset = idx;
  799. new result[128];
  800.  
  801. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  802. {
  803. result[idx - offset] = cmdtext[idx];
  804. idx++;
  805. }
  806.  
  807. result[idx - offset] = EOS;
  808.  
  809. if(!strlen(result))
  810. {
  811. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/a)dminchat <text>");
  812. return 1;
  813. }
  814.  
  815. if (PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 5)
  816. {
  817. format(string, sizeof(string), "** Admin Level %d %s : %s **", PlayerInfo[playerid][pAdmin], pName2, result);
  818. AdminsBroadCast(COLOR_YELLOW2, string);
  819. }
  820.  
  821. if (PlayerInfo[playerid][pAdmin] == 6)
  822. {
  823. format(string, sizeof(string), "{CFAE70}** Admin Level %d %s : %s **", PlayerInfo[playerid][pAdmin], pName2, result);
  824. AdminsBroadCast(COLOR_WHITE, string);
  825. }
  826.  
  827. if (PlayerInfo[playerid][pAdmin] < 1)
  828. {
  829. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  830. return 1;
  831. }
  832. }
  833. else
  834. {
  835. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  836. }
  837. }
  838. return 1;
  839. }
  840.  
  841. CMD:ban( playerid, params[] )
  842. {
  843. new idx, string[256], cmdtext[2048], targetid;
  844. if(IsPlayerConnected(playerid))
  845. {
  846. if(gLogged[playerid] == 1)
  847. {
  848. GetPlayerName(playerid, pName2, sizeof(pName2));
  849.  
  850. temp = strtok(cmdtext, idx);
  851.  
  852. if(!strlen(temp))
  853. {
  854. SendClientMessage(playerid, COLOR_SYN, "Synthax: /ban <playerid/PartOfName> <reason>");
  855. return 1;
  856. }
  857.  
  858. targetid = ReturnUser(temp);
  859.  
  860. if (PlayerInfo[playerid][pAdmin] >= 1)
  861. {
  862. if(IsPlayerConnected(targetid))
  863. {
  864. if(targetid != INVALID_PLAYER_ID)
  865. {
  866. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  867.  
  868. new length = strlen(cmdtext);
  869.  
  870. while ((idx < length) && (cmdtext[idx] <= ' '))
  871. {
  872. idx++;
  873. }
  874.  
  875. new offset = idx;
  876. new result[128];
  877.  
  878. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  879. {
  880. result[idx - offset] = cmdtext[idx];
  881. idx++;
  882. }
  883.  
  884. result[idx - offset] = EOS;
  885.  
  886. if(!strlen(result))
  887. {
  888. SendClientMessage(playerid, COLOR_SYN, "Synthax: /ban <playerid/PartOfName> <reason>");
  889. return 1;
  890. }
  891.  
  892. if(PlayerInfo[targetid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 6)
  893. {
  894. SendClientMessage(playerid, COLOR_ERROR, "AdmWarning: You can't ban admins!");
  895. format(string, sizeof(string), "AdmCmd: %s tried to ban admin %s with the reason: %s", pName2, pNameGive, (result));
  896. AdminsBroadCast(COLOR_LIGHTRED, string);
  897. return 1;
  898. }
  899.  
  900. format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", pNameGive, pName2, (result));
  901. SendClientMessageToAll(COLOR_LIGHTRED, string);
  902. PlayerInfo[targetid][pBanned] = 1;
  903. Update(targetid, pBannedu);
  904.  
  905. new pGiveIP[256];
  906. GetPlayerIp(targetid, pGiveIP, sizeof(pGiveIP));
  907. strmid(PlayerInfo[targetid][pIP], pGiveIP, 0, 100, 255);
  908. Update(targetid, pIPu);
  909.  
  910. new query[512];
  911. mysql_format(handle, query, sizeof(query) ,"INSERT INTO `banslogs` (`ID`,`username`,`IP`,`Admin`,`Reason`,`Type`,`Date`,`Time`) VALUES ('','%e','%e','%e','%e','%e',CURRENT_TIMESTAMP,'%d')",
  912. pNameGive, PlayerInfo[targetid][pIP], pName2, result, "Online", 0);
  913. mysql_query(handle, query);
  914.  
  915. Kick(targetid);
  916. return 1;
  917. }
  918. }
  919. else
  920. {
  921. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  922. }
  923. }
  924. else
  925. {
  926. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  927. }
  928. }
  929. else
  930. {
  931. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  932. }
  933. }
  934. return 1;
  935. }
  936.  
  937. CMD:bano( playerid, params[] )
  938. {
  939. new idx, string[256], cmdtext[2048], targetid;
  940. if(IsPlayerConnected(playerid))
  941. {
  942. if(gLogged[playerid] == 1)
  943. {
  944. cache_get_data(rows, fields, handle);
  945.  
  946. new query[512];
  947. mysql_format(handle, query, sizeof(query), "SELECT `username` FROM `players` WHERE `username` = '%e' AND `Banned` = '0' LIMIT 0", temp);
  948. mysql_query(handle, query);
  949.  
  950. GetPlayerName(playerid, pName2, sizeof(pName2));
  951.  
  952. temp = strtok(cmdtext, idx);
  953.  
  954. if(!strlen(temp))
  955. {
  956. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/bano)ffline <playername> <reason>");
  957. return 1;
  958. }
  959.  
  960. if (PlayerInfo[playerid][pAdmin] >= 2)
  961. {
  962. if(!rows)
  963. {
  964. format(string, sizeof(string), "Error: Nobody with the name %s is registered or this player is alredy banned.");
  965. return SendClientMessage(playerid, COLOR_ERROR, string);
  966. }
  967.  
  968. else if(rows)
  969. {
  970. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  971.  
  972. new length = strlen(cmdtext);
  973.  
  974. while ((idx < length) && (cmdtext[idx] <= ' '))
  975. {
  976. idx++;
  977. }
  978.  
  979. new offset = idx;
  980. new result[128];
  981.  
  982. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  983. {
  984. result[idx - offset] = cmdtext[idx];
  985. idx++;
  986. }
  987.  
  988. result[idx - offset] = EOS;
  989.  
  990. if(!strlen(result))
  991. {
  992. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/bano)ffline <playername> <reason>");
  993. return 1;
  994. }
  995.  
  996. if(PlayerInfo[targetid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 6)
  997. {
  998. SendClientMessage(playerid, COLOR_ERROR, "AdmWarning: You can't ban admins!");
  999. format(string, sizeof(string), "AdmCmd: %s tried to ban admin %s with the reason: %s", pName2, pNameGive, (result));
  1000. AdminsBroadCast(COLOR_LIGHTRED, string);
  1001. return 1;
  1002. }
  1003.  
  1004. format(string, sizeof(string), "AdmCmd: %s was banned offline by %s, reason: %s", temp, pName2, (result));
  1005. SendClientMessageToAll(COLOR_LIGHTRED, string);
  1006.  
  1007. mysql_format(handle, query, sizeof(query), "UPDATE `players` SET `Banned` = '1' WHERE username = '%e'", temp);
  1008. mysql_query(handle, query);
  1009.  
  1010. mysql_format(handle, query, sizeof(query) ,"INSERT INTO `banslogs` (`ID`,`username`,`IP`,`Admin`,`Reason`,`Type`,`Date`,`Time`) VALUES ('','%e','%e','%e','%e','%e',CURRENT_TIMESTAMP,'%d')",
  1011. temp, PlayerInfo[targetid][pIP], pName2, result, "Offline", 0);
  1012. mysql_query(handle, query);
  1013.  
  1014. new pGiveIP[256];
  1015. GetPlayerIp(targetid, pGiveIP, sizeof(pGiveIP));
  1016. strmid(PlayerInfo[targetid][pIP], pGiveIP, 0, 100, 255);
  1017.  
  1018. return 1;
  1019. }
  1020. }
  1021. else
  1022. {
  1023. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1024. }
  1025. }
  1026. else
  1027. {
  1028. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1029. }
  1030. }
  1031. return 1;
  1032. }
  1033.  
  1034. CMD:kick( playerid, params[] )
  1035. {
  1036. new idx, string[256], cmdtext[2048], targetid;
  1037. if(IsPlayerConnected(playerid))
  1038. {
  1039. if(gLogged[playerid] == 1)
  1040. {
  1041. temp = strtok(cmdtext, idx);
  1042. if(!strlen(temp))
  1043. {
  1044. SendClientMessage(playerid, COLOR_SYN, "Synthax: /kick <playerid/PartOfName> <reason>");
  1045. return 1;
  1046. }
  1047. targetid = ReturnUser(temp);
  1048. if (PlayerInfo[playerid][pAdmin] >= 1)
  1049. {
  1050. if(IsPlayerConnected(targetid))
  1051. {
  1052. if(targetid != INVALID_PLAYER_ID)
  1053. {
  1054. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1055. GetPlayerName(playerid, pName2, sizeof(pName2));
  1056. new length = strlen(cmdtext);
  1057. while ((idx < length) && (cmdtext[idx] <= ' '))
  1058. {
  1059. idx++;
  1060. }
  1061. new offset = idx;
  1062. new result[128];
  1063. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1064. {
  1065. result[idx - offset] = cmdtext[idx];
  1066. idx++;
  1067. }
  1068. result[idx - offset] = EOS;
  1069. if(!strlen(result))
  1070. {
  1071. SendClientMessage(playerid, COLOR_SYN, "Synthax: /kick <playerid/PartOfName> <reason>");
  1072. return 1;
  1073. }
  1074. if (PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
  1075. {
  1076. SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot kick an administrator higher than your level.");
  1077. return 1;
  1078. }
  1079.  
  1080. format(string, sizeof(string), "AdmCmd: %s got kicked by %s, reason: %s", pNameGive, pName2, (result));
  1081. SendClientMessageToAll(COLOR_LIGHTRED, string);
  1082.  
  1083. new query[512];
  1084. mysql_format(handle, query, sizeof(query) ,"INSERT INTO `kickslogs` (`ID`,`username`,`IP`,`Admin`,`Reason`,`Date`) VALUES ('','%e','%e','%e','%e',CURRENT_TIMESTAMP)",
  1085. pNameGive, PlayerInfo[targetid][pIP], pName2, result);
  1086. mysql_query(handle, query);
  1087.  
  1088. Kick(targetid);
  1089. return 1;
  1090. }
  1091. }
  1092. else
  1093. {
  1094. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1095. }
  1096. }
  1097. else
  1098. {
  1099. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1100. }
  1101. }
  1102. else
  1103. {
  1104. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1105. }
  1106. }
  1107. return 1;
  1108. }
  1109.  
  1110. CMD:makeadmin( playerid, params[] )
  1111. {
  1112. new idx, string[256], cmdtext[2048], targetid;
  1113. if(IsPlayerConnected(playerid))
  1114. {
  1115. if(gLogged[playerid] == 1)
  1116. {
  1117. temp = strtok(cmdtext, idx);
  1118.  
  1119. if(!strlen(temp))
  1120. {
  1121. SendClientMessage(playerid, COLOR_SYN, "Synthax: /makeadmin <playerid/PartOfName> <admin level (1-6)>");
  1122. return 1;
  1123. }
  1124. new adminlevel;
  1125.  
  1126. targetid = ReturnUser(temp);
  1127. temp = strtok(cmdtext, idx);
  1128. adminlevel = strval(temp);
  1129.  
  1130. GetPlayerName(targetid, pName2, sizeof(pName2));
  1131. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1132.  
  1133. if(adminlevel >= 0 && adminlevel <= 6) {} else return 1;
  1134.  
  1135. if (PlayerInfo[playerid][pAdmin] == 6 || IsPlayerAdmin(playerid))
  1136. {
  1137. if(IsPlayerConnected(targetid))
  1138. {
  1139. if(targetid != INVALID_PLAYER_ID)
  1140. {
  1141. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1142.  
  1143. PlayerInfo[targetid][pAdmin] = adminlevel;
  1144. Update(targetid, pAdminu);
  1145.  
  1146. printf("AdmCmd: %s has promoted %s to a level %d admin.", pName2, pNameGive, adminlevel);
  1147.  
  1148. format(string, sizeof(string), "You have been promoted to a level %d admin by %s", adminlevel, pName2);
  1149. SendClientMessage(targetid, COLOR_LIGHTRED2, string);
  1150.  
  1151. format(string, sizeof(string), "You have promoted %s to a level %d admin.", pNameGive, adminlevel);
  1152. SendClientMessage(playerid, COLOR_LIGHTRED2, string);
  1153. }
  1154. }
  1155. else
  1156. {
  1157. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1158. }
  1159. }
  1160.  
  1161. else
  1162. {
  1163. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1164. }
  1165. }
  1166. else
  1167. {
  1168. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1169. }
  1170. }
  1171. return 1;
  1172. }
  1173.  
  1174. CMD:makehelper( playerid, params[] )
  1175. {
  1176. new idx, string[256], cmdtext[2048], targetid;
  1177. if(IsPlayerConnected(playerid))
  1178. {
  1179. if(gLogged[playerid] == 1)
  1180. {
  1181. temp = strtok(cmdtext, idx);
  1182.  
  1183. if(!strlen(temp))
  1184. {
  1185. SendClientMessage(playerid, COLOR_SYN, "Synthax: /makehelper <playerid/PartOfName> <helper level (1-6) >");
  1186. return 1;
  1187. }
  1188. new helperlevel;
  1189.  
  1190. targetid = ReturnUser(temp);
  1191. temp = strtok(cmdtext, idx);
  1192. helperlevel = strval(temp);
  1193.  
  1194. if(helperlevel >= 0 && helperlevel <= 6) {} else return 1;
  1195.  
  1196. if (PlayerInfo[playerid][pAdmin] == 6 || IsPlayerAdmin(playerid))
  1197. {
  1198. if(IsPlayerConnected(targetid))
  1199. {
  1200. if(targetid != INVALID_PLAYER_ID)
  1201. {
  1202. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1203.  
  1204. PlayerInfo[targetid][pHelper] = helperlevel;
  1205. Update(targetid, pHelperu);
  1206.  
  1207. printf("AdmCmd: %s has promoted %s to a level %d admin.", pName2, pNameGive, helperlevel);
  1208.  
  1209. format(string, sizeof(string), "You have been promoted to a level %d helper by %s", helperlevel, pName2);
  1210. SendClientMessage(targetid, COLOR_LIGHTRED2, string);
  1211.  
  1212. format(string, sizeof(string), "You have promoted %s to a level %d helper.", pNameGive, helperlevel);
  1213. SendClientMessage(playerid, COLOR_LIGHTRED2, string);
  1214. }
  1215. }
  1216. else
  1217. {
  1218. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1219. }
  1220. }
  1221. else
  1222. {
  1223. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1224. }
  1225. }
  1226. else
  1227. {
  1228. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1229. }
  1230. }
  1231. return 1;
  1232. }
  1233.  
  1234. CMD:makeleader( playerid, params[] )
  1235. {
  1236. new idx, string[256], cmdtext[2048], targetid;
  1237. if(IsPlayerConnected(playerid))
  1238. {
  1239. if(gLogged[playerid] == 1)
  1240. {
  1241. temp = strtok(cmdtext, idx);
  1242.  
  1243. if(!strlen(temp))
  1244. {
  1245. SendClientMessage(playerid, COLOR_SYN, "Synthax: /makeleader <playerid/PartOfName> <Faction Number (1-6) >");
  1246. return 1;
  1247. }
  1248.  
  1249. new factionid;
  1250.  
  1251. targetid = ReturnUser(temp);
  1252. temp = strtok(cmdtext, idx);
  1253. factionid = strval(temp);
  1254.  
  1255. if(factionid < 1 || factionid > 6)
  1256. {
  1257. SendClientMessage(playerid, COLOR_ERROR, "Faction ID can't be lower than 1 or bigger than 6!");
  1258. return 1;
  1259.  
  1260. }
  1261.  
  1262. if (PlayerInfo[playerid][pAdmin] == 6)
  1263. {
  1264. if(IsPlayerConnected(targetid))
  1265. {
  1266. if(targetid != INVALID_PLAYER_ID)
  1267. {
  1268. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1269.  
  1270. PlayerInfo[targetid][pLeader] = factionid;
  1271. PlayerInfo[targetid][pMember] = factionid;
  1272.  
  1273. Update(targetid, pLeaderu);
  1274. Update(targetid, pMemberu);
  1275.  
  1276. format(string, sizeof(string), "You got promoted to the rank of a faction leader by %s", pName2);
  1277. SendClientMessage(targetid, COLOR_LIGHTRED2, string);
  1278.  
  1279. format(string, sizeof(string), "%s is now the leader of faction id %d.", pNameGive, factionid);
  1280. SendClientMessage(playerid, COLOR_LIGHTRED2, string);
  1281.  
  1282. if(factionid == 1)
  1283. {
  1284. PlayerInfo[targetid][pSkin] = 265;
  1285. PlayerInfo[targetid][pRank] = 6;
  1286.  
  1287. PlayerInfo[targetid][pRank] = 6;
  1288. Update(targetid, pRanku);
  1289.  
  1290. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1291. Update(targetid, pSkinu); return 1;
  1292. }
  1293. else if(factionid == 2)
  1294. {
  1295. PlayerInfo[targetid][pSkin] = 265;
  1296. PlayerInfo[targetid][pRank] = 6;
  1297.  
  1298. PlayerInfo[targetid][pRank] = 6;
  1299. Update(targetid, pRanku);
  1300.  
  1301. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1302. Update(targetid, pSkinu);
  1303. }
  1304. else if(factionid == 3)
  1305. {
  1306. PlayerInfo[targetid][pSkin] = 265;
  1307. PlayerInfo[targetid][pRank] = 6;
  1308.  
  1309. PlayerInfo[targetid][pRank] = 6;
  1310. Update(targetid, pRanku);
  1311.  
  1312. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1313. Update(targetid, pSkinu);
  1314. }
  1315. else if(factionid == 4)
  1316. {
  1317. PlayerInfo[targetid][pSkin] = 295;
  1318. PlayerInfo[targetid][pRank] = 6;
  1319.  
  1320. PlayerInfo[targetid][pRank] = 6;
  1321. Update(targetid, pRanku);
  1322.  
  1323. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1324. Update(targetid, pSkinu);
  1325. }
  1326. else if(factionid == 5)
  1327. {
  1328. PlayerInfo[targetid][pSkin] = 287;
  1329. PlayerInfo[targetid][pRank] = 6;
  1330.  
  1331. PlayerInfo[targetid][pRank] = 6;
  1332. Update(targetid, pRanku);
  1333.  
  1334. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1335. Update(targetid, pSkinu);
  1336. }
  1337. else if(factionid == 6)
  1338. {
  1339. PlayerInfo[targetid][pSkin] = 228;
  1340. PlayerInfo[targetid][pRank] = 6;
  1341.  
  1342. PlayerInfo[targetid][pRank] = 6;
  1343. Update(targetid, pRanku);
  1344.  
  1345. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1346. Update(targetid, pSkinu);
  1347. }
  1348. }
  1349. }
  1350. else
  1351. {
  1352. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1353. }
  1354. }
  1355. else
  1356. {
  1357. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1358. }
  1359. }
  1360. else
  1361. {
  1362. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1363. }
  1364. }
  1365. return 1;
  1366. }
  1367.  
  1368. CMD:auninvite( playerid, params[] )
  1369. {
  1370. new idx, string[256], cmdtext[2048], targetid;
  1371. if(IsPlayerConnected(playerid))
  1372. {
  1373. if(gLogged[playerid] == 1)
  1374. {
  1375. temp = strtok(cmdtext, idx);
  1376. targetid = ReturnUser(temp);
  1377.  
  1378. if(!strlen(temp))
  1379. {
  1380. SendClientMessage(playerid, COLOR_SYN, "Synthax: /auninvite <playerid/PartOfName>");
  1381. return 1;
  1382. }
  1383.  
  1384. if (PlayerInfo[playerid][pAdmin] == 6)
  1385. {
  1386. if(IsPlayerConnected(targetid))
  1387. {
  1388. if(targetid != INVALID_PLAYER_ID)
  1389. {
  1390. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1391.  
  1392. format(string, sizeof(string), "* You were FactionPKed by Admin %s, you are kicked out of your faction.", pName2);
  1393. SendClientMessage(targetid, COLOR_LIGHTRED, string);
  1394.  
  1395. SendClientMessage(targetid, COLOR_LIGHTBLUE, "* You're a civilian now.");
  1396.  
  1397. PlayerInfo[targetid][pLeader] = 0;
  1398. Update(targetid, pLeaderu);
  1399.  
  1400. PlayerInfo[targetid][pMember] = 0;
  1401. Update(targetid, pMemberu);
  1402.  
  1403. PlayerInfo[targetid][pRank] = 0;
  1404. Update(targetid, pRanku);
  1405.  
  1406. PlayerInfo[targetid][pSkin] = 250;
  1407. SetPlayerSkin(targetid, PlayerInfo[targetid][pSkin]);
  1408. Update(targetid, pSkinu);
  1409.  
  1410. SetPlayerFactionColor(playerid);
  1411.  
  1412. SetSpawnInfo(playerid, 0, 0, 1742.9515, -1862.3721, 13.5764, 359.5591, 0, 0, 0, 0, 0, 0);
  1413. SetPlayerInterior(playerid, 0);
  1414. SpawnPlayer(targetid);
  1415. }
  1416. }
  1417. else
  1418. {
  1419. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1420. }
  1421. }
  1422. else
  1423. {
  1424. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1425. }
  1426. }
  1427. else
  1428. {
  1429. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1430. }
  1431. }
  1432. return 1;
  1433. }
  1434.  
  1435. CMD:respawn( playerid, params[] )
  1436. {
  1437. new idx, string[256], cmdtext[2048], targetid;
  1438. if(IsPlayerConnected(playerid))
  1439. {
  1440. if(gLogged[playerid] == 1)
  1441. {
  1442. temp = strtok(cmdtext, idx);
  1443.  
  1444. if(!strlen(temp))
  1445. {
  1446. SendClientMessage(playerid, COLOR_SYN, "Synthax: /respawn <playerid/PartOfName>");
  1447. return 1;
  1448. }
  1449.  
  1450. targetid = ReturnUser(temp);
  1451.  
  1452. if(PlayerInfo[playerid][pAdmin] >= 1)
  1453. {
  1454. if(IsPlayerConnected(targetid))
  1455. {
  1456. GetPlayerName(playerid, pName2, sizeof(pName2));
  1457. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1458.  
  1459. if(targetid != INVALID_PLAYER_ID)
  1460. {
  1461. format(string, sizeof(string), "AdmWarning: %s respawned %s.", pName2, pNameGive);
  1462. AdminsBroadCast(COLOR_LIGHTRED, string);
  1463.  
  1464. format(string, sizeof(string), "AdmCmd: %s respawned you.", pName2);
  1465. SendClientMessage(targetid, COLOR_LIGHTRED, string);
  1466.  
  1467. SetPlayerInterior(playerid, 0);
  1468. SpawnPlayer(targetid);
  1469. }
  1470. }
  1471. else
  1472. {
  1473. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1474. }
  1475. }
  1476. else
  1477. {
  1478. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1479. }
  1480. }
  1481. else
  1482. {
  1483. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1484. }
  1485. }
  1486. return 1;
  1487. }
  1488.  
  1489. CMD:checkweapons( playerid, params[] )
  1490. {
  1491. new idx, string[256], cmdtext[2048], targetid;
  1492. if(IsPlayerConnected(playerid))
  1493. {
  1494. if(gLogged[playerid] == 1)
  1495. {
  1496. if (PlayerInfo[playerid][pAdmin] < 1)
  1497. {
  1498. SendClientMessage(playerid, COLOR_ERROR, "You are not authorized");
  1499. return 1;
  1500. }
  1501. temp = strtok(cmdtext,idx);
  1502. if (!strlen(temp))
  1503. {
  1504. SendClientMessage(playerid, COLOR_SYN, "Synthax: /checkweapons <playerid/partOfName>");
  1505. return 1;
  1506. }
  1507. targetid = ReturnUser(temp);
  1508. if (targetid == INVALID_PLAYER_ID)
  1509. {
  1510. SendClientMessage(playerid, COLOR_ERROR, "That player is offline");
  1511. return 1;
  1512. }
  1513. new weaponsmodel, ammunition;
  1514.  
  1515. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1516.  
  1517. format(string, sizeof(string), "%s has the following weapons:", pNameGive);
  1518. SendClientMessage(playerid, COLOR_ADMIN_INFO, string);
  1519.  
  1520. for (new i=0; i<9; i++)
  1521. {
  1522. GetPlayerWeaponData(targetid, i, weaponsmodel, ammunition);
  1523. if(weaponsmodel != 0)
  1524. {
  1525. format(string, sizeof(string), "%d: %d (%d)", i, weaponsmodel, ammunition);
  1526. SendClientMessage(playerid, COLOR_ADMIN_INFO, string);
  1527. }
  1528. }
  1529. }
  1530. }
  1531. return 1;
  1532. }
  1533.  
  1534. CMD:spec( playerid, params[] )
  1535. {
  1536. new idx, string[256], cmdtext[2048], targetid;
  1537. if(IsPlayerConnected(playerid))
  1538. {
  1539. if(PlayerInfo[playerid][pAdmin] < 1)
  1540. {
  1541. SendClientMessage(playerid, COLOR_ERROR, "You are not authorized to use that command.");
  1542. return 1;
  1543. }
  1544. temp = strtok(cmdtext, idx);
  1545. if(!strlen(temp))
  1546. {
  1547. SendClientMessage(playerid, COLOR_SYN, "Synthax: /spec [playerid/off]");
  1548. return 1;
  1549. }
  1550. targetid = ReturnUser(temp);
  1551. if(IsPlayerNPC(targetid)) return 1;
  1552. if(strcmp("off", temp, true, strlen(temp)) == 0)
  1553. {
  1554. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
  1555. {
  1556. SendClientMessage(playerid, COLOR_ADMIN_INFO, "You are not spectating anyone");
  1557. return 1;
  1558. }
  1559. SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
  1560. SendClientMessage(playerid, COLOR_ADMIN_INFO, "You are no longer spectating.");
  1561. TogglePlayerSpectating(playerid, 0);
  1562. SpectatedID[playerid] = INVALID_PLAYER_ID;
  1563. SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
  1564. return 1;
  1565. }
  1566. if(IsPlayerConnected(targetid))
  1567. {
  1568. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
  1569. {
  1570. PlayerInfo[playerid][pInterior] = GetPlayerInterior(playerid);
  1571. }
  1572. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
  1573. SetPlayerInterior(playerid, GetPlayerInterior(targetid));
  1574. TogglePlayerSpectating(playerid, 1);
  1575. SpectatedID[playerid] = targetid;
  1576. new Float:X, Float:Y, Float:Z;
  1577. new Float:health;
  1578. GetPlayerHealth(targetid, health);
  1579. new Float:armor;
  1580. GetPlayerArmour(targetid, armor);GetPlayerPos(playerid, X, Y, Z);
  1581. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1582. new cash = GetPlayerMoney(targetid);
  1583. if (PlayerInfo[playerid][pAdmin] >= 1)
  1584. {
  1585. format(string, sizeof(string), "Specing: [%d]%s [$%d] [H:%.0f] [A:%.0f]",targetid,pNameGive,cash,health,armor);
  1586. }
  1587. SendClientMessage(playerid, COLOR_GREEN, string);
  1588. if(IsPlayerInAnyVehicle(targetid))
  1589. {
  1590. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(targetid));
  1591. SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
  1592. }
  1593. else
  1594. {
  1595. PlayerSpectatePlayer(playerid, targetid);
  1596. SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
  1597. }
  1598. }
  1599. else
  1600. {
  1601. SendClientMessage(playerid, COLOR_ERROR, "That player isn't active !");
  1602. return 1;
  1603. }
  1604. }
  1605. return 1;
  1606. }
  1607.  
  1608. CMD:gethere( playerid, params[] )
  1609. {
  1610. new idx, cmdtext[2048], targetid;
  1611. if(IsPlayerConnected(playerid))
  1612. {
  1613. if(gLogged[playerid] == 1)
  1614. {
  1615. temp = strtok(cmdtext, idx);
  1616.  
  1617. if(!strlen(temp))
  1618. {
  1619. SendClientMessage(playerid, COLOR_SYN, "Synthax: /gethere <playerid/PartOfName> or <carid>");
  1620. return 1;
  1621. }
  1622. targetid = ReturnUser(temp);
  1623. if (PlayerInfo[playerid][pAdmin] >= 1)
  1624. {
  1625. if (IsPlayerConnected(targetid))
  1626. {
  1627. if(targetid != INVALID_PLAYER_ID)
  1628. {
  1629. GetPlayerPos(playerid, x, y, z);
  1630.  
  1631. if(PlayerInfo[playerid][pInterior] > 0)
  1632. {
  1633. SetPlayerInterior(targetid,PlayerInfo[playerid][pInterior]);
  1634. PlayerInfo[targetid][pInterior] = PlayerInfo[playerid][pInterior];
  1635. SetPlayerInterior(targetid, GetPlayerInterior(playerid));
  1636. SetPlayerVirtualWorld(targetid, GetPlayerVirtualWorld(playerid));
  1637. }
  1638. if(PlayerInfo[playerid][pInterior] == 0)
  1639. {
  1640. SetPlayerInterior(targetid,0);
  1641. }
  1642. if(z > 930.0 && PlayerInfo[playerid][pInterior] == 0)
  1643. {
  1644. SetPlayerInterior(targetid,1);
  1645. PlayerInfo[targetid][pInterior] = 1;
  1646. }
  1647. if (GetPlayerState(targetid) == 2)
  1648. {
  1649. new tmpcar = GetPlayerVehicleID(targetid);
  1650. SetVehiclePos(tmpcar, x, y+4, z);
  1651. SetPlayerInterior(targetid, GetPlayerInterior(playerid));
  1652. SetPlayerVirtualWorld(targetid, GetPlayerVirtualWorld(playerid));
  1653. SetVehicleVirtualWorld(GetPlayerVehicleID(targetid), GetPlayerVirtualWorld(playerid));
  1654. }
  1655. else
  1656. {
  1657. SetPlayerPos(targetid,x, y+2, z);
  1658. }
  1659. SendClientMessage(targetid, COLOR_LIGHTRED, "You got teleported");
  1660. }
  1661. }
  1662. else if(strcmp(temp, "car", true) == 0)
  1663. {
  1664. temp = strtok(cmdtext, idx);
  1665.  
  1666. if(!strlen(temp))
  1667. {
  1668. SendClientMessage(playerid, COLOR_SYN, "Synthax: /gethere car <carid>");
  1669. return 1;
  1670. }
  1671.  
  1672. new carid;
  1673.  
  1674. carid = strval(temp);
  1675.  
  1676. GetPlayerPos(playerid, x, y, z);
  1677. SetVehiclePos(carid,x,y+4, z);
  1678. SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
  1679. }
  1680. }
  1681. else
  1682. {
  1683. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1684. }
  1685. }
  1686. else if(gLogged[playerid] != 1)
  1687. {
  1688. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1689. }
  1690. else
  1691. {
  1692. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername / carid.");
  1693. }
  1694. }
  1695. return 1;
  1696. }
  1697.  
  1698. //
  1699. // Helpers Commands
  1700. CMD:hh( playerid, params[] )
  1701. {
  1702. if(IsPlayerConnected(playerid))
  1703. {
  1704. if(gLogged[playerid] == 1)
  1705. {
  1706. if(PlayerInfo[playerid][pHelper] >= 1)
  1707. {
  1708. SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
  1709.  
  1710. if(PlayerInfo[playerid][pHelper] >= 1)
  1711. {
  1712. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 1 ** (/hh)elperhelp (/he)lperchat /goto /check");
  1713. }
  1714.  
  1715. if(PlayerInfo[playerid][pHelper] >= 2)
  1716. {
  1717. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 2 **");
  1718. }
  1719.  
  1720. if(PlayerInfo[playerid][pHelper] >= 3)
  1721. {
  1722. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 3 **");
  1723. }
  1724.  
  1725. if(PlayerInfo[playerid][pHelper] >= 4)
  1726. {
  1727. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 4 **");
  1728. }
  1729.  
  1730. if(PlayerInfo[playerid][pHelper] >= 5)
  1731. {
  1732. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 5 **");
  1733. }
  1734.  
  1735. if(PlayerInfo[playerid][pHelper] >= 6)
  1736. {
  1737. SendClientMessage(playerid, COLOR_WHITE, "** Helper level 6 **");
  1738. }
  1739.  
  1740. SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
  1741. }
  1742.  
  1743. else
  1744. {
  1745. SendClientMessage(playerid, COLOR_ERROR, "Error: Your helper level is not high enough to use this command.");
  1746. }
  1747.  
  1748. }
  1749.  
  1750. else
  1751. {
  1752. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1753. }
  1754. }
  1755. return 1;
  1756. }
  1757.  
  1758. CMD:he( playerid, params[] )
  1759. {
  1760. new idx, string[256], cmdtext[2048];
  1761. if(IsPlayerConnected(playerid))
  1762. {
  1763. if(gLogged[playerid] == 1)
  1764. {
  1765. GetPlayerName(playerid, pName2, sizeof(pName2));
  1766.  
  1767. new length = strlen(cmdtext);
  1768.  
  1769. while ((idx < length) && (cmdtext[idx] <= ' '))
  1770. {
  1771. idx++;
  1772. }
  1773.  
  1774. new offset = idx;
  1775. new result[128];
  1776.  
  1777. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  1778. {
  1779. result[idx - offset] = cmdtext[idx];
  1780. idx++;
  1781. }
  1782.  
  1783. result[idx - offset] = EOS;
  1784.  
  1785. if(!strlen(result))
  1786. {
  1787. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/he)lperchat <text>");
  1788. return 1;
  1789. }
  1790.  
  1791. if (PlayerInfo[playerid][pHelper] >= 1 && PlayerInfo[playerid][pHelper] <= 5)
  1792. {
  1793. format(string, sizeof(string), "** Helper Level %d %s : %s **", PlayerInfo[playerid][pHelper], pName2, result);
  1794. HelpersBroadCast(COLOR_YELLOW2, string);
  1795. }
  1796.  
  1797. if (PlayerInfo[playerid][pHelper] == 6)
  1798. {
  1799. format(string, sizeof(string), "{CFAE70}** Helper Level %d %s : %s **", PlayerInfo[playerid][pHelper], pName2, result);
  1800. HelpersBroadCast(COLOR_WHITE, string);
  1801. }
  1802.  
  1803. if (PlayerInfo[playerid][pAdmin] < 1)
  1804. {
  1805. SendClientMessage(playerid, COLOR_ERROR, "Error: Your helper level is not high enough to use this command.");
  1806. return 1;
  1807. }
  1808. }
  1809. else
  1810. {
  1811. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1812. }
  1813. }
  1814. return 1;
  1815. }
  1816.  
  1817. //
  1818. // Admins & Helpers commands
  1819. CMD:goto( playerid, params[] )
  1820. {
  1821. new idx, cmdtext[2048], targetid;
  1822. if(IsPlayerConnected(playerid))
  1823. {
  1824. if(gLogged[playerid] == 1)
  1825. {
  1826. temp = strtok(cmdtext, idx);
  1827.  
  1828. if(!strlen(temp))
  1829. {
  1830. SendClientMessage(playerid, COLOR_SYN, "Synthax: /goto <playerid/PartOfName> or <carid> or <destination>");
  1831. return 1;
  1832. }
  1833.  
  1834. targetid = ReturnUser(temp);
  1835.  
  1836. if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
  1837. {
  1838. if (IsPlayerConnected(targetid))
  1839. {
  1840. if(targetid != INVALID_PLAYER_ID)
  1841. {
  1842. if(GetPlayerState(targetid) == PLAYER_STATE_SPECTATING)
  1843. {
  1844. SendClientMessage(playerid, COLOR_YELLOW3, "That Player is spectating Someone.");
  1845. }
  1846.  
  1847. GetPlayerPos(targetid, Float:x, Float:y, Float:z);
  1848.  
  1849. if(PlayerInfo[targetid][pInterior] > 0)
  1850. {
  1851. SetPlayerInterior(playerid,PlayerInfo[targetid][pInterior]);
  1852. PlayerInfo[playerid][pInterior] = PlayerInfo[targetid][pInterior];
  1853. }
  1854. if(PlayerInfo[playerid][pInterior] == 0)
  1855. {
  1856. SetPlayerInterior(playerid,0);
  1857. }
  1858. if(Float:z > 530.0 && PlayerInfo[targetid][pInterior] == 0)
  1859. {
  1860. SetPlayerInterior(playerid,1);
  1861. PlayerInfo[playerid][pInterior] = 1;
  1862. }
  1863. if (GetPlayerState(playerid) == 2)
  1864. {
  1865. new tempcar = GetPlayerVehicleID(playerid);
  1866. SetVehiclePos(tempcar, Float:x, Float:y+4, Float:z);
  1867. }
  1868. else
  1869. {
  1870. SetPlayerPos(playerid, Float:x, Float:y+2, Float:z);
  1871. }
  1872.  
  1873. SendClientMessage(playerid, COLOR_LIGHTRED, "You got teleported");
  1874. SetPlayerInterior(playerid, GetPlayerInterior(targetid));
  1875. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
  1876. }
  1877. }
  1878. else if(strcmp(temp, "car", true) == 0)
  1879. {
  1880. temp = strtok(cmdtext, idx);
  1881. if(!strlen(temp))
  1882. {
  1883. SendClientMessage(playerid, COLOR_SYN, "Synthax: /goto car <carid>");
  1884. return 1;
  1885. }
  1886.  
  1887. new tempcar = strval(temp);
  1888.  
  1889. GetVehiclePos(tempcar, Float:x, Float:y, Float:z);
  1890.  
  1891. if (GetPlayerState(playerid) == 2)
  1892. {
  1893. new tempcar2 = GetPlayerVehicleID(playerid);
  1894. SetVehiclePos(tempcar2, Float:x, Float:y, Float:z);
  1895. }
  1896. else
  1897. {
  1898. SetPlayerPos(playerid, Float:x, Float:y, Float:z);
  1899. }
  1900.  
  1901. SendClientMessage(playerid, COLOR_LIGHTRED, "You got teleported");
  1902. SetPlayerInterior(playerid, 0);
  1903. }
  1904. else if(strcmp(temp, "ls", true) == 0)
  1905. {
  1906. if (GetPlayerState(playerid) == 2)
  1907. {
  1908. new tempcar = GetPlayerVehicleID(playerid);
  1909. SetVehiclePos(tempcar, 1529.6,-1691.2,13.3);
  1910. }
  1911. else
  1912. {
  1913. SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
  1914. }
  1915.  
  1916. SendClientMessage(playerid, COLOR_LIGHTRED, "You got teleported");
  1917. SetPlayerInterior(playerid,0);
  1918. PlayerInfo[playerid][pInterior] = 0;
  1919. }
  1920. else
  1921. {
  1922. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername / carid / destination.");
  1923. }
  1924. }
  1925. else
  1926. {
  1927. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1928. }
  1929. }
  1930. else
  1931. {
  1932. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1933. }
  1934. }
  1935. return 1;
  1936. }
  1937.  
  1938. CMD:check( playerid, params[] )
  1939. {
  1940. new idx, cmdtext[2048], targetid;
  1941. if(IsPlayerConnected(playerid))
  1942. {
  1943. if(gLogged[playerid] == 1)
  1944. {
  1945. temp = strtok(cmdtext, idx);
  1946.  
  1947. if(!strlen(temp))
  1948. {
  1949. SendClientMessage(playerid, COLOR_SYN, "Synthax: /check <playerid/PartOfName>");
  1950. return 1;
  1951. }
  1952.  
  1953. if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
  1954. {
  1955.  
  1956. targetid = ReturnUser(temp);
  1957.  
  1958. if(targetid != INVALID_PLAYER_ID)
  1959. {
  1960. GetPlayerName(targetid, pNameGive, sizeof(pNameGive));
  1961.  
  1962. ShowStats(playerid, targetid);
  1963. }
  1964.  
  1965. else
  1966. {
  1967. SendClientMessage(playerid, COLOR_ERROR, "Error: Invalid playerid / playername.");
  1968. }
  1969. }
  1970.  
  1971. else
  1972. {
  1973. SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command.");
  1974. }
  1975. }
  1976. else
  1977. {
  1978. SendClientMessage(playerid, COLOR_ERROR, "You are not logged in!");
  1979. }
  1980. }
  1981. return 1;
  1982. }
  1983. // Faction Member Commands
  1984. CMD:f( playerid, params[] )
  1985. {
  1986. new idx, string[256], cmdtext[2048];
  1987. if(IsPlayerConnected(playerid))
  1988. {
  1989. GetPlayerName(playerid, pName2, sizeof(pName2));
  1990. new length = strlen(cmdtext);
  1991.  
  1992. while ((idx < length) && (cmdtext[idx] <= ' '))
  1993. {
  1994. idx++;
  1995. }
  1996.  
  1997. new offset = idx;
  1998. new result[128];
  1999.  
  2000. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2001. {
  2002. result[idx - offset] = cmdtext[idx];
  2003. idx++;
  2004. }
  2005.  
  2006. result[idx - offset] = EOS;
  2007.  
  2008. if(!strlen(result))
  2009. {
  2010. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/f)action <faction chat>");
  2011. return 1;
  2012. }
  2013.  
  2014. if(PlayerInfo[playerid][pLeader] > 0 || PlayerInfo[playerid][pMember] > 0)
  2015. {
  2016. if(PlayerInfo[playerid][pMember] == 1)
  2017. {
  2018. if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** (( Chief %s: %s )) **", pName2, result); }
  2019. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** (( Captain %s: %s )) **", pName2, result); }
  2020. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** (( Lieutenant %s: %s )) **", pName2, result); }
  2021. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** (( Sergeant %s: %s )) **", pName2, result); }
  2022. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** (( Officer %s: %s )) **", pName2, result); }
  2023. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** (( Cadet %s: %s )) **", pName2, result); }
  2024. else { format(string, sizeof(string), "** (( Cadet %s: %s )) **", pName2, result); }
  2025. FactionsBroadCast(PlayerInfo[playerid][pMember], COLOR_FACTION_CHAT, string);
  2026. }
  2027. else if(PlayerInfo[playerid][pMember] == 4)
  2028. {
  2029. if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** (( Chief Fireman/Paramedic %s: %s )) **", pName2, result); }
  2030. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** (( Paramedic Field %s: %s )) **", pName2, result); }
  2031. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** (( Ambulance Commander %s: %s )) **", pName2, result); }
  2032. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** (( Paramedic in charge %s: %s )) **", pName2, result); }
  2033. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** (( Fire Paramedic %s: %s )) **", pName2, result); }
  2034. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** (( Candidate Fire Paramedic %s: %s )) **", pName2, result); }
  2035. else { format(string, sizeof(string), "** (( Private %s: %s )) **", pName2, result); }
  2036. FactionsBroadCast(PlayerInfo[playerid][pMember], COLOR_FACTION_CHAT, string);
  2037. }
  2038. return 1;
  2039. }
  2040. else
  2041. {
  2042. SendClientMessage(playerid, COLOR_ERROR, "Error: You are not part of a Faction!");
  2043. return 1;
  2044. }
  2045. }
  2046. return 1;
  2047. }
  2048.  
  2049. CMD:radio( playerid, params[] )
  2050. {
  2051. new idx, string[256], cmdtext[2048];
  2052. if(IsPlayerConnected(playerid))
  2053. {
  2054. GetPlayerName(playerid, pName2, sizeof(pName2));
  2055.  
  2056. new length = strlen(cmdtext);
  2057.  
  2058. while ((idx < length) && (cmdtext[idx] <= ' '))
  2059. {
  2060. idx++;
  2061. }
  2062.  
  2063. new offset = idx;
  2064. new result[128];
  2065.  
  2066. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  2067. {
  2068. result[idx - offset] = cmdtext[idx];
  2069. idx++;
  2070. }
  2071.  
  2072. result[idx - offset] = EOS;
  2073.  
  2074. if(!strlen(result))
  2075. {
  2076. SendClientMessage(playerid, COLOR_SYN, "Synthax: (/r)adio <radio chat>");
  2077. return 1;
  2078. }
  2079.  
  2080. if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
  2081. {
  2082. if(PlayerInfo[playerid][pRank] >= 6) { format(string, sizeof(string), "** LSPD Chief %s: %s, over. **", pName2, result); }
  2083. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** LSPD Captain %s: %s, over. **", pName2, result); }
  2084. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** LSPD Lieutenant %s: %s, over. **", pName2, result); }
  2085. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** LSPD Sergeant %s: %s, over. **", pName2, result); }
  2086. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** LSPD Officer %s: %s, over. **", pName2, result); }
  2087. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** LSPD Cadet %s: %s, over. **", pName2, result); }
  2088. else
  2089. {
  2090. format(string, sizeof(string), "** LSPD Cadet %s: %s, over. **", pName2, result);
  2091. }
  2092. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2093. return 1;
  2094. }
  2095. if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
  2096. {
  2097. if(PlayerInfo[playerid][pRank] >= 6) { format(string, sizeof(string), "** LVPD Chief %s: %s, over. **", pName2, result); }
  2098. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** LVPD Captain %s: %s, over. **", pName2, result); }
  2099. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** LVPD Lieutenant %s: %s, over. **", pName2, result); }
  2100. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** LVPD Sergeant %s: %s, over. **", pName2, result); }
  2101. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** LVPD Officer %s: %s, over. **", pName2, result); }
  2102. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** LVPD Cadet %s: %s, over. **", pName2, result); }
  2103. else
  2104. {
  2105. format(string, sizeof(string), "** Cadet %s: %s, over. **", pName2, result);
  2106. }
  2107. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2108. return 1;
  2109. }
  2110. if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
  2111. {
  2112. if(PlayerInfo[playerid][pRank] >= 6) { format(string, sizeof(string), "** SFPD Chief %s: %s, over. **", pName2, result); }
  2113. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** SFPD Captain %s: %s, over. **", pName2, result); }
  2114. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** SFPD Lieutenant %s: %s, over. **", pName2, result); }
  2115. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** SFPD Sergeant %s: %s, over. **", pName2, result); }
  2116. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** SFPD Officer %s: %s, over. **", pName2, result); }
  2117. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** SFPD Cadet %s: %s, over. **", pName2, result); }
  2118. else
  2119. {
  2120. format(string, sizeof(string), "** Cadet %s: %s, over. **", pName2, result);
  2121. }
  2122. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2123. return 1;
  2124. }
  2125. else if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
  2126. {
  2127. if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Director %s: %s, over. **", pName2, result); }
  2128. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Director in Charge %s: %s, over. **", pName2, result); }
  2129. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Special Agent in Charge %s: %s, over. **", pName2, result); }
  2130. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Special Agent %s: %s, over. **", pName2, result); }
  2131. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Special Agent Trainee %s: %s, over. **", pName2, result); }
  2132. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Professional Staff %s: %s, over. **", pName2, result); }
  2133. else
  2134. {
  2135. format(string, sizeof(string), "** Intern %s: %s, over. **", pName2, result);
  2136. }
  2137. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2138. return 1;
  2139. }
  2140. else if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
  2141. {
  2142. if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** General %s: %s, over. **", pName2, result); }
  2143. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", pName2, result); }
  2144. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Captain %s: %s, over. **", pName2, result); }
  2145. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Major %s: %s, over. **", pName2, result); }
  2146. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", pName2, result); }
  2147. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Private %s: %s, over. **", pName2, result); }
  2148. else
  2149. {
  2150. format(string, sizeof(string), "** Private %s: %s, over. **", pName2, result);
  2151. }
  2152. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2153. return 1;
  2154. }
  2155. else if(PlayerInfo[playerid][pMember]== 6 || PlayerInfo[playerid][pLeader]== 6)
  2156. {
  2157. if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Chief Paramedic %s: %s, over. **", pName2, result); }
  2158. else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Chief Paramedic %s: %s, over. **", pName2, result); }
  2159. else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Ambulance Chief %s: %s, over. **", pName2, result); }
  2160. else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Paramedic in Charge %s: %s, over. **", pName2, result); }
  2161. else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Paramedic %s: %s, over. **", pName2, result); }
  2162. else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Candidate Paramedic %s: %s, over. **", pName2, result); }
  2163. else
  2164. {
  2165. format(string, sizeof(string), "** Candidate Paramedic %s: %s, over. **", pName2, result);
  2166. }
  2167. RadioBroadCast(PlayerInfo[playerid][pMember], COLOR_RADIO_CHAT, string);
  2168. return 1;
  2169. }
  2170. else
  2171. {
  2172. SendClientMessage(playerid, COLOR_ERROR, "Error: You are not part of a Team!");
  2173. return 1;
  2174. }
  2175. }
  2176. return 1;
  2177. }
  2178.  
  2179. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  2180. {
  2181. return 1;
  2182. }
  2183.  
  2184. public OnPlayerExitVehicle(playerid, vehicleid)
  2185. {
  2186. return 1;
  2187. }
  2188.  
  2189. public OnPlayerStateChange(playerid, newstate, oldstate)
  2190. {
  2191. return 1;
  2192. }
  2193.  
  2194. public OnPlayerEnterCheckpoint(playerid)
  2195. {
  2196. return 1;
  2197. }
  2198.  
  2199. public OnPlayerLeaveCheckpoint(playerid)
  2200. {
  2201. return 1;
  2202. }
  2203.  
  2204. public OnPlayerEnterRaceCheckpoint(playerid)
  2205. {
  2206. return 1;
  2207. }
  2208.  
  2209. public OnPlayerLeaveRaceCheckpoint(playerid)
  2210. {
  2211. return 1;
  2212. }
  2213.  
  2214. public OnRconCommand(cmd[])
  2215. {
  2216. return 1;
  2217. }
  2218.  
  2219. public OnPlayerRequestSpawn(playerid)
  2220. {
  2221. return 1;
  2222. }
  2223.  
  2224. public OnObjectMoved(objectid)
  2225. {
  2226. return 1;
  2227. }
  2228.  
  2229. public OnPlayerObjectMoved(playerid, objectid)
  2230. {
  2231. return 1;
  2232. }
  2233.  
  2234. public OnPlayerPickUpPickup(playerid, pickupid)
  2235. {
  2236. return 1;
  2237. }
  2238.  
  2239. public OnVehicleMod(playerid, vehicleid, componentid)
  2240. {
  2241. return 1;
  2242. }
  2243.  
  2244. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  2245. {
  2246. return 1;
  2247. }
  2248.  
  2249. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  2250. {
  2251. return 1;
  2252. }
  2253.  
  2254. public OnPlayerSelectedMenuRow(playerid, row)
  2255. {
  2256. return 1;
  2257. }
  2258.  
  2259. public OnPlayerExitedMenu(playerid)
  2260. {
  2261. return 1;
  2262. }
  2263.  
  2264. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  2265. {
  2266. return 1;
  2267. }
  2268.  
  2269. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2270. {
  2271. return 1;
  2272. }
  2273.  
  2274. public OnRconLoginAttempt(ip[], password[], success)
  2275. {
  2276. return 1;
  2277. }
  2278.  
  2279. public OnPlayerUpdate(playerid)
  2280. {
  2281. return 1;
  2282. }
  2283.  
  2284. public OnPlayerStreamIn(playerid, forplayerid)
  2285. {
  2286. return 1;
  2287. }
  2288.  
  2289. public OnPlayerStreamOut(playerid, forplayerid)
  2290. {
  2291. return 1;
  2292. }
  2293.  
  2294. public OnVehicleStreamIn(vehicleid, forplayerid)
  2295. {
  2296. return 1;
  2297. }
  2298.  
  2299. public OnVehicleStreamOut(vehicleid, forplayerid)
  2300. {
  2301. return 1;
  2302. }
  2303.  
  2304. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2305. {
  2306.  
  2307. if(dialogid == DIALOG_LOGIN)
  2308. {
  2309. if(IsPlayerConnected(playerid))
  2310. {
  2311. if(!response)
  2312. {
  2313. Kick(playerid);
  2314. return 1;
  2315. }
  2316. if(strlen(inputtext) >= 3 && strlen(inputtext) <= 20)
  2317. {
  2318. if(strfind(inputtext, "'", true) != -1)
  2319. {
  2320. new pName[64];
  2321. GetPlayerName(playerid, pName, sizeof(pName));
  2322. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your account's password below:", "Login", "Exit");
  2323. }
  2324. new tmppass[64];
  2325. mysql_real_escape_string(inputtext, tmppass);
  2326. if(strlen(tmppass) < 3)
  2327. {
  2328. new loginname[64];
  2329. GetPlayerName(playerid,loginname,sizeof(loginname));
  2330. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login", "Type your account's password below:", "Login", "Exit");
  2331. }
  2332. OnPlayerLogin(playerid,tmppass);
  2333. }
  2334. else
  2335. {
  2336. new loginname[64];
  2337. GetPlayerName(playerid,loginname,sizeof(loginname));
  2338. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your account's password below:", "Login", "Exit");
  2339. }
  2340. }
  2341. }
  2342.  
  2343. if(dialogid == DIALOG_REGISTER)
  2344. {
  2345. if(!response)
  2346. {
  2347. Kick(playerid);
  2348. return 1;
  2349. }
  2350.  
  2351. if(strlen(inputtext) >= 3 && strlen(inputtext) <= 20)
  2352. {
  2353. new tmppass[64];
  2354. new pName[30];
  2355. new string[256];
  2356. GetPlayerName(playerid, pName, sizeof(pName));
  2357.  
  2358. mysql_real_escape_string(inputtext, tmppass);
  2359.  
  2360. if(strlen(tmppass) < 3)
  2361. {
  2362. format(string,sizeof(string),"{BECBFC}Welcome, {95A3FF}%s{BECBFC}!\n\nPlease enter your password below to login to your account.\n\n* {FFFFFF}Last login: %s *",pName);
  2363. ShowPlayerDialog(playerid, DIALOG_LOGIN ,DIALOG_STYLE_PASSWORD,"Login", string, "Login", "Exit");
  2364. }
  2365. OnPlayerRegister(playerid,tmppass);
  2366. }
  2367. else
  2368. {
  2369. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Character Gender", "Enter your password below:", "Register", "Cancel");
  2370. }
  2371. }
  2372.  
  2373. if(dialogid == DIALOG_SEX)
  2374. {
  2375. if(!response)
  2376. {
  2377. ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "Character Gender", "Are you a male or a female?", "Male", "Female");
  2378. }
  2379. if(response)
  2380. {
  2381. PlayerInfo[playerid][pSex] = 1;
  2382. Update(playerid, pSexu);
  2383.  
  2384. RegistrationStep[playerid] = 1;
  2385.  
  2386. ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Character Age", "OK, so you're a male.\n\nNow, how old are you?(7-50)", "Next", "Back");
  2387.  
  2388. return 1;
  2389. }
  2390. else
  2391. {
  2392. PlayerInfo[playerid][pSex] = 2;
  2393. Update(playerid, pSexu);
  2394.  
  2395. RegistrationStep[playerid] = 1;
  2396.  
  2397. ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Character Age", "OK, so you're a female.\n\nNow, how old are you?(7-50)", "Next", "Back");
  2398.  
  2399. return 1;
  2400. }
  2401. }
  2402.  
  2403. if(dialogid == DIALOG_AGE)
  2404. {
  2405. if(response)
  2406. {
  2407. new age = strval(inputtext);
  2408. new string[256];
  2409. if(age > 6 && age < 101)
  2410. {
  2411. PlayerInfo[playerid][pAge] = age;
  2412. Update(playerid, pAgeu);
  2413.  
  2414. RegistrationStep[playerid] = 2;
  2415.  
  2416. format(string, sizeof(string), "OK, so you have %d years.\n\nPlease enter below you email adress:", age);
  2417. ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", string, "Next", "Back");
  2418. }
  2419. else return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Character Age", "Now, what is your age?(7-100)", "Next", "Back");
  2420. }
  2421. if(!response)
  2422. {
  2423. ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "Character Gender", "Are you a male or a female?", "Male", "Female");
  2424. }
  2425. }
  2426.  
  2427. if(dialogid == DIALOG_EMAIL)
  2428. {
  2429. if(response)
  2430. {
  2431. new string[256];
  2432. if(strlen(inputtext) < 4 || strlen(inputtext) > 151)
  2433. {
  2434. SendClientMessage(playerid, COLOR_ERROR, "The name of the email can't pass 150 letters and can't be shorter than 5 letters!");
  2435. ShowPlayerDialog(playerid,702,DIALOG_STYLE_INPUT,"Email","Please enter below you email adress:","Next","");
  2436. return 1;
  2437. }
  2438. else
  2439. {
  2440. strmid(PlayerInfo[playerid][pEmail], inputtext, 0, strlen(inputtext), 999);
  2441. Update(playerid, pEmailu);
  2442. format(string, sizeof(string), "OK, so you're email is %s.", inputtext);
  2443. ShowPlayerDialog(playerid, DIALOG_REGISTER_FINISH, DIALOG_STYLE_MSGBOX,"Email", string, "Next", "");
  2444. }
  2445. }
  2446. if(!response)
  2447. {
  2448. ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Character Age", "Now, what is your age?(7-100)", "Next", "Back");
  2449. }
  2450. }
  2451.  
  2452. if(dialogid == DIALOG_REGISTER_FINISH)
  2453. {
  2454. if(response)
  2455. {
  2456. RegistrationStep[playerid] = 0;
  2457. TutorialTime[playerid] = 1;
  2458. }
  2459. }
  2460. return 1;
  2461. }
  2462.  
  2463. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  2464. {
  2465. return 1;
  2466. }
  2467.  
  2468. stock ShowStats(playerid, targetid)
  2469. {
  2470. if(IsPlayerConnected(targetid))
  2471. {
  2472. new pName[MAX_PLAYER_NAME];
  2473. GetPlayerName(targetid, pName, sizeof(pName));
  2474. new string[256];
  2475.  
  2476. new level = PlayerInfo[targetid][pLevel];
  2477. new sex[8];
  2478. if(PlayerInfo[targetid][pSex] == 1)
  2479. {
  2480. sex = "Male";
  2481. }
  2482. else if(PlayerInfo[targetid][pSex] == 2)
  2483. {
  2484. sex = "Female";
  2485. }
  2486. new age = PlayerInfo[targetid][pAge];
  2487. new cash = GetPlayerCash(targetid);
  2488. new account = PlayerInfo[targetid][pAccount];
  2489. new phonenumber = PlayerInfo[targetid][pPhoneNumber];
  2490. new premiumaccount[4];
  2491. if(PlayerInfo[targetid][pPremiumAccount] == 1)
  2492. {
  2493. premiumaccount = "Yes";
  2494. }
  2495. else
  2496. {
  2497. premiumaccount = "No";
  2498. }
  2499. new factiontext[128];
  2500. if(PlayerInfo[targetid][pMember] == 1 || PlayerInfo[targetid][pLeader] == 1)
  2501. {
  2502. factiontext = "Los Santos Police Department";
  2503. }
  2504. if(PlayerInfo[targetid][pMember] == 2 || PlayerInfo[targetid][pLeader] == 2)
  2505. {
  2506. factiontext = "Las Venturas Police Department";
  2507. }
  2508. if(PlayerInfo[targetid][pMember] == 3 || PlayerInfo[targetid][pLeader] == 3)
  2509. {
  2510. factiontext = "San Fierro Police Department";
  2511. }
  2512. else if(PlayerInfo[targetid][pMember] == 4 || PlayerInfo[targetid][pLeader] == 4)
  2513. {
  2514. factiontext = "Federal Bureau of Investigations";
  2515. }
  2516. else if(PlayerInfo[targetid][pMember] == 5 || PlayerInfo[targetid][pLeader] == 5)
  2517. {
  2518. factiontext = "National Guard";
  2519. }
  2520. new ranktext[128];
  2521. if(PlayerInfo[targetid][pMember] == 1 || PlayerInfo[targetid][pLeader] == 1 || PlayerInfo[targetid][pMember] == 2 || PlayerInfo[targetid][pLeader] == 2 || PlayerInfo[targetid][pMember] == 3 || PlayerInfo[targetid][pLeader] == 3)// Los Santos Police Department Ranks || Las Venturas Police Department Ranks || San Fierro Police Department Ranks
  2522. {
  2523. if(PlayerInfo[targetid][pRank] == 1)
  2524. {
  2525. ranktext = "Cadet";
  2526. }
  2527. else if(PlayerInfo[targetid][pRank] == 2)
  2528. {
  2529. ranktext = "Officer";
  2530. }
  2531. else if(PlayerInfo[targetid][pRank] == 3)
  2532. {
  2533. ranktext = "Sergent";
  2534. }
  2535. else if(PlayerInfo[targetid][pRank] == 4)
  2536. {
  2537. ranktext = "Lieutenant";
  2538. }
  2539. else if(PlayerInfo[targetid][pRank] == 5)
  2540. {
  2541. ranktext = "Captain";
  2542. }
  2543. else if(PlayerInfo[targetid][pRank] == 6)
  2544. {
  2545. ranktext = "Chief";
  2546. }
  2547. else
  2548. {
  2549. ranktext = "Cadet";
  2550. }
  2551. }
  2552. else if(PlayerInfo[targetid][pMember] == 4 || PlayerInfo[targetid][pLeader] == 4)// FBI Ranks
  2553. {
  2554. if(PlayerInfo[targetid][pRank] == 1)
  2555. {
  2556. ranktext = "Professional Staff";
  2557. }
  2558. else if(PlayerInfo[targetid][pRank] == 2)
  2559. {
  2560. ranktext = "Special Agent Trainee";
  2561. }
  2562. else if(PlayerInfo[targetid][pRank] == 3)
  2563. {
  2564. ranktext = "Special Agent";
  2565. }
  2566. else if(PlayerInfo[targetid][pRank] == 4)
  2567. {
  2568. ranktext = "Special Agent in Charge";
  2569. }
  2570. else if(PlayerInfo[targetid][pRank] == 5)
  2571. {
  2572. ranktext = "Assistant Director in Charge";
  2573. }
  2574. else if(PlayerInfo[targetid][pRank] == 6)
  2575. {
  2576. ranktext = "Director";
  2577. }
  2578. else
  2579. {
  2580. ranktext = "Professional Staff";
  2581. }
  2582. }
  2583. else if(PlayerInfo[targetid][pMember] == 5 || PlayerInfo[targetid][pLeader] == 5)// National Guard Ranks
  2584. {
  2585. if(PlayerInfo[targetid][pRank] == 1)
  2586. {
  2587. ranktext = "Private";
  2588. }
  2589. else if(PlayerInfo[targetid][pRank] == 2)
  2590. {
  2591. ranktext = "Mayor";
  2592. }
  2593. else if(PlayerInfo[targetid][pRank] == 3)
  2594. {
  2595. ranktext = "Sergent";
  2596. }
  2597. else if(PlayerInfo[targetid][pRank] == 4)
  2598. {
  2599. ranktext = "Lieutenant";
  2600. }
  2601. else if(PlayerInfo[targetid][pRank] == 5)
  2602. {
  2603. ranktext = "Captain";
  2604. }
  2605. else if(PlayerInfo[targetid][pRank] == 6)
  2606. {
  2607. ranktext = "General";
  2608. }
  2609. else
  2610. {
  2611. ranktext = "Private";
  2612. }
  2613. }
  2614.  
  2615. SendClientMessage(playerid, COLOR_SERVER_GREEN,"_______________________________________");
  2616. format(string, sizeof(string), "%s's Stats", pName);
  2617. SendClientMessage(playerid, COLOR_WHITE, string);
  2618. format(string, sizeof(string), "Level:[%d] Sex:[%s] Age:[%d] Cash:[$%s] Bank:[$%s] Phone:[%s]", level, sex, age, FormatNumber(cash), FormatNumber(account), PhoneFormat(phonenumber));
  2619. SendClientMessage(playerid, COLOR_WHITE,string);
  2620. format(string, sizeof(string), "Premium Account:[%s]", premiumaccount);
  2621. SendClientMessage(playerid, COLOR_WHITE,string);
  2622. format(string, sizeof(string), "Faction:[%s] Rank:[%s]", factiontext, ranktext);
  2623. SendClientMessage(playerid, COLOR_WHITE,string);
  2624. SendClientMessage(playerid, COLOR_SERVER_GREEN,"_______________________________________");
  2625.  
  2626. }
  2627. return 1;
  2628. }
  2629.  
  2630. public KickPublic(playerid)
  2631. {
  2632. Kick(playerid);
  2633. }
  2634.  
  2635. public ProxDetector(Float:radi, playerid, string[], col1, col2, col3, col4, col5)
  2636. {
  2637. if(IsPlayerConnected(playerid))
  2638. {
  2639. new Float:posx, Float:posy, Float:posz;
  2640. new Float:oldposx, Float:oldposy, Float:oldposz;
  2641. new Float:tempposx, Float:tempposy, Float:tempposz;
  2642. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  2643. for(new i = 0; i < MAX_PLAYERS; i++)
  2644. {
  2645. if(IsPlayerConnected(i))
  2646. {
  2647. //if(!BigEar[i])
  2648. //{
  2649. if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
  2650. {
  2651. GetPlayerPos(i, posx, posy, posz);
  2652. tempposx = (oldposx -posx);
  2653. tempposy = (oldposy -posy);
  2654. tempposz = (oldposz -posz);
  2655. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  2656. {
  2657. SendClientMessage(i, col1, string);
  2658. }
  2659. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  2660. {
  2661. SendClientMessage(i, col2, string);
  2662. }
  2663. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  2664. {
  2665. SendClientMessage(i, col3, string);
  2666. }
  2667. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  2668. {
  2669. SendClientMessage(i, col4, string);
  2670. }
  2671. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  2672. {
  2673. SendClientMessage(i, col5, string);
  2674. }
  2675. }
  2676. else
  2677. {
  2678. SendClientMessage(i, col1, string);
  2679. }
  2680. }
  2681. }
  2682. }
  2683. return 0;
  2684. }
  2685.  
  2686. public ClockUpdate()
  2687. {
  2688. new hour, minutes, seconds, day, month, year;
  2689. new string[256];
  2690. gettime(hour, minutes, seconds);
  2691. getdate(year, month, day);
  2692. format(string,256,"%02d:%02d", hour, minutes);
  2693. TextDrawSetString(ClockTime, string);
  2694. format(string,256,"%02d/%02d/%d", day, month, year);
  2695. TextDrawSetString(ClockDate, string);
  2696. }
  2697.  
  2698. public MoneyTimer()
  2699. {
  2700. new pName[MAX_PLAYER_NAME];
  2701. for(new i=0; i<MAX_PLAYERS; i++)
  2702. {
  2703. if(IsPlayerConnected(i))
  2704. {
  2705. if(GetPlayerCash(i) != GetPlayerMoney(i))
  2706. {
  2707. ResetMoneyBar(i);
  2708. UpdateMoneyBar(i, GetPlayerCash(i));
  2709. new hack = GetPlayerMoney(i) - GetPlayerCash(i);
  2710. GetPlayerName(i, pName, sizeof(pName));
  2711. printf("%s has picked up/attempted to spawn $%d.", pName, hack);
  2712. }
  2713. }
  2714. }
  2715. }
  2716.  
  2717. public OtherTimers()
  2718. {
  2719. for(new i = 0; i < MAX_PLAYERS; i ++)
  2720. {
  2721. if(TutorialTime[i] >= 1)
  2722. {
  2723. TutorialTime[i] += 1;
  2724. if(TutorialTime[i] == 3)
  2725. {
  2726. SendClientMessage(i, COLOR_WHITE, "Edit Here");
  2727. }
  2728. else if(TutorialTime[i] == 5)
  2729. {
  2730. SendClientMessage(i, COLOR_WHITE, "Edit Here");
  2731.  
  2732. TutorialTime[i] = 0; PlayerInfo[i][pTutorial] = 1;
  2733. Update(i, pTutorialu);
  2734.  
  2735. PlayerInfo[i][pLevel] = 1;
  2736. Update(i, pLevelu);
  2737. PlayerInfo[i][pRegistred] = 1;
  2738. Update(i, pRegistredu);
  2739. PlayerInfo[i][pAdmin] = 0;
  2740. Update(i, pAdminu);
  2741.  
  2742. new randomphonenumber = 1000000 + random(9999999);
  2743. PlayerInfo[i][pPhoneNumber] = randomphonenumber;
  2744. Update(i, pPhoneNumberu);
  2745.  
  2746. PlayerInfo[i][pInterior] = 0;
  2747.  
  2748. SetSpawnInfo(i, 0, 0, 1742.9515, -1862.3721, 13.5764, 359.5591, 0, 0, 0, 0, 0, 0);
  2749. SpawnPlayer(i);
  2750.  
  2751. new pName[MAX_PLAYER_NAME];
  2752. GetPlayerName(i, pName, sizeof(pName));
  2753.  
  2754. new query[128];
  2755. mysql_format(handle, query, sizeof(query), "SELECT * FROM `players` WHERE `username`='%e'", pName);
  2756. mysql_tquery(handle, query, "WhenPlayerLogin", "i", i);
  2757.  
  2758. }
  2759. }
  2760.  
  2761. if(ReportTime[i] > 0)
  2762. {
  2763. ReportTime[i]--;
  2764. }
  2765. }
  2766. }
  2767.  
  2768. public ReportTimer(playerid)
  2769. {
  2770. ReportTime[playerid] = 0;
  2771. }
  2772.  
  2773. public AdminsBroadCast(color, string[])
  2774. {
  2775. for(new i = 0; i < MAX_PLAYERS; i++)
  2776. {
  2777. if(IsPlayerConnected(i))
  2778. {
  2779. if(PlayerInfo[i][pAdmin] >= 1)
  2780. {
  2781. SendClientMessage(i, color, string);
  2782. }
  2783. }
  2784. }
  2785. return 1;
  2786. }
  2787.  
  2788. public HelpersBroadCast(color, string[])
  2789. {
  2790. for(new i = 0; i < MAX_PLAYERS; i++)
  2791. {
  2792. if(IsPlayerConnected(i))
  2793. {
  2794. if(PlayerInfo[i][pHelper] >= 1)
  2795. {
  2796. SendClientMessage(i, color, string);
  2797. }
  2798. }
  2799. }
  2800. return 1;
  2801. }
  2802.  
  2803. public FactionsBroadCast(faction, color, string[])
  2804. {
  2805. for(new i = 0; i < MAX_PLAYERS; i++)
  2806. {
  2807. if(IsPlayerConnected(i))
  2808. {
  2809. if(PlayerInfo[i][pMember] == faction || PlayerInfo[i][pLeader] == faction)
  2810. {
  2811. SendClientMessage(i, color, string);
  2812. }
  2813. }
  2814. }
  2815. }
  2816.  
  2817. public RadioBroadCast(faction, color, string[])
  2818. {
  2819. for(new i = 0; i < MAX_PLAYERS; i++)
  2820. {
  2821. if(IsPlayerConnected(i))
  2822. {
  2823. if(PlayerInfo[i][pMember] == faction || PlayerInfo[i][pLeader] == faction)
  2824. {
  2825. SendClientMessage(i, color, string);
  2826. }
  2827. }
  2828. }
  2829. }
  2830.  
  2831. public SetPlayerFactionColor(playerid)
  2832. {
  2833. if(IsPlayerConnected(playerid))
  2834. {
  2835. SetPlayerColor(playerid, COLOR_WHITE);
  2836. if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
  2837. SetPlayerColor(playerid,COLOR_LSPD);
  2838.  
  2839. if (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
  2840. SetPlayerColor(playerid,COLOR_LVPD);
  2841.  
  2842. if (PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
  2843. SetPlayerColor(playerid,COLOR_SFPD);
  2844.  
  2845. if (PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
  2846. SetPlayerColor(playerid,COLOR_FBI);
  2847.  
  2848. if (PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
  2849. SetPlayerColor(playerid,COLOR_NG);
  2850.  
  2851. if (PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
  2852. SetPlayerColor(playerid,COLOR_PARAMEDICS);
  2853. }
  2854. }
  2855.  
  2856. stock KickWithMessage(playerid, color, message[])
  2857. {
  2858. SendClientMessage(playerid, color, message);
  2859. SetTimerEx("KickPublic", 1000, 0, "d", playerid);
  2860. }
  2861.  
  2862. stock GivePlayerCash(playerid, money)
  2863. {
  2864. Cash[playerid] += money;
  2865. ResetMoneyBar(playerid);
  2866. UpdateMoneyBar(playerid, Cash[playerid]);
  2867. PlayerInfo[playerid][pCash] = Cash[playerid];
  2868. Update(playerid, pCashu);
  2869.  
  2870. return Cash[playerid];
  2871. }
  2872.  
  2873. stock SetPlayerCash(playerid, money)
  2874. {
  2875. Cash[playerid] = money;
  2876. ResetMoneyBar(playerid);
  2877. UpdateMoneyBar(playerid, Cash[playerid]);
  2878. PlayerInfo[playerid][pCash] = Cash[playerid];
  2879. Update(playerid, pCashu);
  2880.  
  2881. return Cash[playerid];
  2882. }
  2883.  
  2884. stock ResetPlayerCash(playerid)
  2885. {
  2886. Cash[playerid] = 0;
  2887. ResetMoneyBar(playerid);
  2888. UpdateMoneyBar(playerid, Cash[playerid]);
  2889. PlayerInfo[playerid][pCash] = Cash[playerid];
  2890. Update(playerid, pCashx);
  2891.  
  2892. return Cash[playerid];
  2893. }
  2894.  
  2895. stock GetPlayerCash(playerid)
  2896. {
  2897. return Cash[playerid];
  2898. }
Add Comment
Please, Sign In to add comment