Guest User

Untitled

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