Guest User

Admin System FilterScript

a guest
Oct 4th, 2012
1,999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.47 KB | None | 0 0
  1. /* Administrator Filterscript: Fostering your administrative needs
  2. * Created by ~Pawno~
  3. * Edited and fixed (Bugs + Text) by Jake/Syntax/Dooks
  4.  
  5. As a holder of this script, we do not ask that your retain the original author's rights, as we understand that nobody ever listens.
  6. However, we ask that you please do not re-release the script under your name. Should you wish to release the script
  7. if it has been edited or re-written, please ask ~Pawno or Syntax beforehand.
  8. */
  9.  
  10. #define FILTERSCRIPT
  11.  
  12. ////////////////////
  13. // INCLUDES ////////
  14. ////////////////////
  15.  
  16. #include <a_samp>
  17. #include <sscanf2>
  18. #include <YSI\y_ini>
  19. #include <YSI\y_commands>
  20. #include <YSI\y_master>
  21. #include <cardefines>
  22. #include <strtok>
  23. #pragma tabsize 0
  24.  
  25. ////////////////////
  26. // DIALOG DEFINES //
  27. ////////////////////
  28. #define DIALOG_REGISTER 1
  29. #define DIALOG_LOGIN 2
  30. #define DIALOG_SUCCESS_1 3
  31. #define DIALOG_SUCCESS_2 4
  32.  
  33. ////////////////////
  34. // OTHER DEFINES ///
  35. ////////////////////
  36. #define PATH "/aAdmin/Users/%s.ini"
  37.  
  38. ////////////////////
  39. // COLOUR DEFINES//
  40. ////////////////////
  41.  
  42. #define COL_WHITE 0xFFFFFFFF
  43.  
  44. #define COL_GREY "{C3C3C3}"
  45. #define COL_GREY2 0xC0C0C0AA
  46. #define COL_GREY3 0xD8D8D8FF
  47.  
  48. #define COL_CYAN "{00FFEE}"
  49. #define COL_PINK "{FFFF00}"
  50. #define COL_PINK2 0xFF66FFAA
  51.  
  52. #define COL_RED "{FF0000}"
  53. #define COL_RED2 "{FF0000}"
  54. #define COL_RED3 0xFF0000FF
  55.  
  56. #define COL_YELLOWEMBED "{CCCCCC}"
  57.  
  58.  
  59.  
  60. #define COL_GREEN 0x21DD00FF
  61. #define COL_PURPLE 0xB360FDFF
  62. #define COL_BLUE 0x2641FEAA
  63. #define COL_BLACK 0x000000FF
  64. #define COL_ORANGE 0xFF830000
  65. #define COL_YELLOW 0xF5DEB3AA
  66. #define COL_LIGHTBLUE 0x00C2ECFF
  67.  
  68. //////////////////////////////
  69. // PLAYER POSITION DEFINES //
  70. //////////////////////////////
  71.  
  72. enum PlayerPosition // Primarily here for the use of "/s" and "/r".
  73. {
  74. Float:XPos,
  75. Float:YPos,
  76. Float:ZPos,
  77. Float:PAngle,
  78. SavedPosition
  79. }
  80.  
  81. ///////////////////////
  82. // PLAYER VARIABLES //
  83. ///////////////////////
  84.  
  85. enum pInfo
  86. {
  87. aPass,
  88. aCash,
  89. aAdmin,
  90. aKills,
  91. aDeaths,
  92. aBanned,
  93. aSpawnVehicle,
  94. HasVehicleSpawned,
  95. CarFix,
  96. Heal,
  97. bool:aCanSpawnVehicle
  98. }
  99.  
  100. ////////////////////////////
  101. // MISCELLANEOUS DEFINES //
  102. ////////////////////////////
  103.  
  104. new pName[MAX_PLAYER_NAME];
  105. new IsPlayerAway[MAX_PLAYERS];
  106. new PPosition[MAX_PLAYERS][PlayerPosition];
  107. new PlayerInfo[MAX_PLAYERS][pInfo];
  108. new PMEnabled[MAX_PLAYER_NAME];
  109. new Float:pX, Float:pY, Float:pZ, Float:pAngle;
  110.  
  111. new VehicleNames[212][] = {
  112. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
  113. {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  114. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
  115. {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  116. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
  117. {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  118. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
  119. {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  120. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  121. {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  122. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
  123. {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  124. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
  125. {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  126. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
  127. {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  128. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
  129. {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  130. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
  131. {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  132. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
  133. {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  134. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
  135. {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  136. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
  137. {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  138. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
  139. {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
  140. {"Utility Trailer"}};
  141.  
  142. ///////////////////////////
  143. // USERNAMES (user.ini) //
  144. ///////////////////////////
  145.  
  146. public LoadUser_data(playerid,name[],value[])
  147. {
  148. INI_Int("aPassword",PlayerInfo[playerid][aPass]);
  149. INI_Int("aCash",PlayerInfo[playerid][aCash]);
  150. INI_Int("aAdmin",PlayerInfo[playerid][aAdmin]);
  151. INI_Int("aKills",PlayerInfo[playerid][aKills]);
  152. INI_Int("aDeaths",PlayerInfo[playerid][aDeaths]);
  153. INI_Int("aBanned",PlayerInfo[playerid][aBanned]);
  154. return 1;
  155. }
  156.  
  157. ////////////////////
  158. // FORWARDS ///////
  159. ////////////////////
  160. forward LoadUser_data(playerid,name[],value[]);
  161. forward MessageToAdmins(color,const string[]);
  162. forward RandomMessages();
  163. forward GodUpdate();
  164. forward GetVehicleModelIDFromName(vname[]);
  165. forward SendMessageToAdmins(color,const string[]);
  166.  
  167. ////////////////////////////
  168. // STOCKS & MISC PUBLICS //
  169. ////////////////////////////
  170.  
  171. public MessageToAdmins(color,const string[])
  172. {
  173. for(new i = 0; i < MAX_PLAYERS; i++)
  174. {
  175. if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][aAdmin] > 1) SendClientMessage(i, color, string);
  176. }
  177. return 1;
  178. }
  179.  
  180. stock UserPath(playerid)
  181. {
  182. new string[128],uPlayername[MAX_PLAYER_NAME];
  183. GetPlayerName(playerid,uPlayername,sizeof(uPlayername));
  184. format(string,sizeof(string),PATH,uPlayername);
  185. return string;
  186. }
  187.  
  188. stock pName3(playerid)
  189. {
  190. new name[MAX_PLAYER_NAME];
  191. GetPlayerName(playerid, name, sizeof(name));
  192. return name;
  193. }
  194.  
  195. stock PlayerName(playerid)
  196. {
  197. new pName[25];
  198. GetPlayerName(playerid, pName, sizeof(pName));
  199. return pName;
  200. }
  201.  
  202. stock PlayerName2(playerid) {
  203. new name[MAX_PLAYER_NAME];
  204. GetPlayerName(playerid, name, sizeof(name));
  205. return name;
  206. }
  207.  
  208. stock IsNumeric(string[])
  209. {
  210. for (new i = 0, j = strlen(string); i < j; i++)
  211. {
  212. if (string[i] > '9' || string[i] < '0') return 0;
  213. }
  214. return 1;
  215. }
  216.  
  217. stock ReturnPlayerID(PlayerName[])
  218. {
  219. for(new i = 0; i < MAX_PLAYERS; i++)
  220. {
  221. if(IsPlayerConnected(i))
  222. {
  223. if(strfind(pName3(i),PlayerName,true)!=-1) return i;
  224. }
  225. }
  226. return INVALID_PLAYER_ID;
  227. }
  228.  
  229. ////////////////////
  230. // WHIRLPOOL //////
  231. ////////////////////
  232. stock udb_hash(buf[]) {
  233. new length=strlen(buf);
  234. new s1 = 1;
  235. new s2 = 0;
  236. new n;
  237. for (n=0; n<length; n++)
  238. {
  239. s1 = (s1 + buf[n]) % 65521;
  240. s2 = (s2 + s1) % 65521;
  241. }
  242. return (s2 << 16) + s1;
  243. }
  244.  
  245. //////////////////////////////
  246. // FILTERSCRIPT INITIATION //
  247. /////////////////////////////
  248.  
  249. public OnFilterScriptInit()
  250. {
  251. print(" ");
  252. print("Administration Filterscript:");
  253. print("Created by ~Pawno, assisted by Jake");
  254. print(" ");
  255. SetTimer("ChangeHostName",5000,1);
  256. SetTimer("RandomMessages", 30000,1);
  257. return 1;
  258. }
  259.  
  260. public OnPlayerConnect(playerid)
  261. {
  262. // For player positions and private messages
  263. PPosition[playerid][SavedPosition] = 0;
  264. PlayerInfo[playerid][CarFix] = 0;
  265. PlayerInfo[playerid][Heal] = 0;
  266. PMEnabled[playerid] = 1;
  267. //register & login dialog
  268. if(fexist(UserPath(playerid)))
  269. {
  270. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  271. if(PlayerInfo[playerid][aBanned] == 1) return SendClientMessage(playerid, -1, ""COL_GREY"You are "COL_PINK"banned {FFFFFF}from the server.");
  272. if(PlayerInfo[playerid][aBanned] == 1) return Ban(playerid);
  273. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_CYAN"Login","{FFFFFF}Type your password below to login:","Login"," ");
  274. }
  275. else
  276. {
  277. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_CYAN"Registration","{FFFFFF}Type your password below to register a new account:","Register"," ");
  278. }
  279. // Admin colour for level 1 administrators
  280. if(PlayerInfo[playerid][aAdmin] > 1)
  281. {
  282. SetPlayerColor(playerid, 0x00FFEEEE); // CYAN
  283. }
  284. return 1;
  285. }
  286.  
  287. // Random script messages
  288. new randomMessages[][] =
  289. {
  290. // It's easy to add more lines, just remember to add a comma (,) at the end of each line, but not the last one.
  291. ""#COL_PINK"[SERVER] {FFFFFF}If you need any help type /help or ask an admin!",
  292. ""#COL_PINK"[SERVER]{FFFFFF} Be sure to register on our forums at http://URL.com", // Be sure to edt this appropriately to your forum or website!
  293. ""#COL_PINK"[SERVER]{FFFFFF} Did you know, you can spawn a car by typing /car [name] instead!",
  294. ""#COL_PINK"[SERVER]{FFFFFF} Please ensure that you abide by all of the rules",
  295. ""#COL_PINK"[SERVER]{FFFFFF} Did you know, there are 52 states in all of the United States of America?",
  296. ""#COL_PINK"[SERVER]{FFFFFF} Please do not spam the game chat: doing so may result in a temporary ban, kick or mute!",
  297. ""#COL_PINK"[SERVER]{FFFFFF} Welcome to SERVER NAME" // Be sure to edit this to your server/community name!
  298. // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!", // Incase you wish to add some more in!
  299. // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
  300. // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
  301. // ""#COL_PINK"[SERVER]{FFFFFF} Meeeow!",
  302. // ""#COL_PINK"[SERVER]{FFFFFF} MEeeow!" // Just a random one
  303. };
  304.  
  305. public RandomMessages()
  306. {
  307. new randomMsg = random(sizeof(randomMessages));
  308. SendClientMessageToAll(-1, randomMessages[randomMsg]);
  309. }
  310.  
  311. public OnPlayerDisconnect(playerid, reason)
  312. {
  313. // SAVING user data:
  314. new INI:File = INI_Open(UserPath(playerid));
  315. INI_SetTag(File,"data");
  316. INI_WriteInt(File,"aCash",GetPlayerMoney(playerid));
  317. INI_WriteInt(File,"aAdmin",PlayerInfo[playerid][aAdmin]);
  318. INI_WriteInt(File,"aKills",PlayerInfo[playerid][aKills]);
  319. INI_WriteInt(File,"aDeaths",PlayerInfo[playerid][aDeaths]);
  320. INI_WriteInt(File,"aBanned",PlayerInfo[playerid][aBanned]);
  321. INI_Close(File);
  322. return 1;
  323. }
  324.  
  325.  
  326. // Admin Message: Leached from LAdmin, credits to original author.
  327. public SendMessageToAdmins(color,const string[])
  328. {
  329. for(new i = 0; i < MAX_PLAYERS; i++)
  330. {
  331. if(IsPlayerConnected(i) == 1)
  332. if(PlayerInfo[i][aAdmin] > 1)
  333. SendClientMessage(i, color, string);
  334. }
  335. return 1;
  336. }
  337.  
  338. public OnPlayerDeath(playerid, killerid, reason)
  339. {
  340. // Updates the killers total kills and the victims total deaths!
  341. PlayerInfo[killerid][aKills]++;
  342. PlayerInfo[playerid][aDeaths]++;
  343. return 1;
  344. }
  345.  
  346. // Primarily for administrative messages:
  347.  
  348. public OnPlayerText(playerid, text[])
  349. {
  350. if(text[0] == '#' && PlayerInfo[playerid][aAdmin] > 1) {
  351. new string[128]; GetPlayerName(playerid,string,sizeof(string));
  352. format(string,sizeof(string),""#COL_PINK"Sig:{FFFFFF} %s "#COL_PINK": %s",string,text[1]); MessageToAdmins(-1,string);
  353. return 0;
  354. }
  355. return 1;
  356. }
  357.  
  358. // For /GOD and /GODCAR commands.
  359. public GodUpdate()
  360. {
  361. for(new i = 0; i < MAX_PLAYERS; i++)
  362. {
  363. if(IsPlayerConnected(i) && PlayerInfo[i][Heal] == 1)
  364. {
  365. SetPlayerHealth(i,100000);
  366. }
  367. if(IsPlayerConnected(i) && PlayerInfo[i][CarFix] == 1 && IsPlayerInAnyVehicle(i))
  368. {
  369. RepairVehicle(GetPlayerVehicleID(i));
  370. }
  371. }
  372. }
  373.  
  374. //////////////////////
  375. // COMMANDS BEGIN ////
  376. //////////////////////
  377. YCMD:acmds(playerid,params[], help)
  378. {
  379. if(PlayerInfo[playerid][aAdmin] > 1)
  380. {
  381. SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /promote - /kick - /ban");
  382. SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /respawncars - /spam - /cardel - /goto");
  383. SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} /admins - # (Admin chat)");
  384. return 1;
  385. }
  386. else SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF} You have to be an admin to use /acmds!");
  387. return 1;
  388. }
  389.  
  390. YCMD:afk(playerid, params[], help)
  391. {
  392. new string[48];
  393. GetPlayerName(playerid, pName, sizeof(pName));
  394. format(string, sizeof(string), "%s is now AFK (Away from Keyboard).", pName);
  395. SendClientMessageToAll(COL_GREY2, string);
  396. SetPlayerFacingAngle(playerid,0);
  397. TogglePlayerControllable(playerid, 0);
  398. IsPlayerAway[playerid] = 1;
  399. return 1;
  400. }
  401.  
  402. YCMD:back(playerid, params[], help)
  403. {
  404. new string[48];
  405. GetPlayerName(playerid, pName, sizeof(pName));
  406. format(string, sizeof(string), "%s has returned.", pName);
  407. SendClientMessageToAll(COL_GREY2, string);
  408. SetPlayerFacingAngle(playerid, 264.3768);
  409. TogglePlayerControllable(playerid, 1);
  410. IsPlayerAway[playerid] = 0;
  411. return 1;
  412. }
  413.  
  414. YCMD:pj1(playerid, params[], help)
  415. {
  416. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
  417. ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),0);
  418. return 1;
  419. }
  420.  
  421. YCMD:pj2(playerid, params[], help)
  422. {
  423. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
  424. ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),1);
  425. return 1;
  426. }
  427.  
  428. YCMD:pj3(playerid, params[], help)
  429. {
  430. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
  431. ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),2);
  432. return 1;
  433. }
  434.  
  435. YCMD:pj4(playerid, params[], help)
  436. {
  437. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You have to be in a vehicle");
  438. ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),3);
  439. return 1;
  440. }
  441.  
  442. YCMD:god(playerid, params[], help)
  443. {
  444. if(PlayerInfo[playerid][Heal] == 0)
  445. {
  446. PlayerInfo[playerid][Heal] = 1;
  447. SetPlayerHealth(playerid,100000); // Sets your health to 100,000!
  448. SendClientMessage(playerid,-1,"{FFFFFF}You have enabled Godmode! To go off God mode, type: "#COL_PINK"/god.");
  449. }
  450. else
  451. {
  452. PlayerInfo[playerid][Heal] = 0;
  453. SendClientMessage(playerid,-1,"{FFFFFF}You have disabled Godmode! To go back on to God mode, type: "#COL_PINK"/god{FFFFFF}.");
  454. SetPlayerHealth(playerid, 100);
  455. }
  456. return 1;
  457. }
  458.  
  459. YCMD:godcar(playerid, params[], help)
  460. {
  461. if(IsPlayerInAnyVehicle(playerid))
  462. {
  463. if(PlayerInfo[playerid][CarFix] == 0)
  464. {
  465. PlayerInfo[playerid][CarFix] = 1;
  466. return SendClientMessage(playerid,-1,"{FFFFFF}Godcar turned on,to turn off type "#COL_PINK"/godcar{FFFFFF} again.");
  467. }
  468. else
  469. {
  470. PlayerInfo[playerid][CarFix] = 0;
  471. return SendClientMessage(playerid,-1,"{FFFFFF}Godcar turned off,to turn on again type "#COL_PINK"/godcar");
  472. }
  473. }
  474. else
  475. return SendClientMessage(playerid,-1,""#COL_PINK"ERROR:{FFFFFF} You need to be in a car to use this command");
  476. }
  477.  
  478. YCMD:skin(playerid, params[], help) // Un-tested!
  479. {
  480. new id;
  481. if(sscanf(params,"i",id)) return SendClientMessage(playerid,COL_RED3,""#COL_PINK"[SERVER]{FFFFFF}Command: /skin id");
  482. if(id<0 || id>299) return SendClientMessage(playerid,COL_RED3,""#COL_PINK"[SERVER]{FFFFFF}Please use IDs from 0 to 299");
  483. SetPlayerSkin(playerid,id);
  484. new msg[50];
  485. format(msg,sizeof(msg),""#COL_PINK"[SERVER]{FFFFFF}Your skin has been set to ID %d",id);
  486. return SendClientMessage(playerid,-1,msg);
  487. }
  488.  
  489. YCMD:fr(playerid, params[], help)
  490. {
  491. new vehicleid=GetPlayerVehicleID(playerid);
  492. RepairVehicle(vehicleid);
  493. SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Your Vehicle has been fixed!");
  494. return 1;
  495. }
  496.  
  497. YCMD:flip(playerid, params[], help)
  498. {
  499. if(IsPlayerInAnyVehicle(playerid))
  500. {
  501. new currentveh;
  502. new Float:angle;
  503. currentveh = GetPlayerVehicleID(playerid);
  504. GetVehicleZAngle(currentveh, angle);
  505. SetVehicleZAngle(currentveh, angle);
  506. SendClientMessage(playerid, -1, "{FFFFFF}Your vehicle has been flipped.");
  507. return 1;
  508. }
  509. else
  510. {
  511. SendClientMessage(playerid, -1, "{FFFFFF}You are not in any vehicle!");
  512. return 1;
  513. }
  514. }
  515. //=======================================================================================================
  516. YCMD:me(playerid, params[], help)
  517. {
  518. if(!params[2])return SendClientMessage(playerid, -1, "{FFFFFF}Command: /me [action]");
  519. new str[128];
  520. GetPlayerName(playerid, str, sizeof(str));
  521. format(str, sizeof(str), "* %s %s", str, params[0]);
  522. SendClientMessageToAll(COL_YELLOW, str);
  523. return 1;
  524. }
  525.  
  526. YCMD:cc(playerid, params[], help) // To change the colour of your vehicle.
  527. {
  528. if(IsPlayerInAnyVehicle(playerid))
  529. {
  530. new tmp[128], idx;
  531. new color1, color2;
  532. tmp = strtok(params, idx);
  533. if(!strlen(tmp)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/cc (color1) (color2)");
  534. color1 = strval(tmp);
  535. tmp = strtok(params, idx);
  536. if(!strlen(tmp)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/cc (color1) (color2)");
  537. color2 = strval(tmp);
  538. ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
  539. }
  540. else
  541. {
  542. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}You are not in a vehicle!");
  543. }
  544. return 1;
  545. }
  546.  
  547. YCMD:s(playerid, params[], help) // Saves your current position incase you wish to relog.
  548. {
  549. new Float:x,Float:y,Float:z,Float:angle;
  550. if(IsPlayerInAnyVehicle(playerid))
  551. {
  552. GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
  553. GetVehicleZAngle(GetPlayerVehicleID(playerid),angle);
  554. PPosition[playerid][XPos] = x;
  555. PPosition[playerid][YPos] = y;
  556. PPosition[playerid][ZPos] = z;
  557. PPosition[playerid][PAngle] = angle;
  558. SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position saved! Type "#COL_PINK"/r {FFFFFF}to teleport back!");
  559. }
  560. else
  561. {
  562. GetPlayerPos(playerid,x,y,z);
  563. GetPlayerFacingAngle(playerid,angle);
  564. PPosition[playerid][XPos] = x;
  565. PPosition[playerid][YPos] = y;
  566. PPosition[playerid][ZPos] = z;
  567. PPosition[playerid][PAngle] = angle;
  568. SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position saved! Type "#COL_PINK"/r {FFFFFF}to teleport back!");
  569. }
  570. PPosition[playerid][SavedPosition] = 1;
  571. return 1;
  572. }
  573.  
  574. YCMD:r(playerid, params[], help) // Warps you to your previously saved position (/s)
  575. {
  576. if(PPosition[playerid][SavedPosition] == 0) return SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}You don't have any position saved! "#COL_PINK"(/s)");
  577. if(IsPlayerInAnyVehicle(playerid))
  578. {
  579. SetVehiclePos(GetPlayerVehicleID(playerid),PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);
  580. SetVehicleZAngle(GetPlayerVehicleID(playerid),PPosition[playerid][PAngle]);
  581. SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position loaded!");
  582. }
  583. else
  584. {
  585. SetPlayerPos(playerid,PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);
  586. SetPlayerFacingAngle(playerid,PPosition[playerid][PAngle]);
  587. SendClientMessage(playerid,-1, ""#COL_PINK"[SERVER] {FFFFFF}Position loaded!");
  588. }
  589. return 1;
  590. }
  591.  
  592. YCMD:admins(playerid, params[], help)
  593. {
  594.  
  595. new Count[2], i, string[128];
  596. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
  597. {
  598. if(PlayerInfo[i][aAdmin] > 0) Count[0]++;
  599. if(IsPlayerAdmin(i)) Count[1]++;
  600. }
  601.  
  602. if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][aAdmin] == 0) ) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF}No admins available at this moment.");
  603.  
  604. if(Count[0] == 1) {
  605. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][aAdmin] > 0) {
  606. format(string, sizeof(string), "{FFFFFF}Admin:"COL_CYAN" (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][aAdmin] ); SendClientMessage(playerid, COL_GREY2, string);
  607. }
  608. }
  609.  
  610. if(Count[0] > 1) {
  611. new x; format(string, sizeof(string), ""#COL_PINK"Admins:{FFFFFF} ");
  612. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][aAdmin] > 0)
  613. {
  614. format(string,sizeof(string),"{FFFFFF}%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][aAdmin]);
  615. x++;
  616. if(x > 5) {
  617. SendClientMessage(playerid, COL_GREY2, string); format(string, sizeof(string), ""#COL_PINK"Admins:{FFFFFF} "); x = 0;
  618. }
  619. else format(string, sizeof(string), "{FFFFFF}%s, ", string);
  620. }
  621. if(x <= 4 && x > 0) {
  622. string[strlen(string)-3] = '.';
  623. SendClientMessage(playerid, COL_GREY2, string);
  624. }
  625. }
  626.  
  627. if( (Count[1] == 1) && (PlayerInfo[playerid][aAdmin] > 0) ) {
  628. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
  629. format(string, sizeof(string), ""#COL_PINK"RCON Admin: {FFFFFF}(%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COL_WHITE, string);
  630. }
  631. }
  632. if(Count[1] > 1) {
  633. new x; format(string, sizeof(string), ""#COL_PINK"RCON Admins:{FFFFFF} ");
  634. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
  635. {
  636. format(string,sizeof(string),"{FFFFFF}%s(%d)%s",string,i,PlayerName2(i));
  637. x++;
  638. if(x > 5) {
  639. SendClientMessage(playerid, COL_WHITE, string); format(string, sizeof(string), ""#COL_PINK"RCON Admins:{FFFFFF} "); x = 0;
  640. }
  641. else format(string, sizeof(string), "{FFFFFF}%s, ", string);
  642. }
  643. if(x < 4 && x > 0) {
  644. string[strlen(string)-3] = '.';
  645. SendClientMessage(playerid, COL_WHITE, string);
  646. }
  647. }
  648. return 1;
  649. }
  650.  
  651. YCMD:promote(playerid, params[], help)
  652. {
  653. new id, level;
  654. if(IsPlayerAdmin(playerid))
  655. {
  656. if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /promote [playerid/name] [level]");
  657. else
  658. {
  659. if(level > 5) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Only levels 1-5 allowed.");
  660. else
  661. {
  662. PlayerInfo[id][aAdmin] = level;
  663. }
  664. }
  665. }
  666. else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} You must be a member of staff to execute this command.");
  667. return 1;
  668. }
  669.  
  670. YCMD:report(playerid, params[], help)
  671. {
  672.  
  673. new Target;
  674. new Reason[128];
  675. if(!sscanf(params, "us[32]",Target, Reason))
  676. {
  677. if(Target == playerid) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Usage: Cant perform this command on yourself!");
  678. if(!IsPlayerConnected(Target))
  679. return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} The chosen player is not currently connected.");
  680. new tname[MAX_PLAYER_NAME];
  681. new pname[MAX_PLAYER_NAME];
  682. GetPlayerName(Target,tname,sizeof(tname));
  683. GetPlayerName(playerid,pname,sizeof(pname));
  684. new rstring[256];
  685. format(rstring,sizeof(rstring),"* Player %s(%d) reported %s(%d)! (Reason: %s)", pname,playerid,tname,Target,Reason);
  686. SendMessageToAdmins(COL_WHITE,rstring);
  687. }
  688. else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /report [Player ID] [Reason]");
  689. return 1;
  690. }
  691.  
  692. YCMD:t(playerid, params[], help)
  693. {
  694. new hour[24];
  695. new string[128];
  696. if(!strlen(params))
  697. {
  698. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/t [0-24]");
  699. return 1;
  700. }
  701. new hour2 = strval(params);
  702. if(hour2 < 0 || hour2 > 24)
  703. {
  704. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/t [0-24]");
  705. return 1;
  706. }
  707. SetPlayerTime(playerid, hour2, 0);
  708. format(string,sizeof(string), ""#COL_PINK"[SERVER] {FFFFFF}You changed your time!", hour);
  709. SendClientMessage(playerid, -1, string);
  710. return 1;
  711. }
  712.  
  713. YCMD:w(playerid, params[], help)
  714. {
  715. new string[128];
  716. if(!strlen(params))
  717. {
  718. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/w [0-45]");
  719. return 1;
  720. }
  721. new weather = strval(params);
  722. if(weather < 0 || weather > 45)
  723. {
  724. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}/w [0-45]");
  725. return 1;
  726. }
  727. SetPlayerWeather(playerid, weather);
  728. format(string,sizeof(string), ""#COL_PINK"[SERVER] {FFFFFF}You changed your weather to ID:%d!", weather);
  729. SendClientMessage(playerid, -1, string);
  730. return 1;
  731. }
  732.  
  733. YCMD:kick(playerid, params[], help)
  734. {
  735. if(PlayerInfo[playerid][aAdmin] > 2)
  736. {
  737. new PID;
  738. new reason[64];
  739. new str[128];
  740. new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
  741. GetPlayerName(playerid, Adminname, sizeof(Adminname));
  742. GetPlayerName(PID, Playername, sizeof(Playername));
  743. if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /kick [playerid] [reason]");
  744. if(!IsPlayerConnected(PID))
  745. return SendClientMessage(playerid, -1, "{FFFFFF}Player is not connected!");
  746. format(str, sizeof(str), ""#COL_PINK"'%s' {FFFFFF}has been kicked by administrator "#COL_PINK"'%s'. {FFFFFF}Reason: "#COL_PINK"%s ", Playername, Adminname, reason);
  747. SendClientMessageToAll(-1, str);
  748. Kick(PID);
  749. }
  750. else
  751. {
  752. SendClientMessage(playerid, -1, "You have to be level 3 to use that command!");
  753. }
  754. return 1;
  755. }
  756.  
  757. YCMD:ban(playerid, params[], help)
  758. {
  759. if(PlayerInfo[playerid][aAdmin] > 3)
  760. {
  761. new PID;
  762. new reason[64];
  763. new str[128];
  764. new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
  765. GetPlayerName(playerid, Adminname, sizeof(Adminname));
  766. GetPlayerName(PID, Playername, sizeof(Playername));
  767. if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF} Command: /ban [playerid] [reason]");
  768. if(!IsPlayerConnected(PID))
  769. return SendClientMessage(playerid, -1, "{FFFFFF}Player is not connected!");
  770. format(str, sizeof(str), ""#COL_PINK"'%s' {FFFFFF}has been banned by administrator "#COL_PINK"'%s'. {FFFFFF}Reason: "#COL_PINK"%s ", Playername, Adminname, reason);
  771. SendClientMessageToAll(-1, str);
  772. Ban(PID);
  773. }
  774. else
  775. {
  776. SendClientMessage(playerid, -1, "You have to be level 3 to use that command!");
  777. }
  778. return 1;
  779. }
  780.  
  781. YCMD:goto(playerid, params[], help)
  782. {
  783. if(!strlen(params)) return SendClientMessage(playerid,-1,""#COL_PINK"[SERVER]{FFFFFF} /goto [playerid]");
  784. new player1, string[128];
  785. if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
  786. else player1 = strval(params);
  787. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
  788. {
  789. new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
  790. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
  791. if(GetPlayerState(playerid) == 2)
  792. {
  793. SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
  794. LinkVehicleToInterior(GetPlayerVehicleID(playerid),
  795. GetPlayerInterior(player1));
  796. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),
  797. GetPlayerVirtualWorld(player1));
  798. }
  799. else SetPlayerPos(playerid,x+2,y,z);
  800. format(string, sizeof(string), ""#COL_PINK"[SERVER]{FFFFFF}You have teleported to \"%s\"", pName3(player1));
  801. return SendClientMessage(playerid,-1,string);
  802. }
  803. else return SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] {FFFFFF}Player is not connected or is yourself");
  804. }
  805.  
  806. YCMD:pm(playerid, params[], help)
  807. {
  808. if(IsPlayerConnected(playerid))
  809. {
  810. new pID, Message[60],zplayername[MAX_PLAYER_NAME],targetName[MAX_PLAYER_NAME],string[128],string2[128];
  811. if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, 0xAFAFAFAA, "Command: /pm [PlayerID/PlayerName] [Message]");
  812. if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAFAFAFAA, "Invalid Player");
  813. if(PMEnabled[playerid] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "PM Is Disabled");
  814. GetPlayerName(pID, targetName, sizeof(targetName));
  815. GetPlayerName(playerid, zplayername, sizeof(zplayername));
  816. format(string, sizeof(string), "Private Message from %s: %s", zplayername, Message);
  817. format(string2, sizeof(string2), "Private Message sent to %s: %s", targetName, Message);
  818. SendClientMessage(playerid, 0xFFFF00AA, string2);
  819. SendClientMessage(pID, 0xFFFF00AA, string);
  820. }
  821. return 1;
  822. }
  823.  
  824. YCMD:togpm(playerid, params[], help)
  825. {
  826. if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFFF, "Command: /togpm [on/off]");
  827. if(strcmp(params, "on", true ) == 0 )
  828. {
  829. PMEnabled[playerid] = 1;
  830. SendClientMessage(playerid, -1, "{FFFFFF}[SERVER]"#COL_PINK" You have unblocked your Personal Messaging arrival.");
  831. }
  832. else if( strcmp( params, "off", true ) == 0 )
  833. {
  834. PMEnabled[playerid] = 0;
  835. SendClientMessage(playerid, 0xAA3333AA, "{FFFFFF}[SERVER]"#COL_PINK" You have blocked Personal Messages from arriving.");
  836. }
  837. else SendClientMessage(playerid, -1,"{FFFFFF}[SERVER]"#COL_PINK" Command: /togpm [on/off]");
  838. return 1;
  839. }
  840.  
  841. YCMD:car(playerid, params[], help)
  842. {
  843. new Vehicle[32], VehicleID, ColorOne, ColorTwo;
  844. PlayerInfo[playerid][aCanSpawnVehicle] = true;
  845. if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
  846. {
  847. PlayerInfo[playerid][aCanSpawnVehicle] = true;
  848. SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF}/car [name/id] [colour 1] [colour 2]");
  849. return 1;
  850. }
  851.  
  852. if(PlayerInfo[playerid][aCanSpawnVehicle])
  853. {
  854. VehicleID = GetVehicleModelIDFromName(Vehicle);
  855. if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
  856. VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
  857. VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
  858. VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
  859. VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
  860. VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
  861. VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
  862. VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
  863. VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
  864. /*stuntplane - VehicleID != 513 &&*/ VehicleID != 519 && // hydra - VehicleID != 520 &&
  865. VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
  866. VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
  867. VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
  868. VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
  869. VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
  870. VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
  871. VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
  872. if(VehicleID == -1 )
  873. {
  874. VehicleID = strval(Vehicle);
  875.  
  876. if(VehicleID < 400 || VehicleID > 611 )
  877. {
  878. return SendClientMessage(playerid, -1,""#COL_PINK"[SERVER]{FFFFFF}You entered an invalid vehiclename!");
  879. }
  880. }
  881.  
  882. GetPlayerPos(playerid, pX, pY, pZ);
  883. GetPlayerFacingAngle(playerid, pAngle);
  884.  
  885. DestroyVehicle(PlayerInfo[playerid][aSpawnVehicle]);
  886. PlayerInfo[playerid][aSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
  887. LinkVehicleToInterior(PlayerInfo[playerid][aSpawnVehicle], GetPlayerInterior(playerid));
  888. PutPlayerInVehicle(playerid, PlayerInfo[playerid][aSpawnVehicle], 0);
  889. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER]{FFFFFF}You succesfully spawned this vehicle!");
  890. }
  891. }
  892. return 1;
  893. }
  894.  
  895. YCMD:spam(playerid, params[], help)
  896. {
  897. if(PlayerInfo[playerid][aAdmin] > 1)
  898. {
  899. new Colour, msg[128],string[128];
  900. if(sscanf(params, "is[128]", Colour, msg))
  901. {
  902. SendClientMessage(playerid, -1, ""#COL_PINK"Command: /spam [Colour] [Text]");
  903. SendClientMessage(playerid, -1, "{FFFFFF}Colours: [0]Black, [1]White, [2]Red, [3]Orange, [4]Yellow, [5]Green, [6]Blue, [7]Purple, [8]Brown, [9]Pink");
  904. SendClientMessage(playerid, -1, "{FFFFFF}Function: Will sending the chosen messages in to the chat box with the specified colour.");
  905. return 1;
  906. }
  907. if(Colour > 9) return SendClientMessage(playerid, COL_RED3, "Colours:");
  908. format(string,sizeof(string),"%s",msg);
  909.  
  910. if(Colour == 0) for(new i; i < 50; i++) SendClientMessageToAll(COL_BLACK,string);
  911. else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(COL_WHITE,string);
  912. else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(COL_RED3,string);
  913. else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(COL_ORANGE,string);
  914. else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(COL_YELLOW,string);
  915. else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(COL_GREEN,string);
  916. else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(COL_BLUE,string);
  917. else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(COL_PURPLE,string);
  918. else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(COL_LIGHTBLUE,string);
  919. else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(COL_PINK2,string);
  920. return 1;
  921. }
  922. SendClientMessage(playerid, -1, ""#COL_PINK"[SERVER] "#COL_RED"Fatal Error: You must be a member of staff to execute the given command.");
  923. return 1;
  924. }
  925.  
  926. ////////////////////
  927. // COMMANDS END ////
  928. ////////////////////
  929.  
  930.  
  931. public GetVehicleModelIDFromName(vname[])
  932. {
  933. for(new i = 0; i < 211; i++)
  934. {
  935. if ( strfind(VehicleNames[i], vname, true) != -1 )
  936. return i + 400;
  937. }
  938. return -1;
  939. }
  940.  
  941. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  942. {
  943. switch( dialogid )
  944. {
  945. case DIALOG_REGISTER:
  946. {
  947. if (!response) return Kick(playerid);
  948. if(response)
  949. {
  950. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_CYAN"Account Registration:",""COL_PINK"You have specified an invalid password.\n{FFFFFF}Type a valid password below to register:","Register"," ");
  951. new INI:File = INI_Open(UserPath(playerid));
  952. INI_SetTag(File,"data");
  953. INI_WriteInt(File,"aPassword",udb_hash(inputtext));
  954. INI_WriteInt(File,"aCash",0);
  955. INI_WriteInt(File,"aAdmin",0);
  956. INI_WriteInt(File,"aKills",0);
  957. INI_WriteInt(File,"aDeaths",0);
  958. INI_Close(File);
  959. ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_CYAN"Server Account:","{FFFFFF}Fantastic! You have sucessfully registered.\nWhen you next relog, your statistics will save!","Ok","");
  960. }
  961. }
  962.  
  963. case DIALOG_LOGIN:
  964. {
  965. if ( !response ) return Kick ( playerid );
  966. if( response )
  967. {
  968. if(udb_hash(inputtext) == PlayerInfo[playerid][aPass])
  969. {
  970. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  971. GivePlayerMoney(playerid, PlayerInfo[playerid][aCash]);
  972. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_CYAN"Server Account:","{FFFFFF}You have successfully logged in!","Ok","");
  973. }
  974. else
  975. {
  976. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_CYAN"Account Authorization:",""COL_PINK"You have specified an invalid password.\n{FFFFFF}Type your correct password below to login:","Login"," ");
  977. }
  978. return 1;
  979. }
  980. }
  981. }
  982. return 1;
  983. }
Advertisement
Add Comment
Please, Sign In to add comment