Guest User

Sydcul's roleplay © 7-2-2013 Sydcul. All rights reserved.

a guest
Feb 7th, 2013
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 31.69 KB | None | 0 0
  1. //Sydcul's roleplay. © 2012-2013 Sydcul. All rights reserved. http://sydcul.com/sydculsroleplay
  2.  
  3. #include <a_samp>
  4. #include "../include/gl_common.inc"
  5. #include <streamer>
  6. #include <YSI\y_ini>
  7.  
  8. #define TEAM_GROVE 1
  9. #define TEAM_BALLAS 2
  10. #define TEAM_POLICE 3
  11. #define TEAM_GROVE_COLOR 0x00FF00AA
  12. #define TEAM_BALLAS_COLOR 0xFF00FFAA
  13. #define TEAM_POLICE_COLOR 0x0000FFAA
  14.  
  15. #define OCCUPATION_GANGSTER 1
  16. #define OCCUPATION_STREETCOP 2
  17. #define OCCUPATION_BIKERCOP 3
  18. #define OCCUPATION_SWAT 4
  19. #define OCCUPATION_AIRSUPPORT 5
  20. #define OCCUPATION_RACECOP 6
  21. #define OCCUPATION_STEALTHSNIPER 7
  22. #define OCCUPATION_OFFROADCOP 8
  23.  
  24. #define DIALOG_NOTENOUGHMONEY 1
  25. #define DIALOG_RULES 2
  26. #define DIALOG_REGISTER 3
  27. #define DIALOG_LOGIN 4
  28.  
  29. #define SHOP_CARSHOP 5
  30. #define SHOP_JETPACKANDPARACHUTESHOP 6
  31. #define SHOP_AIRCRAFTSHOP 7
  32. #define SHOP_HEAVYWEAPONSSHOP 8
  33.  
  34. new total_vehicles_from_files=0;
  35. new Team[MAX_PLAYERS], Occupation[MAX_PLAYERS];
  36. new Shop[4], CarSpawner[4];
  37. new CarSpawnerCar[MAX_VEHICLES];
  38. new NextCarSpawnerCar;
  39. new CarShopCar[MAX_PLAYERS], AircraftShopVehicle[MAX_PLAYERS];
  40. new iniplayermoney, iniplayerscore;
  41. new iniplayerpassword[100];
  42. new Status[MAX_PLAYERS];
  43. new Class[MAX_PLAYERS];
  44. new CarSpawnsLeft[MAX_PLAYERS];
  45.  
  46. main()
  47. {
  48.     print("\n----------------------------------");
  49.     print(" Sydcul's roleplay");
  50.     print("----------------------------------\n");
  51. }
  52.  
  53. public OnGameModeInit()
  54. {
  55.     SetGameModeText("Sydcul's roleplay");
  56.     SendRconCommand("mapname Los Santos");
  57.    
  58.     AddPlayerClass(105, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 200, WEAPON_TEC9, 400); //0 - Grove 1
  59.     AddPlayerClass(106, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 200, WEAPON_TEC9, 400); //1 - Grove 2
  60.     AddPlayerClass(107, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 200, WEAPON_TEC9, 400); //2 - Grove 3
  61.     AddPlayerClass(102, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 200, WEAPON_UZI, 400); //3 - Ballas 1
  62.     AddPlayerClass(103, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 200, WEAPON_UZI, 400); //4 - Ballas 2
  63.     AddPlayerClass(104, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 200, WEAPON_UZI, 400); //5 - Ballas 3
  64.     AddPlayerClass(280, 1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_NITESTICK, 1, WEAPON_COLT45, 200, WEAPON_SHOTGUN, 20); //6 - Street cop
  65.     AddPlayerClass(284, 1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_NITESTICK, 1, WEAPON_COLT45, 200, WEAPON_UZI, 400); //7 - Biker cop
  66.     AddPlayerClass(285, 1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_NITESTICK, 1, WEAPON_MP5, 400, WEAPON_SHOTGSPA, 20); //8 - SWAT
  67.     AddPlayerClass(71,1579.9401,-1635.3022,13.5609,117.3636, WEAPON_NITESTICK, 1, WEAPON_COLT45, 200, WEAPON_SHOTGUN, 20); // 9 - Air support
  68.     AddPlayerClass(165,1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_DEAGLE, 50, WEAPON_TEC9, 300, WEAPON_SATCHEL, 5); // 10 - Race cop
  69.     AddPlayerClass(295, 1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_KNIFE, 1, WEAPON_SILENCED, 50, WEAPON_SNIPER, 40); //11 - Stealth sniper
  70.     AddPlayerClass(283, 1549.5518, -1675.3184, 15.0135,90.7510, WEAPON_NITESTICK, 1, WEAPON_COLT45, 200, WEAPON_SHOTGUN, 20); //12 - Off-road cop
  71.    
  72.     total_vehicles_from_files += LoadStaticVehiclesFromFile("sydculsroleplay/vehicles.txt");
  73.     return 1;
  74. }
  75.  
  76. public OnPlayerRequestClass(playerid, classid)
  77. {
  78.     SetPlayerPos(playerid, 2121.7322, -1623.2563, 26.8368);
  79.     SetPlayerFacingAngle(playerid, 60.2360);
  80.     SetPlayerCameraPos(playerid, 2111.9089 ,-1623.7340, 24.2307);
  81.     SetPlayerCameraLookAt(playerid, 2121.7322, -1623.2563, 26.8368);
  82.     switch(classid)
  83.     {
  84.     case 0,1,2:
  85.     {
  86.         GameTextForPlayer(playerid, "~g~GROVE~w~", 3000, 5);
  87.         Team[playerid] = TEAM_GROVE;
  88.         Occupation[playerid] = OCCUPATION_GANGSTER;
  89.         Class[playerid] = classid;
  90.     }
  91.     case 3,4,5:
  92.     {
  93.         GameTextForPlayer(playerid, "~p~BALLAS~w~", 3000, 5);
  94.         Team[playerid] = TEAM_BALLAS;
  95.         Occupation[playerid] = OCCUPATION_GANGSTER;
  96.         Class[playerid] = classid;
  97.     }
  98.     case 6:
  99.     {
  100.         GameTextForPlayer(playerid, "~b~STREET COP~w~", 3000, 5);
  101.         Team[playerid] = TEAM_POLICE;
  102.         Occupation[playerid] = OCCUPATION_STREETCOP;
  103.         Class[playerid] = classid;
  104.     }
  105.     case 7:
  106.     {
  107.         GameTextForPlayer(playerid, "~b~BIKER COP~w~", 3000, 5);
  108.         Team[playerid] = TEAM_POLICE;
  109.         Occupation[playerid] = OCCUPATION_BIKERCOP;
  110.         Class[playerid] = classid;
  111.     }
  112.     case 8:
  113.     {
  114.         GameTextForPlayer(playerid, "~b~SWAT~w~", 3000, 5);
  115.         Team[playerid] = TEAM_POLICE;
  116.         Occupation[playerid] = OCCUPATION_SWAT;
  117.         Class[playerid] = classid;
  118.     }
  119.     case 9:
  120.     {
  121.         GameTextForPlayer(playerid, "~b~AIR SUPPORT~w~", 3000, 5);
  122.         Team[playerid] = TEAM_POLICE;
  123.         Occupation[playerid] = OCCUPATION_AIRSUPPORT;
  124.         Class[playerid] = classid;
  125.     }
  126.     case 10:
  127.     {
  128.         GameTextForPlayer(playerid, "~b~RACE COP~w~", 3000, 5);
  129.         Team[playerid] = TEAM_POLICE;
  130.         Occupation[playerid] = OCCUPATION_RACECOP;
  131.         Class[playerid] = classid;
  132.     }
  133.     case 11:
  134.     {
  135.         GameTextForPlayer(playerid, "~b~STEALTH SNIPER~w~", 3000, 5);
  136.         Team[playerid] = TEAM_POLICE;
  137.         Occupation[playerid] = OCCUPATION_STEALTHSNIPER;
  138.         Class[playerid] = classid;
  139.     }
  140.     case 12:
  141.     {
  142.         GameTextForPlayer(playerid, "~b~OFF-ROAD COP~w~", 3000, 5);
  143.         Team[playerid] = TEAM_POLICE;
  144.         Occupation[playerid] = OCCUPATION_OFFROADCOP;
  145.         Class[playerid] = classid;
  146.     }
  147.     }
  148.     return 1;
  149. }
  150.  
  151. public OnPlayerRequestSpawn(playerid)
  152. {
  153.     switch(Class[playerid])
  154.     {
  155.     case 6:
  156.     {
  157.         new playerscore;
  158.         playerscore = GetPlayerScore(playerid);
  159.         if (playerscore<10) {
  160.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 10~w~", 3000, 5);
  161.         return 0;
  162.         }
  163.     }
  164.     case 7:
  165.     {
  166.         new playerscore;
  167.         playerscore = GetPlayerScore(playerid);
  168.         if (playerscore<15) {
  169.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 15~w~", 3000, 5);
  170.         return 0;
  171.         }
  172.     }
  173.     case 8:
  174.     {
  175.         new playerscore;
  176.         playerscore = GetPlayerScore(playerid);
  177.         if (playerscore<30) {
  178.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 30~w~", 3000, 5);
  179.         return 0;
  180.         }
  181.     }
  182.     case 9:
  183.     {
  184.         new playerscore;
  185.         playerscore = GetPlayerScore(playerid);
  186.         if (playerscore<20) {
  187.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 20~w~", 3000, 5);
  188.         return 0;
  189.         }
  190.     }
  191.     case 10:
  192.     {
  193.         new playerscore;
  194.         playerscore = GetPlayerScore(playerid);
  195.         if (playerscore<35) {
  196.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 35~w~", 3000, 5);
  197.         return 0;
  198.         }
  199.     }
  200.     case 11:
  201.     {
  202.         new playerscore;
  203.         playerscore = GetPlayerScore(playerid);
  204.         if (playerscore<35) {
  205.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 35~w~", 3000, 5);
  206.         return 0;
  207.         }
  208.     }
  209.     case 12:
  210.     {
  211.         new playerscore;
  212.         playerscore = GetPlayerScore(playerid);
  213.         if (playerscore<15) {
  214.         GameTextForPlayer(playerid, "~r~This class is available when you have a score of at least 15~w~", 3000, 5);
  215.         return 0;
  216.         }
  217.     }
  218.     }
  219.     return 1;
  220. }
  221.  
  222. SetPlayerToTeamColor(playerid)
  223. {
  224.     if (Team[playerid] == TEAM_GROVE)
  225.     {
  226.         SetPlayerColor(playerid, TEAM_GROVE_COLOR);
  227.     }
  228.     if (Team[playerid] == TEAM_BALLAS)
  229.     {
  230.         SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
  231.     }
  232.     if (Team[playerid] == TEAM_POLICE)
  233.     {
  234.         SetPlayerColor(playerid, TEAM_POLICE_COLOR);
  235.     }
  236. }
  237.  
  238. forward ini_playerdata(name[], value[]);
  239.  
  240. public ini_playerdata(name[], value[])
  241. {
  242.     INI_Int("money", iniplayermoney);
  243.     INI_Int("score", iniplayerscore);
  244.     return 1;
  245. }
  246.  
  247. forward ini_logindata(name[], value[]);
  248.  
  249. public ini_logindata(name[], value[])
  250. {
  251.     INI_String("password", iniplayerpassword, sizeof(iniplayerpassword));
  252.     return 1;
  253. }
  254.  
  255. public OnPlayerConnect(playerid)
  256. {
  257.     TogglePlayerSpectating(playerid, 1);
  258.     new playername[MAX_PLAYER_NAME+1], filename[28+MAX_PLAYER_NAME];
  259.     Status[playerid] = 0;
  260.  
  261.     GetPlayerName(playerid, playername, sizeof(playername));
  262.     format(filename, sizeof(filename), "sydculsroleplay/players/%s.ini", playername);
  263.  
  264.     if(!fexist(filename))
  265.     {
  266.     ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Welcome!", "Welcome to Sydcul's roleplay!\nYou can do pretty much everything you want here, but there are some rules!\n\n1. No cheating/hacking\n2. No spawnkilling/trolling\n3. Behave like a normal human being and use your brains!\n\nDo you accept these rules?", "Yes", "No");
  267.     } else {
  268.     INI_ParseFile(filename, "ini_%s");
  269.     ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password:", "Login", "Quit");
  270.     }
  271.  
  272.     GivePlayerMoney(playerid, iniplayermoney);
  273.     SetPlayerScore(playerid, iniplayerscore);
  274.    
  275.     CarShopCar[playerid] = -1;
  276.     AircraftShopVehicle[playerid] = -1;
  277.     CarSpawnsLeft[playerid] = 3;
  278.     SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
  279.  
  280.     SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
  281.     SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
  282.     SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
  283.     SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
  284.     SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
  285.     SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
  286.     SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
  287.     SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
  288.     SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
  289.     SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
  290.     SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);
  291.     return 1;
  292. }
  293.  
  294. public OnPlayerDisconnect(playerid, reason)
  295. {
  296.     if (Status[playerid]==1) {
  297.     new playername[MAX_PLAYER_NAME+1], filename[28+MAX_PLAYER_NAME];
  298.    
  299.     GetPlayerName(playerid, playername, sizeof(playername));
  300.     format(filename, sizeof(filename), "sydculsroleplay/players/%s.ini", playername);
  301.  
  302.     new INI:iniFile = INI_Open(filename);
  303.  
  304.     INI_SetTag(iniFile, "playerdata");
  305.     INI_WriteInt(iniFile, "money", GetPlayerMoney(playerid));
  306.     INI_WriteInt(iniFile, "score", GetPlayerScore(playerid));
  307.  
  308.     INI_Close(iniFile);
  309.     }
  310.     SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
  311.     return 1;
  312. }
  313.  
  314. public OnPlayerSpawn(playerid)
  315. {
  316.     SetPlayerToTeamColor(playerid);
  317.    
  318.     SetPlayerMapIcon(playerid, 0, 2512.0581,-1672.3823,13.4813, 62, 0, MAPICON_GLOBAL); //Grove
  319.     SetPlayerMapIcon(playerid, 1, 2172.8787,-1672.7426,15.0859, 59, 0, MAPICON_GLOBAL); //Ballas
  320.     SetPlayerMapIcon(playerid, 2, 1549.5518,-1675.3184,15.0135, 30, 0, MAPICON_GLOBAL); //Police
  321.    
  322.     new playerip[16];
  323.     GetPlayerIp(playerid, playerip, sizeof(playerip));
  324.     if(!strcmp(playerip, "84.80.50.41") || !strcmp(playerip, "83.85.63.115")) {
  325.         SendClientMessage(playerid, 0xFF0000, "Geen shops voor de broertjes Nijdam!");
  326.     } else {
  327.     Shop[0] = CreateDynamicCP(1772.1460,-1929.1642,13.5534, 2, -1, -1, -1, 100); //Car shop
  328.     SetPlayerMapIcon(playerid, 3, 1772.1460,-1929.1642,13.5534, 55, 0, MAPICON_GLOBAL);
  329.     Shop[1] = CreateDynamicCP(1954.6067,-2188.5210,13.5469, 2, -1, -1, -1, 100); //Jetpack and parachute shop
  330.     SetPlayerMapIcon(playerid, 4, 1954.6067,-2188.5210,13.5469, 5, 0, MAPICON_GLOBAL);
  331.     Shop[2] = CreateDynamicCP(1683.3267,-2638.3318,13.5469, 2, -1, -1, -1, 100); //Aircraft shop
  332.     SetPlayerMapIcon(playerid, 5, 1683.3267,-2638.3318,13.5469, 5, 0, MAPICON_GLOBAL);
  333.     Shop[3] = CreateDynamicCP(2444.6648,-1975.5310,13.5469, 2, -1, -1, -1, 100); //Heavy weapons shop
  334.     SetPlayerMapIcon(playerid, 6, 2444.6648,-1975.5310,13.5469, 18, 0, MAPICON_GLOBAL);
  335.     }
  336.     CarSpawner[0] = CreateDynamicCP(2524.7244,-1668.8529,15.0670, 2, -1, -1, -1, 100); //Grove carspawner
  337.     CarSpawner[1] = CreateDynamicCP(2175.3210,-1667.7389,15.0859, 2, -1, -1, -1, 100); //Ballas carspawner
  338.     CarSpawner[2] = CreateDynamicCP(1547.9329,-1669.3354,13.5673, 2, -1, -1, -1, 100); //Police carspawner
  339.     CarSpawner[3] = CreateDynamicCP(1550.7395,-1615.7549,13.3828, 2, -1, -1, -1, 100); //Police helispawner
  340. }
  341.  
  342. public OnPlayerDeath(playerid, killerid, reason)
  343. {
  344.     if(killerid == INVALID_PLAYER_ID) {
  345.         SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  346.         SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
  347.     } else if(Team[killerid] == Team[playerid]) {
  348.         GivePlayerMoney(playerid, 100);
  349.         SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
  350.         GivePlayerMoney(killerid, -50);
  351.         SendDeathMessage(killerid,playerid,reason);
  352.     } else {
  353.         SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
  354.         SendDeathMessage(killerid,playerid,reason);
  355.         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  356.         GivePlayerMoney(killerid, 100);
  357.     }
  358.     CarSpawnsLeft[playerid] = 3;
  359.     return 1;
  360. }
  361.  
  362. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  363. {
  364.     if(checkpointid == Shop[0]) //Car shop
  365.     {
  366.         if (!IsPlayerInAnyVehicle(playerid)) {
  367.         ShowPlayerDialog(playerid, SHOP_CARSHOP, DIALOG_STYLE_LIST, "Car shop", "Infernus ($250)\nTurismo ($350)", "Buy", "Cancel");
  368.         } else {
  369.         SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
  370.         }
  371.     }
  372.     if(checkpointid == Shop[1]) //Jetpack and parachute shop
  373.     {
  374.         if (!IsPlayerInAnyVehicle(playerid)) {
  375.         ShowPlayerDialog(playerid, SHOP_JETPACKANDPARACHUTESHOP, DIALOG_STYLE_LIST, "Jetpack and parachute shop", "Jetpack ($300)\nParachute ($50)", "Buy", "Cancel");
  376.         } else {
  377.         SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
  378.         }
  379.     }
  380.     if(checkpointid == Shop[2]) //Aircraft shop
  381.     {
  382.         if (!IsPlayerInAnyVehicle(playerid)) {
  383.         ShowPlayerDialog(playerid, SHOP_AIRCRAFTSHOP, DIALOG_STYLE_LIST, "Aircraft shop", "Hydra ($500)\nHunter ($600)", "Buy", "Cancel");
  384.         } else {
  385.         SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
  386.         }
  387.     }
  388.     if(checkpointid == Shop[3]) //Heavy weapons shop
  389.     {
  390.         if (!IsPlayerInAnyVehicle(playerid)) {
  391.         ShowPlayerDialog(playerid, SHOP_HEAVYWEAPONSSHOP, DIALOG_STYLE_LIST, "Heavy weapons shop", "Minigun ($800)\nRPG ($400)\nFlamethrower ($200)", "Buy", "Cancel");
  392.         } else {
  393.         SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
  394.         }
  395.     }
  396.     if(checkpointid == CarSpawner[0]) //Grove carspawner
  397.     {
  398.         if (!IsPlayerInAnyVehicle(playerid)) {
  399.             if (Team[playerid] == TEAM_GROVE)
  400.             {
  401.                 if(CarSpawnsLeft[playerid] > 0) {
  402.                     switch(Occupation[playerid])
  403.                     {
  404.                         case OCCUPATION_GANGSTER:
  405.                         {
  406.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(492,2509.0259,-1665.4360,13.2234,35.5265,-1,-1,-1), "{00FF00}GROVE");
  407.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  408.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  409.                         }
  410.                     }
  411.                 } else {
  412.                     SendClientMessage(playerid, 0xFF0000AA, "You don't have any carspawns left for your current life.");
  413.                 }
  414.             } else {
  415.                 SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your team!");
  416.             }
  417.         } else {
  418.             SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use the carspawner!");
  419.         }
  420.     }
  421.     if(checkpointid == CarSpawner[1]) //Ballas carspawner
  422.     {
  423.         if (!IsPlayerInAnyVehicle(playerid)) {
  424.             if (Team[playerid] == TEAM_BALLAS)
  425.             {
  426.                 if(CarSpawnsLeft[playerid] > 0) {
  427.                     switch(Occupation[playerid])
  428.                     {
  429.                         case OCCUPATION_GANGSTER:
  430.                         {
  431.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(566,2183.5686,-1662.7076,14.6684,244.4174,-1,-1,-1), "{FF00FF}BALLAS");
  432.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  433.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  434.                         }
  435.                     }
  436.                 } else {
  437.                     SendClientMessage(playerid, 0xFF0000AA, "You don't have any carspawns left for your current life.");
  438.                 }
  439.             } else {
  440.                 SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your team!");
  441.             }
  442.         } else {
  443.             SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use the carspawner!");
  444.         }
  445.     }
  446.     if(checkpointid == CarSpawner[2]) //Police carspawner
  447.     {
  448.         if (!IsPlayerInAnyVehicle(playerid)) {
  449.             if (Team[playerid] == TEAM_POLICE)
  450.             {
  451.                 if(CarSpawnsLeft[playerid] > 0) {
  452.                     switch(Occupation[playerid])
  453.                     {
  454.                         case OCCUPATION_STREETCOP:
  455.                         {
  456.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(596,1535.8418,-1673.7173,13.1032,179.2815,-1,-1,-1), "{0000FF}POLICE");
  457.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  458.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  459.                         }
  460.                         case OCCUPATION_BIKERCOP:
  461.                         {
  462.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(523,1535.8418,-1673.7173,13.1032,179.2815,-1,-1,-1), "{0000FF}POLICE");
  463.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  464.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  465.                         }
  466.                         case OCCUPATION_SWAT:
  467.                         {
  468.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(427,1535.8418,-1673.7173,13.1032,179.2815,-1,-1,-1), "{0000FF}POLICE");
  469.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  470.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  471.                         }
  472.                         case OCCUPATION_AIRSUPPORT:
  473.                         {
  474.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  475.                         }
  476.                         case OCCUPATION_RACECOP:
  477.                         {
  478.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(541,1535.8418,-1673.7173,13.1032,179.2815,79,53,-1), "{0000FF}POLICE");
  479.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  480.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  481.                         }
  482.                         case OCCUPATION_STEALTHSNIPER:
  483.                         {
  484.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(491,1535.8418,-1673.7173,13.1032,179.2815,0,0,-1), "{0000FF}POLICE");
  485.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  486.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  487.                         }
  488.                         case OCCUPATION_OFFROADCOP:
  489.                         {
  490.                             CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(599,1535.8418,-1673.7173,13.1032,179.2815,-1,-1,-1), "{0000FF}POLICE");
  491.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  492.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  493.                         }
  494.                     }
  495.                 } else {
  496.                     SendClientMessage(playerid, 0xFF0000AA, "You don't have any carspawns left for your current life.");
  497.                 }
  498.             } else {
  499.                 SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your team!");
  500.             }
  501.         } else {
  502.             SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use the carspawner!");
  503.         }
  504.     }
  505.     if(checkpointid == CarSpawner[3]) //Police helispawner
  506.     {
  507.         if (!IsPlayerInAnyVehicle(playerid)) {
  508.             if (Team[playerid] == TEAM_POLICE)
  509.             {
  510.                 if(CarSpawnsLeft[playerid] > 0) {
  511.                     switch(Occupation[playerid])
  512.                     {
  513.                         case OCCUPATION_AIRSUPPORT:
  514.                         {
  515.                             CarSpawnerCar[NextCarSpawnerCar] = CreateVehicle(497,1559.4893,-1610.9672,13.5597,91.0091,-1,-1,-1);
  516.                             NextCarSpawnerCar = NextCarSpawnerCar++;
  517.                             CarSpawnsLeft[playerid] = CarSpawnsLeft[playerid]-1;
  518.                         }
  519.                         case OCCUPATION_STREETCOP:
  520.                         {
  521.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  522.                         }
  523.                         case OCCUPATION_BIKERCOP:
  524.                         {
  525.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  526.                         }
  527.                         case OCCUPATION_SWAT:
  528.                         {
  529.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  530.                         }
  531.                         case OCCUPATION_RACECOP:
  532.                         {
  533.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  534.                         }
  535.                         case OCCUPATION_STEALTHSNIPER:
  536.                         {
  537.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  538.                         }
  539.                         case OCCUPATION_OFFROADCOP:
  540.                         {
  541.                             SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your occupation!");
  542.                         }
  543.                     }
  544.                 } else {
  545.                     SendClientMessage(playerid, 0xFF0000AA, "You don't have any carspawns left for your current life.");
  546.                 }
  547.             } else {
  548.                 SendClientMessage(playerid, 0xFF0000AA, "You must use the carspawner for your team!");
  549.             }
  550.         } else {
  551.             SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use the carspawner!");
  552.         }
  553.     }
  554.  
  555.     return 1;
  556. }
  557.  
  558. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  559. {
  560.     if(dialogid == SHOP_CARSHOP)
  561.     {
  562.         if(response)
  563.         {
  564.             if(listitem == 0)
  565.             {
  566.                 new playermoney;
  567.                 playermoney = GetPlayerMoney(playerid);
  568.                 if (playermoney >= 250) {
  569.                 if (CarShopCar[playerid] != -1) {
  570.                 DestroyVehicle(CarShopCar[playerid]);
  571.                 CarShopCar[playerid] = -1;
  572.                 }
  573.                 CarShopCar[playerid] = CreateVehicle(411,1776.6417,-1929.3938,13.1665,0.6010,-1,-1,-1);
  574.                 GivePlayerMoney(playerid, -250);
  575.                 } else {
  576.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  577.                 }
  578.             }
  579.             if(listitem == 1)
  580.             {
  581.                 new playermoney;
  582.                 playermoney = GetPlayerMoney(playerid);
  583.                 if (playermoney >= 350) {
  584.                 if (CarShopCar[playerid] != -1) {
  585.                 DestroyVehicle(CarShopCar[playerid]);
  586.                 CarShopCar[playerid] = -1;
  587.                 }
  588.                 CarShopCar[playerid] = CreateVehicle(451,1776.6417,-1929.3938,13.1665,0.6010,-1,-1,-1);
  589.                 GivePlayerMoney(playerid, -350);
  590.                 } else {
  591.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  592.                 }
  593.             }
  594.         }
  595.         return 1;
  596.     }
  597.    
  598.     if(dialogid == SHOP_JETPACKANDPARACHUTESHOP)
  599.     {
  600.         if(response)
  601.         {
  602.             if(listitem == 0)
  603.             {
  604.                 new playermoney;
  605.                 playermoney = GetPlayerMoney(playerid);
  606.                 if (playermoney >= 300) {
  607.                 SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
  608.                 GivePlayerMoney(playerid, -300);
  609.                 } else {
  610.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  611.                 }
  612.             }
  613.             if(listitem == 1)
  614.             {
  615.                 new playermoney;
  616.                 playermoney = GetPlayerMoney(playerid);
  617.                 if (playermoney >= 50) {
  618.                 GivePlayerWeapon(playerid, 46, 1);
  619.                 GivePlayerMoney(playerid, -50);
  620.                 } else {
  621.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  622.                 }
  623.             }
  624.         }
  625.         return 1;
  626.     }
  627.        
  628.     if(dialogid == SHOP_AIRCRAFTSHOP)
  629.     {
  630.         if(response)
  631.         {
  632.             if(listitem == 0)
  633.             {
  634.                 new playermoney;
  635.                 playermoney = GetPlayerMoney(playerid);
  636.                 if (playermoney >= 500) {
  637.                 if (AircraftShopVehicle[playerid] != -1) {
  638.                 DestroyVehicle(AircraftShopVehicle[playerid]);
  639.                 AircraftShopVehicle[playerid] = -1;
  640.                 }
  641.                 AircraftShopVehicle[playerid] = CreateVehicle(520,1681.7134,-2612.5090,14.2579,2.3501,-1,-1,-1);
  642.                 GivePlayerMoney(playerid, -500);
  643.                 } else {
  644.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  645.                 }
  646.             }
  647.             if(listitem == 1)
  648.             {
  649.                 new playermoney;
  650.                 playermoney = GetPlayerMoney(playerid);
  651.                 if (playermoney >= 600) {
  652.                 if (AircraftShopVehicle[playerid] != -1) {
  653.                 DestroyVehicle(AircraftShopVehicle[playerid]);
  654.                 AircraftShopVehicle[playerid] = -1;
  655.                 }
  656.                 AircraftShopVehicle[playerid] = CreateVehicle(425,1681.7134,-2612.5090,14.2579,2.3501,-1,-1,-1);
  657.                 GivePlayerMoney(playerid, -600);
  658.                 } else {
  659.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  660.                 }
  661.             }
  662.             return 1;
  663.         }
  664.     }
  665.     if(dialogid == SHOP_HEAVYWEAPONSSHOP)
  666.     {
  667.         if(response)
  668.         {
  669.             if(listitem == 0)
  670.             {
  671.                 new playermoney;
  672.                 playermoney = GetPlayerMoney(playerid);
  673.                 if (playermoney >= 800) {
  674.                 GivePlayerWeapon(playerid, 38, 150);
  675.                 GivePlayerMoney(playerid, -800);
  676.                 } else {
  677.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  678.                 }
  679.             }
  680.             if(listitem == 1)
  681.             {
  682.                 new playermoney;
  683.                 playermoney = GetPlayerMoney(playerid);
  684.                 if (playermoney >= 400) {
  685.                 GivePlayerWeapon(playerid, 35, 10);
  686.                 GivePlayerMoney(playerid, -400);
  687.                 } else {
  688.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  689.                 }
  690.             }
  691.             if(listitem == 2)
  692.             {
  693.                 new playermoney;
  694.                 playermoney = GetPlayerMoney(playerid);
  695.                 if (playermoney >= 400) {
  696.                 GivePlayerWeapon(playerid, 37, 150);
  697.                 GivePlayerMoney(playerid, -200);
  698.                 } else {
  699.                 ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
  700.                 }
  701.             }
  702.         }
  703.         return 1;
  704.     }
  705.    
  706.     if(dialogid == DIALOG_RULES)
  707.     {
  708.         if(response)
  709.         {
  710.             Status[playerid] = 1;
  711.             ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "To prevent other people using your account, you will have to password protect it.\nPlease enter the password you want to use:", "Register", "Quit");
  712.         } else {
  713.             Status[playerid] = 2;
  714.             SendClientMessage(playerid, 0xFF0000AA, "You must read and accept the rules to play on Sydcul's roleplay!");
  715.             Kick(playerid);
  716.         }
  717.         return 1;
  718.     }
  719.    
  720.     if(dialogid == DIALOG_REGISTER)
  721.     {
  722.         if(response)
  723.         {
  724.             new playername[MAX_PLAYER_NAME+1], filename[28+MAX_PLAYER_NAME];
  725.  
  726.             GetPlayerName(playerid, playername, sizeof(playername));
  727.             format(filename, sizeof(filename), "sydculsroleplay/players/%s.ini", playername);
  728.  
  729.             new INI:iniFile = INI_Open(filename);
  730.  
  731.             INI_SetTag(iniFile, "logindata");
  732.             INI_WriteString(iniFile, "password", inputtext);
  733.  
  734.             INI_Close(iniFile);
  735.             TogglePlayerSpectating(playerid, 0);
  736.         } else {
  737.             Status[playerid] = 2;
  738.             Kick(playerid);
  739.         }
  740.         return 1;
  741.     }
  742.    
  743.     if(dialogid == DIALOG_LOGIN)
  744.     {
  745.         if(response)
  746.         {
  747.             new playername[MAX_PLAYER_NAME+1], filename[28+MAX_PLAYER_NAME];
  748.  
  749.             GetPlayerName(playerid, playername, sizeof(playername));
  750.             format(filename, sizeof(filename), "sydculsroleplay/players/%s.ini", playername);
  751.  
  752.             INI_ParseFile(filename, "ini_%s");
  753.  
  754.             if (strcmp(inputtext, iniplayerpassword)) {
  755.                 SendClientMessage(playerid, 0xFF0000AA, "You have entered the wrong password");
  756.                 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password:", "Login", "Quit");
  757.             } else {
  758.                 TogglePlayerSpectating(playerid, 0);
  759.             }
  760.         } else {
  761.             Kick(playerid);
  762.         }
  763.         return 1;
  764.     }
  765.     return 0;
  766. }
  767. public OnVehicleDeath(vehicleid, killerid)
  768. {
  769.     for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  770.     {
  771.         if (vehicleid == CarShopCar[playerid]) {
  772.         DestroyVehicle(CarShopCar[playerid]);
  773.         CarShopCar[playerid] = -1;
  774.         }
  775.         if (vehicleid == AircraftShopVehicle[playerid]) {
  776.         DestroyVehicle(AircraftShopVehicle[playerid]);
  777.         AircraftShopVehicle[playerid] = -1;
  778.         }
  779.         for(new vehicle; vehicle < MAX_VEHICLES; vehicle++)
  780.         {
  781.             if (vehicleid == CarSpawnerCar[vehicle]) {
  782.                 DestroyVehicle(CarSpawnerCar[vehicle]);
  783.             }
  784.         }
  785.     }
  786.     return 1;
  787. }
  788.  
  789. public OnPlayerCommandText(playerid, cmdtext[])
  790. {
  791.     if (strcmp("/suicide", cmdtext, true, 8) == 0)
  792.     {
  793.         SetPlayerHealth(playerid, 0);
  794.         return 1;
  795.     }
  796.     if (strcmp("/class", cmdtext, true, 6) == 0)
  797.     {
  798.         ForceClassSelection(playerid);
  799.         TogglePlayerSpectating(playerid, true);
  800.         TogglePlayerSpectating(playerid, false);
  801.         return 1;
  802.     }
  803.     return 0;
  804. }
  805.  
  806. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  807. {
  808.     if(GetVehicleModel(vehicleid) == 592)
  809.     {
  810.         GivePlayerWeapon(playerid, 46, 1);
  811.     }
  812.     if(GetVehicleModel(vehicleid) == 577)
  813.     {
  814.         GivePlayerWeapon(playerid, 46, 1);
  815.     }
  816.     if(GetVehicleModel(vehicleid) == 511)
  817.     {
  818.         GivePlayerWeapon(playerid, 46, 1);
  819.     }
  820.     if(GetVehicleModel(vehicleid) == 512)
  821.     {
  822.         GivePlayerWeapon(playerid, 46, 1);
  823.     }
  824.     if(GetVehicleModel(vehicleid) == 593)
  825.     {
  826.         GivePlayerWeapon(playerid, 46, 1);
  827.     }
  828.     if(GetVehicleModel(vehicleid) == 520)
  829.     {
  830.         GivePlayerWeapon(playerid, 46, 1);
  831.     }
  832.     if(GetVehicleModel(vehicleid) == 553)
  833.     {
  834.         GivePlayerWeapon(playerid, 46, 1);
  835.     }
  836.     if(GetVehicleModel(vehicleid) == 476)
  837.     {
  838.         GivePlayerWeapon(playerid, 46, 1);
  839.     }
  840.     if(GetVehicleModel(vehicleid) == 519)
  841.     {
  842.         GivePlayerWeapon(playerid, 46, 1);
  843.     }
  844.     if(GetVehicleModel(vehicleid) == 460)
  845.     {
  846.         GivePlayerWeapon(playerid, 46, 1);
  847.     }
  848.     if(GetVehicleModel(vehicleid) == 513)
  849.     {
  850.         GivePlayerWeapon(playerid, 46, 1);
  851.     }
  852.     if(GetVehicleModel(vehicleid) == 548)
  853.     {
  854.         GivePlayerWeapon(playerid, 46, 1);
  855.     }
  856.     if(GetVehicleModel(vehicleid) == 425)
  857.     {
  858.         GivePlayerWeapon(playerid, 46, 1);
  859.     }
  860.     if(GetVehicleModel(vehicleid) == 417)
  861.     {
  862.         GivePlayerWeapon(playerid, 46, 1);
  863.     }
  864.     if(GetVehicleModel(vehicleid) == 487)
  865.     {
  866.         GivePlayerWeapon(playerid, 46, 1);
  867.     }
  868.     if(GetVehicleModel(vehicleid) == 488)
  869.     {
  870.         GivePlayerWeapon(playerid, 46, 1);
  871.     }
  872.     if(GetVehicleModel(vehicleid) == 497)
  873.     {
  874.         GivePlayerWeapon(playerid, 46, 1);
  875.     }
  876.     if(GetVehicleModel(vehicleid) == 563)
  877.     {
  878.         GivePlayerWeapon(playerid, 46, 1);
  879.     }
  880.     if(GetVehicleModel(vehicleid) == 447)
  881.     {
  882.         GivePlayerWeapon(playerid, 46, 1);
  883.     }
  884.     if(GetVehicleModel(vehicleid) == 469)
  885.     {
  886.         GivePlayerWeapon(playerid, 46, 1);
  887.     }
  888.     return 1;
  889. }
Advertisement
Add Comment
Please, Sign In to add comment