Guest User

Stunt Project v2

a guest
Jun 5th, 2014
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 44.57 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <YSI\y_ini>
  4. #include <sscanf2>
  5.  
  6. native WP_Hash(buffer[],len,const str[]); // Whirlpool native, add it at the top of your script under includes
  7.  
  8. //Colors
  9. #define yellow 0xFFFF00AA
  10. #define red 0xFF0000AA
  11. #define green 0x00FF00AA
  12. #define aqua 0x00FFFFAA
  13. #define white 0xFFFFFFAA
  14. #define COLOR_GREEN           0x33AA33AA
  15. #define COLOR_RED             0xAA3333AA
  16. #define COLOR_YELLOW          0xFFFF00AA
  17. #define COLOR_LIGHTBLUE       0x33CCFFAA
  18. #define COLOR_ORANGE          0xFF9900AA
  19.  
  20. //Others
  21. #define MIN_VEHI_ID     400
  22. #define MAX_VEHI_ID     611
  23. #define VEHI_DIS        5.0
  24.  
  25. //New's
  26. new AFK[MAX_PLAYERS];
  27. new StuntBonus[MAX_PLAYERS];
  28. new God[MAX_PLAYERS];
  29. new Boost[MAX_PLAYERS];
  30. new gPlayerStatus[MAX_PLAYERS];
  31. new aSelNames[1][] = {          // Menu selection names
  32.     {"VehicleSelect"}
  33. };
  34. new curPlayerVehM[MAX_PLAYERS]              = {MIN_VEHI_ID, ...}; // Current Player Vehicle ID
  35. new curPlayerVehI[MAX_PLAYERS]              = {-1, ...};
  36. new Float: savedPos[MAX_PLAYERS][4];
  37. new StuntBonusAll;
  38.  
  39. //Register/Login System
  40. #define dregister 2011 //Defining register dialog so it won't mixed up with the other dialogs
  41. #define dlogin 2012 //Defining login dialog so it won't mixed up with the other dialogs
  42. #define UserPath "Xian/%s.ini" /*Will define user's account path. In this case, we will save it in Scriptfiles/Users. So create a file inside of your Scriptfiles folder called Users*/
  43.  
  44. //Vehicle name
  45. new VehicleNames[][] =
  46. {
  47.     "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
  48.     "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  49.     "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  50.     "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
  51.     "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
  52.     "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  53.     "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  54.     "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  55.     "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
  56.     "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
  57.     "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
  58.     "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
  59.     "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
  60.     "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
  61.     "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
  62.     "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
  63.     "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
  64.     "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  65.     "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  66.     "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
  67.     "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
  68.     "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
  69.     "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  70.     "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
  71.     "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  72.     "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
  73.     "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
  74.     "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  75.     "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  76.     "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  77.     "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
  78.     "Tiller", "Utility Trailer"
  79. };
  80.  
  81. //Random Message
  82. new RandomMSG[][] =
  83. {
  84.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Press 2 to fix your vehicle!",
  85.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Use /v to spawn a car.",
  86.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Use /godmode if you don't want to die",
  87.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Need boost in car? Use /boost now!",
  88.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Always read /rules, obey to the /rules.",
  89.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Check out our /cmds, /teles and /help!",
  90.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Do not ask for admin in chat. This will just reduce your chance.",
  91.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Server Scripted by Xian.",
  92.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Do you know the script contained about 1200 lines?",
  93.     "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Add our server into favorite list! ultra-h.com:5096"
  94. };
  95.  
  96. #if defined FILTERSCRIPT
  97.  
  98. #else
  99.  
  100. main()
  101. {
  102.     print("\n----------------------------------");
  103.     print(" Stunt Project V2 by Xian ");
  104.     print("----------------------------------\n");
  105. }
  106.  
  107. #endif
  108.  
  109. enum PlayerInfo
  110. {
  111.     Pass[129]//User's password
  112.     IP[16],     //User's IP
  113.     Money,      //User's money
  114.     Scores,     //User's scores
  115.     Hours,      //User's hours
  116.     Kills,      //User's kills
  117.     Deaths      //User's deaths
  118. }
  119. new pInfo[MAX_PLAYERS][PlayerInfo]; /*This will create a new variable so we can later use it to saving/loading user's info.*/
  120.  
  121. enum CURVEHICLE {
  122.     bool:spawn,
  123.     vmodel,
  124.     vInt
  125. };
  126. new curServerVehP[MAX_VEHICLES][CURVEHICLE];
  127.  
  128. public OnGameModeInit()
  129. {
  130.     // Don't use these lines if it's a filterscript
  131.     SetGameModeText("Stunt/Freeroam/DM");
  132.     UsePlayerPedAnims();
  133.     EnableStuntBonusForAll(0);
  134.     SetTimer("SendMSG", 300000, true);
  135.     SetTimer("OneHourBonus", 1000*60*60, 1);
  136.     AddPlayerClass(0, 154.3236,-1946.2644,5.1681,1.0536, 0, 0, 0, 0, 0, 0);
  137.     return 1;
  138. }
  139.  
  140. public OnGameModeExit()
  141. {
  142.     print("----------------------------------");
  143.     print("--Stunt Project V2 has unloaded!--");
  144.     print("----------------------------------");
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerRequestClass(playerid, classid)
  149. {
  150.     SetPlayerPos(playerid, 153.9554,-1912.3206,3.7696);
  151.     SetPlayerFacingAngle(playerid,179.8246);
  152.     SetPlayerCameraPos(playerid, 154.3204,-1942.7327,5.0);
  153.     SetPlayerCameraLookAt(playerid,154.1146,-1938.4088,5.0);
  154.     return 1;
  155. }
  156.  
  157. public OnPlayerConnect(playerid)
  158. {
  159.     new name[MAX_PLAYER_NAME], string[128], string2[128];
  160.     GetPlayerName(playerid, name, sizeof(name));
  161.     format(string,sizeof(string), "%s (ID: %d) has joined Stunt Project V2.", name, playerid);
  162.     SendClientMessageToAll(-1, string);
  163.     format(string2,sizeof(string2), "[JOIN]: %s (ID: %d) has joined Stunt Project V2.", name, playerid);
  164.     print(string2);
  165.     SendClientMessage(playerid, white, "{ffff00}StuntProjectV2: {ffffff}(ID: 21) Welcome to Stunt Project V2, read /cmds for more helps!");
  166.    
  167.     GetPlayerName(playerid,name,sizeof(name)); //Get player's name
  168.     if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
  169.     {// then
  170.         INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
  171.         ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
  172.     }
  173.     else //If the connected user is not registered,
  174.     {//then we will 'force' him to register :)
  175.         ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not in our database.\nEnter your own password to create a new account.","Register","Quit");
  176.         return 1;
  177.     }
  178.     return 1;
  179. }
  180.  
  181. public OnPlayerDisconnect(playerid, reason)
  182. {
  183.     new name[MAX_PLAYER_NAME], string[128], string2[128];
  184.     GetPlayerName(playerid,name,sizeof(name));
  185.     format(string,sizeof(string), "%s (ID: %d) has left Stunt Project V2.", name, playerid);
  186.     SendClientMessageToAll(-1, string);
  187.     format(string2,sizeof(string2), "[JOIN]: %s (ID: %d) has left Stunt Project V2.", name, playerid);
  188.     print(string2);
  189.    
  190.     new INI:file = INI_Open(Path(playerid)); //will open their file;
  191.     INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
  192.     INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
  193.     INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
  194.     INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
  195.     INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
  196.     INI_WriteInt(file,"Hours",pInfo[playerid][Hours]);
  197.     INI_Close(file);//Now after we've done saving their data, we now need to close the file
  198.     return 1;
  199. }
  200.  
  201. public OnPlayerSpawn(playerid)
  202. {
  203.     SetPlayerPos(playerid,1956.8210,1343.0056,15.3746);
  204.     return 1;
  205. }
  206.  
  207. public OnPlayerDeath(playerid, killerid, reason)
  208. {
  209.     pInfo[playerid][Deaths]++;
  210.     if(killerid != INVALID_PLAYER_ID)
  211.     {
  212.         pInfo[killerid][Kills]++;
  213.     }
  214.     SendDeathMessage(killerid, playerid, GetPlayerWeapon(killerid));
  215.     SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
  216.     GameTextForPlayer(playerid, "~r~Wasted!", 3000, 0);
  217.     if ( killerid != INVALID_PLAYER_ID ) // Killer exists.
  218.     {
  219.         new szStr[ 128 ];
  220.         new szName[ 2 ][ MAX_PLAYER_NAME ];
  221.  
  222.         GetPlayerName( playerid, szName[ 0 ], MAX_PLAYER_NAME );
  223.         GetPlayerName( killerid, szName[ 1 ], MAX_PLAYER_NAME );
  224.  
  225.         format( szStr, sizeof szStr, "You have been killed by %s.", szName[ 1 ] );
  226.         SendClientMessage( playerid, -1, szStr );
  227.  
  228.         format( szStr, sizeof szStr, "You have killed %s.", szName[ 0 ] );
  229.         SendClientMessage( playerid, -1, szStr );
  230.     }
  231.  
  232.     else // No killer exists.
  233.     {
  234.         SendClientMessage( playerid, -1, "You have died without being killed." );
  235.     }
  236.     return 1;
  237. }
  238.  
  239. public OnVehicleSpawn(vehicleid)
  240. {
  241.     return 1;
  242. }
  243.  
  244. public OnVehicleDeath(vehicleid, killerid)
  245. {
  246.     return 1;
  247. }
  248.  
  249. public OnPlayerText(playerid, text[])
  250. {
  251.     new name[MAX_PLAYER_NAME], msg[256];
  252.     GetPlayerName(playerid, name, sizeof(name));
  253.     format(msg, sizeof(msg), "(ID: %d) {ffffff}%s", playerid, text);
  254.     SendPlayerMessageToAll(playerid, msg);
  255.     return 0;
  256.    
  257.  
  258. }
  259.  
  260. CMD:weapons(playerid,params[])
  261. {
  262.     if(God[playerid] == 0)
  263.     {
  264.         ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "{ff0000}Weapons {ffffff}Selection", "{ff0000}Melee\n{ffff00}Pistol\nShotguns\n{00ffff}Machine Guns\n{00ff00}Assault Rifles\n{f0f0f0}Snipers\n{ff00ff}Explosive\n{fff000}Special\n{f0f0f0}Sex Toys\n{000fff}Heavy Weapons", "Choose", "Exit");
  265.     }
  266.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  267.     return 1;
  268. }
  269.  
  270. CMD:melee(playerid,params[])
  271. {
  272.     if(God[playerid] == 0)
  273.     {
  274.     ShowPlayerDialog(playerid, 889, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection: {00ffff}Melee","Golf Club\nNightstick\nKnife\nBaseball Bat\nShovel\nPool Cue\nKatana\nChainsaw","Choose","Back");
  275.     }
  276.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  277.     return 1;
  278. }
  279.  
  280. CMD:pistols(playerid,params[])
  281. {
  282.     if(God[playerid] == 0)
  283.     {
  284.     ShowPlayerDialog(playerid, 890, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection: {00ffff}Pistols","Colt-45\nSlienced Pistol\nDesert Eagle","Choose","Back");
  285.     }
  286.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  287.     return 1;
  288. }
  289.  
  290. CMD:shotguns(playerid,params[])
  291. {
  292.     if(God[playerid] == 0)
  293.     {
  294.     ShowPlayerDialog(playerid, 891, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Shotguns","Shotgun\nSawn-off Shotgun\nCombat Shotgun","Choose","Back");
  295.     }
  296.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  297.     return 1;
  298. }
  299.  
  300. CMD:machineguns(playerid,params[])
  301. {
  302.     if(God[playerid] == 0)
  303.     {
  304.     ShowPlayerDialog(playerid, 892, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Machine Guns","Micro-SMG(Uzi)\nSMG\nTec-9","Choose","Back");
  305.     }
  306.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  307.     return 1;
  308. }
  309.  
  310. CMD:assaultrifles(playerid,params[])
  311. {
  312.     if(God[playerid] == 0)
  313.     {
  314.     ShowPlayerDialog(playerid, 893, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Assault Rifles","AK-47\nM4","Choose","Back");
  315.     }
  316.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  317.     return 1;
  318. }
  319.  
  320. CMD:snipers(playerid,params[])
  321. {
  322.     if(God[playerid] == 0)
  323.     {
  324.     ShowPlayerDialog(playerid, 894, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Snipers","Country Rifle\nSniper Rifle","Choose","Back");
  325.     }
  326.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  327.     return 1;
  328. }
  329.  
  330. CMD:explosive(playerid,params[])
  331. {
  332.     if(God[playerid] == 0)
  333.     {
  334.     ShowPlayerDialog(playerid, 895, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Explosive","Grenade\nTear Gas\nMolotov Cocktail","Choose","Back");
  335.     }
  336.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  337.     return 1;
  338. }
  339.  
  340. CMD:special(playerid,params[])
  341. {
  342.     if(God[playerid] == 0)
  343.     {
  344.     ShowPlayerDialog(playerid, 896, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Specials","Flower\nCane\nSpray Can\nFire Extinguisher\nCamera\nParachute","Choose","Back");
  345.     }
  346.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  347.     return 1;
  348. }
  349.  
  350. CMD:sextoys(playerid,param[])
  351. {
  352.     if(God[playerid] == 0)
  353.     {
  354.     ShowPlayerDialog(playerid, 897, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Sex Toys","Double-ended Dildo\nDildo\nVibrator\nSliver Vibrator","Choose","Back");
  355.     }
  356.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  357.     return 1;
  358. }
  359.  
  360. CMD:heavyweapon(playerid,params[])
  361. {
  362.     if(God[playerid] == 0)
  363.     {
  364.     ShowPlayerDialog(playerid, 898, DIALOG_STYLE_LIST,"{ff0000}Weapons {ffffff}Selection {00ffff}Heavy Weapon","Rocket Launcher\nHeat Seekers\nFlamethrower\nMinigun\nSatchel Charger","Choose","Back");
  365.     }
  366.     else SendClientMessage(playerid, red, "Turn off your godmode first!");
  367.     return 1;
  368. }
  369.  
  370. CMD:afk(playerid,params[])
  371. {
  372.     if(AFK [playerid] == 0)
  373.     {
  374.         new name[MAX_PLAYER_NAME], string[100];
  375.         AFK[playerid] = 1;
  376.         TogglePlayerControllable(playerid, 0);
  377.         SendClientMessage(playerid, yellow, "Type '/afk' to remove AFK status.");
  378.         GetPlayerName(playerid, name, sizeof(name));
  379.         format(string,sizeof(string),"[/AFK]: Player %s is AFK!", name);
  380.         SendClientMessage(playerid, yellow, string);
  381.     }
  382.     else if(AFK [playerid] == 1)
  383.     {
  384.         new name[MAX_PLAYER_NAME], string[100];
  385.         AFK[playerid] = 0;
  386.         TogglePlayerControllable(playerid, 1);
  387.         SendClientMessage(playerid, yellow, "Type '/afk' to AFK again.");
  388.         GetPlayerName(playerid, name, sizeof(name));
  389.         format(string,sizeof(string),"[/AFK]: Player %s is back!", name);
  390.         SendClientMessage(playerid, yellow, string);
  391.     }
  392.     return 1;
  393. }
  394.  
  395. CMD:stuntbonus(playerid,params[])
  396. {
  397.     if(StuntBonus[playerid] == 0)
  398.     {
  399.         StuntBonus[playerid] = 1;
  400.         EnableStuntBonusForPlayer(playerid, 1);
  401.         SendClientMessage(playerid, yellow, "Stunt bonus has been {ffffff}enabled{ffff00}.");
  402.     }
  403.     else if(StuntBonus[playerid] == 1)
  404.     {
  405.         StuntBonus[playerid] = 0;
  406.         EnableStuntBonusForPlayer(playerid, 0);
  407.         SendClientMessage(playerid, red, "Stunt bonus has been {ffffff}disabled{ff0000}.");
  408.     }
  409.     return 1;
  410. }
  411.  
  412. CMD:godmode(playerid,params[])
  413. {
  414.     if(God[playerid] == 0)
  415.     {
  416.         God[playerid] = 1;
  417.         SetPlayerHealth(playerid, 100000.0);
  418.         ResetPlayerWeapons(playerid);
  419.         SendClientMessage(playerid, white, "Godmode has been {00ffff}enabled{ffffff}!");
  420.     }
  421.     else if(God[playerid] == 1)
  422.     {
  423.         God[playerid] = 0;
  424.         SetPlayerHealth(playerid, 100.0);
  425.         SendClientMessage(playerid, white, "Godmode has been {00ffff}disabled{ffffff}!");
  426.     }
  427.     return 1;
  428. }
  429.  
  430. CMD:boost(playerid,params[])
  431. {
  432.     if(Boost[playerid] == 0)
  433.     {
  434.         Boost[playerid] = 1;
  435.         SendClientMessage(playerid, aqua, "Speedboost and bounce has activated!");
  436.         SendClientMessage(playerid, -1, "Press LMB for speedboost and H/CAPS LOCK for bounce.");
  437.     }
  438.     else if(Boost[playerid] == 1)
  439.     {
  440.         Boost[playerid] = 0;
  441.         SendClientMessage(playerid, red, "Speedboost and bounce has deactivated!");
  442.     }
  443.     return 1;
  444. }
  445.  
  446. CMD:v(playerid,params[])
  447. {
  448.     new
  449.         idx,
  450.         iString[ 128 ];
  451.  
  452.     if ( gPlayerStatus[ playerid ] != 0 )
  453.     {
  454.         format              ( iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] );
  455.         SendClientMessage   ( playerid, COLOR_RED, iString );
  456.  
  457.         return true;
  458.     }
  459.  
  460.     if ( params[ 0 ] == '\0' )  // Same effect as a !strlen check.
  461.         return SendClientMessage( playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME" );
  462.  
  463.     //***************
  464.     // Fix by Mike! *
  465.     //***************
  466.  
  467.     idx = GetVehicleModelIDFromName( params );
  468.  
  469.     if( idx == -1 )
  470.     {
  471.         idx = strval(iString);
  472.  
  473.         if ( idx < MIN_VEHI_ID || idx > MAX_VEHI_ID )
  474.             return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
  475.     }
  476.  
  477.     new
  478.         Float:x,
  479.         Float:y,
  480.         Float:z,
  481.         Float:a;
  482.  
  483.     GetPlayerPos(playerid, x, y, z);
  484.     GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
  485.     GetPlayerFacingAngle(playerid, a);
  486.  
  487.     curPlayerVehM[playerid] = idx;
  488.  
  489.     curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
  490.     LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));
  491.  
  492.     curServerVehP[curPlayerVehI[playerid]][spawn]   = true;
  493.     curServerVehP[curPlayerVehI[playerid]][vmodel]  = idx;
  494.     curServerVehP[curPlayerVehI[playerid]][vInt]    = GetPlayerInterior(playerid);
  495.  
  496.     format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", VehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);
  497.  
  498.     SendClientMessage(playerid, COLOR_GREEN, iString);
  499.  
  500.     return true;
  501. }
  502.  
  503. CMD:myscore(playerid,params[])
  504. {
  505.     new string[56];
  506.     format(string,sizeof(string), "[INFO]: Your score: %i", GetPlayerScore(playerid));
  507.     SendClientMessage(playerid, yellow, string);
  508.     return 1;
  509. }
  510.  
  511. CMD:pm(playerid, params[]) // We will create a new command ( /pm )
  512. { // Opening bracket
  513.  
  514.     new // creating new variables
  515.         iTarget, // a variable called iTarget
  516.         szMsg[ 100 ]; // a variable called szMsg. This will be a string that can carry 100 characters
  517.  
  518.     if (sscanf( params, "rs[100]", iTarget, szMsg))
  519.     {   // If the player hasn't entered the player or the message ( r = playerID / name || s = string )
  520.         return SendClientMessage(playerid, 0xFF3333AA, "[USAGE]: /pm (id/name) (message)");
  521.         // Sends the player message about the correct command usage.
  522.     }
  523.  
  524.     if (iTarget == INVALID_PLAYER_ID) // The player is not connected!
  525.     {
  526.         return SendClientMessage(playerid, red, "[ERROR]: The player is not connected!");
  527.         // Sends the player message that he/she has entered a wrong ID.
  528.     }
  529.  
  530.     new
  531.         szStr[128];   // Now, we will create another variable called " szStr ".
  532.                         // 128 is the max size for client mesages.
  533.     new
  534.         pName[MAX_PLAYER_NAME], // We will create another variable which will store the sender's name
  535.         tName[MAX_PLAYER_NAME]; // Same as above, except this is to store the target's name
  536.  
  537.     GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  538.     // We will get the sender's name and store it at the pName variable
  539.  
  540.     GetPlayerName(iTarget, tName, MAX_PLAYER_NAME);
  541.     // We will get the target's name and store it at the tName variable
  542.  
  543.     // We will format the message.
  544.     format(szStr, sizeof (szStr), "[PM from %s]: %s", pName, szMsg );
  545.     // %s is used to format strings, the first %s is the player's name ( pName ),
  546.     // and the second %s is the message. ( szMsg )
  547.  
  548.     SendClientMessage(iTarget, 0x33FF33AA, szStr);
  549.     // Sends the target the PM which the sender has sent.
  550.  
  551.     // We will format another message.
  552.     format(szStr, sizeof(szStr), "[PM to %s]: %s", tName, szMsg);
  553.     // %s is used to format strings, the first %s is the target's name ( tName ),
  554.     // and the second %s is the message. ( szMsg )
  555.  
  556.     SendClientMessage(playerid, 0x33FF33AA, szStr);
  557.     // Sends the sender message about the message he has sent.
  558.  
  559.     return true;
  560. } // Closing bracket
  561.  
  562. CMD:stats(playerid,params[])
  563. {
  564.     new string[256], name[MAX_PLAYER_NAME], ip[16];
  565.     GetPlayerName(playerid, name, sizeof(name));
  566.     new score = GetPlayerScore(playerid);
  567.     new cash = GetPlayerMoney(playerid);
  568.     new kills = pInfo[playerid][Kills]; //This line
  569.     new deaths = pInfo[playerid][Deaths]; //This line
  570.     GetPlayerIp(playerid, ip, 16);
  571.     new hours = pInfo[playerid][Hours];
  572.     format(string,sizeof(string), "Name: %s\nYour IP: %s\nCurrent ID: %d\nScore: %i\nCash: $%d\nKills: %d\nDeaths: %d\nHours Online: %d", name, ip, playerid, score, cash, kills, deaths, hours);
  573.     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Your stats", string, "OK", "");
  574.     return 1;
  575. }
  576.  
  577. CMD:cmds(playerid,params[])
  578. {
  579.     new string[512],longstring[1024];
  580.     format(string,sizeof(string), "/sp, /lp - Save/Load position\n/v, /car - Spawn a car\n/myscore - Checks your score\n/godmode - Toggle Godmode\n/stuntbonus - Toggle stunt bonus\n/pm - Send Private Message\n/stats - Your stats\n/afk - AFK/BACK status\n/weapons - Free weapons\n/myscore - Checks your score", "OK","");
  581.     strcat(longstring,string,sizeof(longstring));
  582.     format(string,sizeof(string), "\n/boost - Toggle Speedboost\n/goto - Goto another player\n/myip - Check your IP\n/kill - Suicide");
  583.     strcat(longstring,string,sizeof(longstring));
  584.     ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "{ffff00}Server {00ffff}Commands", longstring, "OK", "");
  585.     return 1;
  586. }
  587.  
  588.  
  589. CMD:sp(playerid, params[]) {
  590.     GetPlayerPos(playerid, savedPos[playerid][0], savedPos[playerid][1], savedPos[playerid][2]);
  591.     if (IsPlayerInAnyVehicle(playerid)) {
  592.         GetVehicleZAngle(GetPlayerVehicleID(playerid), savedPos[playerid][3]);
  593.     }
  594.     else {
  595.         GetPlayerFacingAngle(playerid, savedPos[playerid][3]);
  596.     }
  597.     GameTextForPlayer(playerid, "~g~Position saved!~n~~w~/lp to load it.", 2000, 3);
  598.     return true;
  599. }
  600.  
  601. CMD:lp(playerid, params[]) {
  602.     switch (GetPlayerState(playerid)) {
  603.         case PLAYER_STATE_DRIVER: {
  604.             SetVehiclePos(GetPlayerVehicleID(playerid), savedPos[playerid][0], savedPos[playerid][1], savedPos[playerid][2]);
  605.             SetVehicleZAngle(GetPlayerVehicleID(playerid), savedPos[playerid][3]);
  606.         }
  607.         default: {
  608.             SetPlayerPos(playerid, savedPos[playerid][0], savedPos[playerid][1], savedPos[playerid][2]);
  609.             SetPlayerFacingAngle(playerid, savedPos[playerid][3]);
  610.         }
  611.     }
  612.     GameTextForPlayer(playerid, "~g~Position loaded!", 2000, 3);
  613.     return 1;
  614. }
  615.  
  616. CMD:me(playerid, params[]) {
  617.     if (isnull(params)) return SendClientMessage(playerid, COLOR_ORANGE, "~/me <action>");
  618.     new name[MAX_PLAYER_NAME], str[128];
  619.     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  620.     format(str, 128, "* %s %s", name, params);
  621.     SendClientMessageToAll(-1, str);
  622.     return true;
  623. }
  624.  
  625. CMD:goto(playerid, params[])
  626. {
  627.      new ID;
  628.      new pn[MAX_PLAYER_NAME];
  629.      new an[MAX_PLAYER_NAME];
  630.      new str[128];
  631.      if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]"); //This is a long line, "sscanf" is the plugin that search the missing params, "params" is the param that define params LOL, "u" is the PARAM that define the MISSING ID, ID is the param for the targetid
  632.      if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
  633.      GetPlayerName(playerid, an, MAX_PLAYER_NAME);//Define the playerid's param
  634.      GetPlayerName(ID, pn, MAX_PLAYER_NAME);//Define the ID's param
  635.      new Float:x; //Defining float X
  636.      new Float:y; //Same
  637.      new Float:z; //Same
  638.      GetPlayerPos(ID, x, y, z); //This line get the "ID" position
  639.      SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
  640.      format(str, sizeof(str), "You have been teleported to %s.", pn); //Showed before, this is the line that give the message to playerid)
  641.      SendClientMessage(playerid, 0x00FF00AA, str); //This line give the message to playerid
  642.      if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
  643.      {
  644.           GetPlayerPos(ID, x, y, z);
  645.           SetVehiclePos(playerid, x+1, y+1, z); //And this one? :D
  646.      }
  647.      return 1;
  648. }
  649.  
  650. CMD:myip(playerid,params[])
  651. {
  652.     new ip[16], string[56];
  653.     GetPlayerIp(playerid, ip, 16);
  654.     format(string,sizeof(string), "Your IP: %s", ip);
  655.     SendClientMessage(playerid, yellow, string);
  656.     return 1;
  657. }
  658.  
  659. CMD:kill(playerid,params[])
  660. {
  661.     new name[25],string[100];
  662.     SetPlayerHealth(playerid, 0);
  663.     GetPlayerName(playerid,name,sizeof(name));
  664.     format(string,sizeof(string), "%s has suicided!", name);
  665.     SendClientMessage(playerid, aqua, string);
  666.     return 1;
  667. }
  668. CMD:stuntbonusforall(playerid,params[])
  669. {
  670.     if(IsPlayerAdmin(playerid))
  671.     {
  672.         if(StuntBonusAll == 0)
  673.         {
  674.             new name[25],string[100];
  675.             StuntBonusAll = 1;
  676.             EnableStuntBonusForAll(1);
  677.             GetPlayerName(playerid,name,sizeof(name));
  678.             format(string,sizeof(string), "RCON Admin %s has enabled Stunt Bonus For All!", name);
  679.             SendClientMessageToAll(white, string);
  680.         }
  681.         else if(StuntBonusAll == 1)
  682.         {
  683.             new name[25],string[100];
  684.             StuntBonusAll = 0;
  685.             EnableStuntBonusForAll(0);
  686.             GetPlayerName(playerid,name,sizeof(name));
  687.             format(string,sizeof(string), "RCON Admin %s has disabled Stunt Bonus For All!", name);
  688.             SendClientMessageToAll(white, string);
  689.         }
  690.         if(!IsPlayerAdmin(playerid))
  691.         {
  692.         SendClientMessage(playerid, red, "[ERROR]: You must be a RCON admin to do this!");
  693.         }
  694.     }
  695.     return 1;
  696. }
  697. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  698. {
  699.     new string[128],string2[128], name[56];
  700.     format(string, sizeof(string), "[INFO]: You've entered %s.", GetVehicleName(vehicleid));
  701.     SendClientMessage(playerid, -1, string);
  702.     format(string2, sizeof(string2), "[INFO]: %s exited %s.", name, GetVehicleName(vehicleid));
  703.     print(string2);
  704.     return 1;
  705. }
  706.  
  707. public OnPlayerExitVehicle(playerid, vehicleid)
  708. {
  709.     new string[128], string2[128], name[56];
  710.     format(string, sizeof(string), "[INFO]: You've exited %s.", GetVehicleName(vehicleid));
  711.     SendClientMessage(playerid, -1, string);
  712.     GetPlayerName(playerid, name, sizeof(name));
  713.     format(string2, sizeof(string2), "[INFO]: %s exited %s.", name, GetVehicleName(vehicleid));
  714.     print(string2);
  715.     return 1;
  716. }
  717.  
  718. public OnPlayerStateChange(playerid, newstate, oldstate)
  719. {
  720.     return 1;
  721. }
  722.  
  723. public OnPlayerEnterCheckpoint(playerid)
  724. {
  725.     return 1;
  726. }
  727.  
  728. public OnPlayerLeaveCheckpoint(playerid)
  729. {
  730.     return 1;
  731. }
  732.  
  733. public OnPlayerEnterRaceCheckpoint(playerid)
  734. {
  735.     return 1;
  736. }
  737.  
  738. public OnPlayerLeaveRaceCheckpoint(playerid)
  739. {
  740.     return 1;
  741. }
  742.  
  743. public OnRconCommand(cmd[])
  744. {
  745.     return 1;
  746. }
  747.  
  748. public OnPlayerRequestSpawn(playerid)
  749. {
  750.     return 1;
  751. }
  752.  
  753. public OnObjectMoved(objectid)
  754. {
  755.     return 1;
  756. }
  757.  
  758. public OnPlayerObjectMoved(playerid, objectid)
  759. {
  760.     return 1;
  761. }
  762.  
  763. public OnPlayerPickUpPickup(playerid, pickupid)
  764. {
  765.     return 1;
  766. }
  767.  
  768. public OnVehicleMod(playerid, vehicleid, componentid)
  769. {
  770.     return 1;
  771. }
  772.  
  773. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  774. {
  775.     return 1;
  776. }
  777.  
  778. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  779. {
  780.     return 1;
  781. }
  782.  
  783. public OnPlayerSelectedMenuRow(playerid, row)
  784. {
  785.     return 1;
  786. }
  787.  
  788. public OnPlayerExitedMenu(playerid)
  789. {
  790.     return 1;
  791. }
  792.  
  793. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  794. {
  795.     return 1;
  796. }
  797.  
  798. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  799. {
  800.     if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  801.         {
  802.             if(newkeys & KEY_FIRE)
  803.             {
  804.             if(Boost[playerid] == 1)
  805.                 {
  806.                 new Float:vx,Float:vy,Float:vz;
  807.                 GetVehicleVelocity(GetPlayerVehicleID(playerid),vx,vy,vz);
  808.                 SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 1.8, vy *1.8, vz * 1.8);
  809.                 }
  810.             }
  811.         }
  812.  
  813.  
  814.     if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  815.         {
  816.             if (newkeys & KEY_CROUCH)
  817.             {
  818.             if(Boost[playerid] == 1)
  819.                 {
  820.                 new Float:x, Float:y, Float:z;
  821.                 GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
  822.                 SetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z+0.3);
  823.                 }
  824.             }
  825.         }
  826.     if(newkeys & KEY_SUBMISSION) //If they press 2
  827.     {
  828.         if(GetPlayerState(playerid) == 2) //If they are driving a vehicle
  829.         {
  830.             SetVehicleHealth(GetPlayerVehicleID(playerid),1000); //Set player's vehicle health to 1000
  831.             RepairVehicle(GetPlayerVehicleID(playerid)); //Repair their vehicle(doors,hood, etc)
  832.         }
  833.     }
  834.    
  835.     if(newkeys & KEY_FIRE)
  836.     {
  837.         if(GetPlayerState(playerid) == 2)
  838.         {
  839.             AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  840.         }
  841.     }
  842.     return 1;
  843. }
  844.  
  845. public OnRconLoginAttempt(ip[], password[], success)
  846. {
  847.     return 1;
  848. }
  849.  
  850. public OnPlayerUpdate(playerid)
  851. {
  852.     return 1;
  853. }
  854.  
  855. public OnPlayerStreamIn(playerid, forplayerid)
  856. {
  857.     return 1;
  858. }
  859.  
  860. public OnPlayerStreamOut(playerid, forplayerid)
  861. {
  862.     return 1;
  863. }
  864.  
  865. public OnVehicleStreamIn(vehicleid, forplayerid)
  866. {
  867.     return 1;
  868. }
  869.  
  870. public OnVehicleStreamOut(vehicleid, forplayerid)
  871. {
  872.     return 1;
  873. }
  874.  
  875. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  876. {
  877.     if(dialogid == dregister) //If dialog id is a register dialog
  878.     {//then
  879.         if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  880.         if(response) //if they clicked the first button "Register"
  881.         {//then
  882.             if(!strlen(inputtext)) //If they didn't enter any password
  883.             {// then we will tell to them to enter the password to register
  884.                 ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
  885.                 return 1;
  886.             }
  887.             //If they have entered a correct password for his/her account...
  888.             new hashpass[129]; //Now we will create a new variable to hash his/her password
  889.             WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
  890.             new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
  891.             INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
  892.             INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user's account
  893.             INI_WriteInt(file,"Money",5000);//Write an integer inside of user's account called "Money". We will set their money to 0 after he registered
  894.             INI_WriteInt(file,"Scores",0);//Write an integer inside of user's account called "Scores". We will set their score to 0 after he registered
  895.             INI_WriteInt(file,"Kills",0);//As explained above
  896.             INI_WriteInt(file,"Deaths",0);//As explained above
  897.             INI_WriteInt(file,"Hours",0);
  898.             INI_Close(file);//Now after we've done saving their data, we now need to close the file
  899.             SendClientMessage(playerid,-1,"You have been successfully registered"); //Tell to them that they have successfully registered a new account
  900.             SendClientMessage(playerid, -1, "The system has given you $5000 as a reward for registering!");
  901.             GivePlayerMoney(playerid, 5000);
  902.             return 1;
  903.         }
  904.     }
  905.     if(dialogid == dlogin) //If dialog id is a login dialog
  906.     {//then
  907.         if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  908.         if(response) //if they clicked the first button "Register"
  909.         {//then
  910.             new hashpass[129]; //Will create a new variable to hash his/her password
  911.             WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
  912.             if(!strcmp(hashpass,pInfo[playerid][Pass])) //If they have insert their correct password
  913.             {//then
  914.                 new string[128], name[25];
  915.                 INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
  916.                 SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
  917.                 GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
  918.                 GetPlayerName(playerid, name, sizeof(name));
  919.                 format(string,sizeof(string),"Welcome back! You have successfully logged in as %s", name);
  920.                 SendClientMessage(playerid,-1,string);//Tell them that they've successfully logged in
  921.             }
  922.             else //If they've entered an incorrect password
  923.             {//then
  924.                 ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. Incorrect password! Try again!","Login","Quit");//We will tell to them that they've entered an incorrect password
  925.                 return 1;
  926.             }
  927.         }
  928.     }
  929.    
  930.     switch(dialogid)
  931.     {
  932.         case 888:
  933.         {
  934.         if(response)
  935.             {
  936.             switch(listitem)
  937.                 {
  938.                 case 0:return cmd_melee(playerid,"params");
  939.                 case 1:return cmd_pistols(playerid,"params");
  940.                 case 2:return cmd_shotguns(playerid,"params");
  941.                 case 3:return cmd_machineguns(playerid,"params");
  942.                 case 4:return cmd_assaultrifles(playerid,"params");
  943.                 case 5:return cmd_snipers(playerid,"params");
  944.                 case 6:return cmd_explosive(playerid,"params");
  945.                 case 7:return cmd_special(playerid,"params");
  946.                 case 8:return cmd_sextoys(playerid,"params");
  947.                 case 9:return cmd_heavyweapon(playerid,"params");
  948.                 }
  949.             }
  950.         }
  951.         case 889:
  952.         {
  953.         if(response)
  954.             {
  955.             switch(listitem)
  956.                 {
  957.                 case 0:return GivePlayerWeapon(playerid, 2, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Golf Club.");
  958.                 case 1:return GivePlayerWeapon(playerid, 3, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Nightstick.");
  959.                 case 2:return GivePlayerWeapon(playerid, 4, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Knife.");
  960.                 case 3:return GivePlayerWeapon(playerid, 5, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Baseball Bat.");
  961.                 case 4:return GivePlayerWeapon(playerid, 6, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Shovel.");
  962.                 case 5:return GivePlayerWeapon(playerid, 7, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Pool Cue.");
  963.                 case 6:return GivePlayerWeapon(playerid, 8, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Katana.");
  964.                 case 7:return GivePlayerWeapon(playerid, 9, 1) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Chainsaw.");
  965.                 }
  966.             }
  967.         else return cmd_weapons(playerid,"params");
  968.         }
  969.         case 890:
  970.         {
  971.         if(response)
  972.             {
  973.             switch(listitem)
  974.                 {
  975.                 case 0:return GivePlayerWeapon(playerid, 22, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Colt 45.");
  976.                 case 1:return GivePlayerWeapon(playerid, 23, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Slienced Colt 45.");
  977.                 case 2:return GivePlayerWeapon(playerid, 24, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Desert Eagle.");
  978.                 }
  979.             }
  980.         else return cmd_weapons(playerid,"params");
  981.         }
  982.         case 891:
  983.         {
  984.         if(response)
  985.             {
  986.             switch(listitem)
  987.                 {
  988.                 case 0:return GivePlayerWeapon(playerid, 25, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Shotgun.");
  989.                 case 1:return GivePlayerWeapon(playerid, 26, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Sawnoff Shotgun.");
  990.                 case 2:return GivePlayerWeapon(playerid, 27, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Combat Shotgun.");
  991.                 }
  992.             }
  993.         else return cmd_weapons(playerid,"params");
  994.         }
  995.         case 892:
  996.         {
  997.         if(response)
  998.             {
  999.             switch(listitem)
  1000.                 {
  1001.                 case 0:return GivePlayerWeapon(playerid, 28, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Micro Uzi.");
  1002.                 case 1:return GivePlayerWeapon(playerid, 29, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a SMG.");
  1003.                 case 2:return GivePlayerWeapon(playerid, 32, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Tec-9.");
  1004.                 }
  1005.             }
  1006.         else return cmd_weapons(playerid,"params");
  1007.         }
  1008.         case 893:
  1009.         {
  1010.         if(response)
  1011.             {
  1012.             switch(listitem)
  1013.                 {
  1014.                 case 0:return GivePlayerWeapon(playerid, 30, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got an AK-47.");
  1015.                 case 1:return GivePlayerWeapon(playerid, 31, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a M4.");
  1016.                 }
  1017.             }
  1018.         else return cmd_weapons(playerid,"params");
  1019.         }
  1020.         case 894:
  1021.         {
  1022.         if(response)
  1023.             {
  1024.             switch(listitem)
  1025.                 {
  1026.                 case 0:return GivePlayerWeapon(playerid, 33, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a country rifle.");
  1027.                 case 1:return GivePlayerWeapon(playerid, 34, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Sniper rifle.");
  1028.                 }
  1029.             }
  1030.         else return cmd_weapons(playerid,"params");
  1031.         }
  1032.         case 895:
  1033.         {
  1034.         if(response)
  1035.             {
  1036.             switch(listitem)
  1037.                 {
  1038.                 case 0:GivePlayerWeapon(playerid, 16, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Grenade.");
  1039.                 case 1:GivePlayerWeapon(playerid, 17, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Tear Gas.");
  1040.                 case 2:GivePlayerWeapon(playerid, 18, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Molotov.");
  1041.                 }
  1042.             }
  1043.         else return cmd_weapons(playerid,"params");
  1044.         }
  1045.         case 896:
  1046.         {
  1047.         if(response)
  1048.             {
  1049.             switch(listitem)
  1050.                 {
  1051.                 case 0:GivePlayerWeapon(playerid, 14, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Flower.");
  1052.                 case 1:GivePlayerWeapon(playerid, 15, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Cane.");
  1053.                 case 2:GivePlayerWeapon(playerid, 41, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Spray Can.");
  1054.                 case 3:GivePlayerWeapon(playerid, 42, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Fire Extinguisher.");
  1055.                 case 4:GivePlayerWeapon(playerid, 43, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Camera.");
  1056.                 case 5:GivePlayerWeapon(playerid, 46, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a Parachute.");
  1057.                 }
  1058.             }
  1059.         else return cmd_weapons(playerid,"params");
  1060.         }
  1061.         case 897:
  1062.         {
  1063.         if(response)
  1064.             {
  1065.             switch(listitem)
  1066.                 {
  1067.                 case 0:GivePlayerWeapon(playerid, 10, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a double-ended dildo.");
  1068.                 case 1:GivePlayerWeapon(playerid, 11, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a dildo.");
  1069.                 case 2:GivePlayerWeapon(playerid, 12, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a vibrator.");
  1070.                 case 3:GivePlayerWeapon(playerid, 13, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a sliver vibrator.");
  1071.                 }
  1072.             }
  1073.         else return cmd_weapons(playerid,"params");
  1074.         }
  1075.         case 898:
  1076.         {
  1077.         if(response)
  1078.             {
  1079.             if(IsPlayerAdmin(playerid))
  1080.                 {
  1081.                 switch(listitem)
  1082.                     {
  1083.                     case 0:GivePlayerWeapon(playerid, 35, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a rocket launcher.");
  1084.                     case 1:GivePlayerWeapon(playerid, 36, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a heat seeker launcher.");
  1085.                     case 2:GivePlayerWeapon(playerid, 37, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a flamethrower.");
  1086.                     case 3:GivePlayerWeapon(playerid, 38, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a minigun.");
  1087.                     case 4:GivePlayerWeapon(playerid, 39, 9999) && SendClientMessage(playerid, 0xFF9900AA, "[INFO]: You've got a satchel charge.");
  1088.                     }
  1089.                 }
  1090.             }
  1091.             else return cmd_weapons(playerid,"params") && SendClientMessage(playerid, 0xFF000000, "[ERROR]: You are not a RCON admin");
  1092.         }
  1093.      }
  1094.     return 1;
  1095. }
  1096.  
  1097. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  1098. {
  1099.     return 1;
  1100. }
  1101.  
  1102. stock GetVehicleName(vehicleid)
  1103. {
  1104.     new string[128];
  1105.     format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
  1106.     return string;
  1107. }
  1108.  
  1109. stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
  1110. {
  1111.     new str[128],name[MAX_PLAYER_NAME];
  1112.     GetPlayerName(playerid,name,sizeof(name));
  1113.     format(str,sizeof(str),UserPath,name);
  1114.     return str;
  1115. }
  1116.  
  1117. stock GetVehicleModelIDFromName(vname[])
  1118. {
  1119.     for(new i = 0; i < 211; i++)
  1120.     {
  1121.         if ( strfind(VehicleNames[i], vname, true) != -1 )
  1122.             return i + MIN_VEHI_ID;
  1123.     }
  1124.     return -1;
  1125. }
  1126.  
  1127. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  1128. {   // Created by Y_Less
  1129.  
  1130.     new Float:a;
  1131.  
  1132.     GetPlayerPos(playerid, x, y, a);
  1133.     GetPlayerFacingAngle(playerid, a);
  1134.  
  1135.     if (GetPlayerVehicleID(playerid)) {
  1136.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  1137.     }
  1138.  
  1139.     x += (distance * floatsin(-a, degrees));
  1140.     y += (distance * floatcos(-a, degrees));
  1141. }
  1142.  
  1143. forward loadaccount_user(playerid, name[], value[]); //forwarding a new function to load user's data
  1144. public loadaccount_user(playerid, name[], value[])
  1145. {
  1146.     INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
  1147.     ("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
  1148.     INI_String("IP", pInfo[playerid][IP],16);
  1149.     INI_Int("Money",pInfo[playerid][Money]); //As explained above
  1150.     INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
  1151.     INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
  1152.     INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
  1153.     INI_Int("Hours",pInfo[playerid][Hours]);
  1154.     return 1;
  1155. }
  1156.  
  1157. forward SendMSG();
  1158. public SendMSG()
  1159. {
  1160.     new randMSG = random(sizeof(RandomMSG));
  1161.     SendClientMessageToAll(0xFFFFAAAA, RandomMSG[randMSG]);
  1162. }
  1163.  
  1164. stock GetPlayerKills(playerid, name[], value[])
  1165. {
  1166.     INI_Int("Kills",pInfo[playerid][Kills]);
  1167.     return 1;
  1168. }
  1169.  
  1170. stock GetPlayerDeaths(playerid,name[], value[])
  1171. {
  1172.     INI_Int("Deaths",pInfo[playerid][Deaths]);
  1173.     return 1;
  1174. }
  1175.  
  1176. forward OneHourBonus();
  1177. public OneHourBonus()
  1178. {
  1179.     for (new i, slots = GetMaxPlayers(); i < slots; i ++)
  1180.     {
  1181.         GivePlayerMoney(i, 5000);
  1182.         SetPlayerScore(i,GetPlayerScore(i)+5);
  1183.         SendClientMessage(i, -1, "Thanks for playing on our server for 1 hour! As a bonus, $5000 and 5 scores have been given you.");
  1184.         pInfo[i][Hours]++;
  1185.     }
  1186.  
  1187.     return 1;
  1188. }
Add Comment
Please, Sign In to add comment