Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define GMid 222 // edit ID..
- static gTeam[MAX_PLAYERS];
- #define TEAM_GREEN 1
- #define TEAM_BLUE 2
- #define TEAM_NIL 255
- #define TEAM_GREEN_COLOR 0x33AA33FF
- #define TEAM_BLUE_COLOR 0x1111AAFF
- #define MAX_CP 18
- new Counter[2];
- new Text:Textdraw0;
- new Text:Textdraw1;
- new timer1;
- new Seconds = 59;
- new Minutes = 4;
- new Text:TextdrawGwin;
- new Text:TextdrawBwin;
- new Text:TextdrawDraw;
- new Text:TextdrawDraw2;
- new ROBBERS_COUNTER = 0;
- new COPS_COUNTER = 0;
- new ROBBERS_FINISH = 0;
- new cpcounter[MAX_PLAYERS];
- new PlayersOnline;
- new bool:IsSpawnLocked = false;
- new bool:IsSpawned[MAX_PLAYERS];
- forward CuentaRegresiva(playerid);
- new CuentaNum;
- new CuentaTimer;
- // forward declarations for the PAWN compiler (not really needed, but there for the sake of clarity)
- forward Timer();
- forward CountDown(playerid);
- forward LockSpawn();
- forward TimeUpGwin(playerid);
- forward TimeUpBwin(playerid);
- forward TimeUpDraw(playerid);
- forward TimeUpDraw2(playerid);
- forward SetPlayerToTeamColor(playerid);
- forward SetPlayerTeamFromClass(playerid,classid);
- forward ExitTheGameMode();
- forward Count();
- forward CountDown(playerid);
- forward GetGMid();
- forward CheckRoundEnd();
- forward RoundEnd();
- new Float:CP[][] =
- {
- {-1711.9037, 851.2945, 23.7301},
- {-1713.4797, 1079.2675, 44.1636},
- {-1708.0636, 1187.6373, 23.9657},
- {-1651.2085, 1250.8431, 6.1605},
- {-1817.4364, 1368.6686, 6.1492},
- {-2041.4358, 1299.1973, 6.1170},
- {-2255.1399, 1261.9910, 40.9343},
- {-2260.8489, 1182.4492, 54.5350},
- {-2366.6340, 1173.6156, 39.7797},
- {-2468.2898, 1212.2280, 34.0509},
- {-2577.5676, 1228.6389, 33.9705},
- {-2716.2681, 1094.5690, 45.2698},
- {-2750.4175, 1010.7175, 53.3103},
- {-2667.0654, 1005.0693, 63.2258},
- {-2605.7737, 1011.4278, 77.1329},
- {-2593.7722, 1126.0298, 54.6817},
- {-2672.0854, 1246.8558, 54.4058},
- {-2691.5435, 1449.6410, 54.3746},
- {0.0,0.0,0.0}
- };
- enum PLAYER_INFOS
- {
- Float:Pos[3]
- };
- main()
- {
- print("\n--------------------");
- print("Heist at Midnight");
- print("----------------------\n");
- }
- public SetPlayerToTeamColor(playerid)
- {
- if(gTeam[playerid] == TEAM_GREEN) {
- SetPlayerColor(playerid,TEAM_GREEN_COLOR); // green
- } else if(gTeam[playerid] == TEAM_BLUE) {
- SetPlayerColor(playerid,TEAM_BLUE_COLOR); // blue
- }
- }
- //---------------------------------------------------------
- public SetPlayerTeamFromClass(playerid,classid)
- {
- // Set their team number based on the class they selected.
- if(classid == 0) {
- gTeam[playerid] = TEAM_GREEN;
- } else if(classid == 1) {
- gTeam[playerid] = TEAM_BLUE;
- }
- }
- //---------------------------------------------------------
- public ExitTheGameMode()
- {
- CallRemoteFunction("ChangeGMNow", "");
- }
- //---------------------------------------------------------
- public LockSpawn()
- {
- IsSpawnLocked = true;
- return 1;
- }
- //---------------------------------------------------------
- public OnGameModeInit()
- {
- SetTimer("CheckRoundEnd",40000,0);
- SetTimer("RoundEnd", 420000, 0);
- SetTimer("LockSpawn",30000,0);
- EnableStuntBonusForAll(0);
- AllowInteriorWeapons(0);
- DisableInteriorEnterExits();
- UsePlayerPedAnims();
- ShowPlayerMarkers(1);
- ShowNameTags(1);
- CuentaTimer = SetTimer("CuentaRegresiva",1000,true);
- CuentaNum = 20;
- SetWeather(37);
- SetWorldTime(0);
- // GREEN
- AddPlayerClass(86,-1731.76147,813.16803,24.82720,90.0,0,0,0,0,0,0); // GREEN 1 numbers = ID of skin.
- // BLUE
- AddPlayerClass(280,-1720.73889,664.09387,24.61884,90.0,0,0,0,0,0,0);
- //ROB VEHS
- CreateVehicle(522, -1740.3068, 817.0058, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1740.3358, 818.3329, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1740.4033, 819.8720, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1740.3258, 821.2183, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1740.2010, 822.4521, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1739.9679, 823.6610, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.2605, 817.1613, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.3934, 818.5414, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.3486, 820.1271, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.2694, 821.3568, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.1116, 822.4233, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1743.3208, 823.8499, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.7809, 823.9477, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.6797, 822.4297, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.8799, 821.2422, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.8276, 819.9532, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.8027, 818.4818, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1746.5829, 817.0383, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.0814, 817.1669, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.2391, 818.5353, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.2570, 819.7888, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.2826, 821.2861, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.2168, 822.4850, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1749.1638, 823.8832, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1752.1196, 824.3314, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1752.1725, 822.9330, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1752.2094, 821.5958, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1752.0392, 820.0997, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1752.2012, 818.5338, 24.4609, -92.3400, -1, -1, 100);
- CreateVehicle(522, -1751.9855, 816.8885, 24.4609, -92.3400, -1, -1, 100);
- //COPS VEHS
- CreateVehicle(523, -1709.0222, 670.6631, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1710.3422, 670.7680, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1711.7770, 670.8942, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1713.0083, 670.9897, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1714.3348, 671.1133, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1715.6138, 671.2567, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1715.6855, 667.9114, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1714.1833, 667.6787, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1712.7971, 667.6338, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1711.4644, 667.2491, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1710.0245, 667.4993, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1708.7184, 667.2127, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1708.7557, 663.4742, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1710.0848, 663.7767, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1711.5157, 663.9609, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1712.7754, 664.0927, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1714.1863, 664.2803, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1715.6696, 664.2933, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1715.7933, 660.6775, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1714.5375, 660.4792, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1712.9611, 660.5825, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1711.2935, 660.2107, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1709.9381, 660.0189, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1708.9203, 660.0857, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1715.8799, 656.8943, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1714.5161, 656.8981, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1713.3291, 656.9548, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1711.7474, 656.9232, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1710.5306, 656.8373, 24.1289, 0.0000, -1, -1, 100);
- CreateVehicle(523, -1709.4635, 656.9023, 24.1289, 0.0000, -1, -1, 100);
- //DECO STUFF
- CreateObject(1422, -2063.59375, 1305.87512, 6.39935, 0.00000, 0.00000, 43.50000);
- CreateObject(1422, -2061.12622, 1309.50574, 6.39935, 0.00000, 0.00000, 65.57999);
- CreateObject(1422, -2059.41211, 1313.83728, 6.39935, 0.00000, 0.00000, 65.57999);
- CreateObject(1422, -2058.65942, 1317.45203, 6.39935, 0.00000, 0.00000, 110.16000);
- CreateObject(1422, -2262.58057, 1169.10181, 54.94670, 0.00000, 0.00000, 23.04000);
- CreateObject(1422, -2268.32983, 1167.54407, 54.94670, 0.00000, 0.00000, 17.76000);
- CreateObject(1422, -2253.62695, 1173.22949, 54.94670, 0.00000, 0.00000, 28.50000);
- CreateObject(1422, -2251.40332, 1175.08850, 54.94670, 0.00000, 0.00000, 44.34000);
- CreateObject(1422, -2247.53467, 1181.31250, 54.94670, 0.00000, 0.00000, 56.58000);
- CreateObject(1422, -2245.65405, 1186.04578, 54.94670, 0.00000, 0.00000, 62.93999);
- CreateObject(1422, -2271.59424, 1165.85413, 55.09791, 0.00000, 0.00000, 1.56000);
- CreateObject(1422, -2474.38354, 1205.35791, 34.13298, 0.00000, 0.00000, -44.10000);
- CreateObject(1422, -2472.43848, 1203.42480, 34.13298, 0.00000, 0.00000, -44.10000);
- CreateObject(1422, -2469.77881, 1200.76379, 34.13298, 0.00000, 0.00000, -44.10000);
- CreateVehicle(427, -2065.5242, 1309.6233, 6.8825, -42.6000, -1, -1, 100);
- CreateVehicle(599, -2062.3306, 1317.3171, 7.0174, -184.2000, -1, -1, 100);
- CreateVehicle(427, -2244.5549, 1182.4834, 55.6281, 151.5000, -1, -1, 100);
- CreateVehicle(599, -2258.4697, 1167.4910, 55.6959, -44.1600, -1, -1, 100);
- CreateVehicle(599, -2252.3184, 1170.3639, 55.6959, 139.9800, -1, -1, 100);
- CreateVehicle(599, -2247.6521, 1176.0781, 55.6959, 139.9800, -1, -1, 100);
- CreateVehicle(427, -2266.1809, 1164.6744, 55.4680, -84.4800, -1, -1, 100);
- CreateVehicle(427, -2469.7134, 1197.6115, 35.0029, 42.3000, -1, -1, 100);
- CreateVehicle(427, -2476.8030, 1204.3225, 35.0029, 42.3000, -1, -1, 100);
- CreateObject(1422, -2466.78931, 1197.45752, 34.44517, 0.00000, 0.00000, -44.10000);
- Textdraw0 = TextDrawCreate(497.000000,396.000000,"~y~Robbers: ~w~0 ~n~~r~Cops: ~w~0");
- TextDrawUseBox(Textdraw0,1);
- TextDrawBoxColor(Textdraw0,0x00000099);
- TextDrawTextSize(Textdraw0,591.000000,-38.000000);
- TextDrawAlignment(Textdraw0,0);
- TextDrawBackgroundColor(Textdraw0,0x000000ff);
- TextDrawFont(Textdraw0,2);
- TextDrawLetterSize(Textdraw0,0.199999,1.600000);
- TextDrawColor(Textdraw0,0xffffffff);
- TextDrawSetOutline(Textdraw0,1);
- TextDrawSetProportional(Textdraw0,1);
- TextDrawSetShadow(Textdraw0,1);
- Textdraw1 = TextDrawCreate(495.000000, 3.000000, "Time Left: 05:00");
- TextDrawBackgroundColor(Textdraw1, 255);
- TextDrawFont(Textdraw1, 1);
- TextDrawLetterSize(Textdraw1, 0.500000, 1.800000);
- TextDrawColor(Textdraw1, -1);
- TextDrawSetOutline(Textdraw1, 0);
- TextDrawSetProportional(Textdraw1, 1);
- TextDrawSetShadow(Textdraw1, 1);
- timer1 = SetTimer("CountDown", 1000, true);
- TextdrawGwin = TextDrawCreate(325.916656, 203.250038, "~y~Robbers ~w~escaped!"); // Green Team win
- TextDrawBackgroundColor(TextdrawGwin, 255);
- TextDrawFont(TextdrawGwin, 3);
- TextDrawAlignment(TextdrawGwin, 2);
- TextDrawLetterSize(TextdrawGwin, 0.94125, 3.760000);
- TextDrawColor(TextdrawGwin, -1);
- TextDrawSetOutline(TextdrawGwin, 0);
- TextDrawSetProportional(TextdrawGwin, 1);
- TextDrawSetShadow(TextdrawGwin, 1);
- TextDrawSetSelectable(TextdrawGwin, 0);
- TextdrawBwin = TextDrawCreate(325.916656, 203.250038, "~r~Cops ~w~win!"); // Blue team win
- TextDrawBackgroundColor(TextdrawBwin, 255);
- TextDrawFont(TextdrawBwin, 3);
- TextDrawAlignment(TextdrawBwin, 2);
- TextDrawLetterSize(TextdrawBwin, 0.94125, 3.760000);
- TextDrawColor(TextdrawBwin, -1);
- TextDrawSetOutline(TextdrawBwin, 0);
- TextDrawSetProportional(TextdrawBwin, 1);
- TextDrawSetShadow(TextdrawBwin, 1);
- TextDrawSetSelectable(TextdrawBwin, 0);
- }
- public OnGameModeExit()
- {
- TextDrawDestroy(Textdraw0);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPlayerColor(playerid,0xCECECEFF);
- SendClientMessage(playerid,0xff59599f,"*Currently playing: ID 222 - Heist at Midnight (Last Team Standing)");
- TextDrawShowForPlayer(playerid,Textdraw0);
- TextDrawShowForPlayer(playerid,Textdraw1);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- if(GetPVarInt(playerid, "team") == TEAM_GREEN && GetPVarInt(playerid, "spectating") == 0 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- Counter[0] -= 1;
- }
- else if(GetPVarInt(playerid, "team") == TEAM_BLUE && GetPVarInt(playerid, "spectating") == 0 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- Counter[1] -= 1;
- }
- new String[75];
- format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]); // Edit names
- TextDrawSetString(Textdraw0, String); // ~b~ = blue :3
- TextDrawHideForPlayer(playerid,Textdraw0);
- return 1;
- }
- //---------------------------------------------------------
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerTeamFromClass(playerid,classid);
- if(classid == 0)
- {
- GameTextForPlayer(playerid,"~y~Robbers",1000,5); // Green team. Edit name
- SetPVarInt(playerid, "team", 1);
- }
- else if(classid == 1)
- {
- GameTextForPlayer(playerid,"~r~Cops",1000,5); // Blue team. Edit name
- SetPVarInt(playerid, "team", 2);
- }
- return 1;
- }
- //---------------------------------------------------------
- public OnPlayerSpawn(playerid)
- {
- SetPlayerToTeamColor(playerid);
- SetPlayerInterior(playerid, 0);
- if(IsSpawnLocked == true)
- {
- TogglePlayerSpectating(playerid,1);
- SetPVarInt(playerid, "team", TEAM_NIL);
- SetPlayerTeam(playerid,TEAM_NIL);
- SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
- GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
- SetPVarInt(playerid, "spectating", 1);
- SetPVarInt(playerid, "blockrespawn", 1);
- SetPlayerColor(playerid,0xAFAFAFAA);
- }
- else
- {
- new veh = playerid+1;
- SetPVarInt(playerid, "spectating", 0);
- if(GetPVarInt(playerid, "team") == TEAM_GREEN)
- {
- PutPlayerInVehicle(playerid,veh,0);
- ROBBERS_COUNTER++;
- cpcounter[playerid] = 0;
- SetPlayerRaceCheckpoint(playerid,0,CP[cpcounter[playerid]][0],CP[cpcounter[playerid]][1],CP[cpcounter[playerid]][2],CP[cpcounter[playerid]+1][0],CP[cpcounter[playerid]+1][1],CP[cpcounter[playerid]+1][2],14);
- TogglePlayerControllable(playerid,false);
- CallRemoteFunction("SafeGiveWeapon","ddd", playerid, 29, 7000); // weapons of Green team..
- SetPlayerTeam(playerid, 1);
- Counter[0] += 1;
- }
- else if(GetPVarInt(playerid, "team") == TEAM_BLUE)
- {
- PutPlayerInVehicle(playerid,veh+30,0);
- COPS_COUNTER++;
- CallRemoteFunction("SafeGiveWeapon","ddd", playerid, 29, 7000); // weapons of blue team..
- SetPlayerTeam(playerid, 2);
- Counter[1] += 1;
- }
- }
- new String[75];
- format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]); // Edit team name
- TextDrawSetString(Textdraw0, String);
- if(IsSpawned[playerid] == true){
- }
- return 1;
- }
- //---------------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- IsSpawned[playerid] = false;
- if(IsPlayerConnected(playerid))
- {
- if(gTeam[playerid] == TEAM_GREEN && GetPVarInt(playerid, "blockrespawn") == 0 && (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING))
- {
- TogglePlayerSpectating(playerid,1);
- ROBBERS_COUNTER--;
- SetPVarInt(playerid, "team", TEAM_NIL);
- SetPlayerTeam(playerid,TEAM_NIL);
- PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
- SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
- GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
- SetPVarInt(playerid, "spectating", 1);
- SetPVarInt(playerid, "blockrespawn", 1);
- SetPlayerColor(playerid,0xAFAFAFAA);
- Counter[0] -= 1;
- }
- else if(gTeam[playerid] == TEAM_BLUE && GetPVarInt(playerid, "blockrespawn") == 0 && (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING))
- {
- TogglePlayerSpectating(playerid,1);
- COPS_COUNTER--;
- SetPVarInt(playerid, "team", TEAM_NIL);
- SetPlayerTeam(playerid,TEAM_NIL);
- PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
- SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
- GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
- SetPVarInt(playerid, "spectating", 1);
- SetPVarInt(playerid, "blockrespawn", 1);
- SetPlayerColor(playerid,0xAFAFAFAA);
- Counter[1] -= 1;
- }
- else
- {
- TogglePlayerSpectating(playerid,1);
- SetPVarInt(playerid, "team", TEAM_NIL);
- SetPlayerTeam(playerid,TEAM_NIL);
- PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
- SendClientMessage(playerid, 0xEB025F, "You are late, the game already started");
- SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
- GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
- SetPVarInt(playerid, "spectating", 1);
- SetPVarInt(playerid, "blockrespawn", 1);
- SetPlayerColor(playerid,0xAFAFAFAA);
- }
- new String[75];
- format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]);
- TextDrawSetString(Textdraw0, String); // edit team name
- }
- if(gTeam[killerid] != gTeam[playerid])
- {
- GiveMoney(killerid,20);
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- }
- return 1;
- }
- //---------------------------------------------------------
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (newkeys & KEY_FIRE)
- {
- if(GetPVarInt(playerid, "spectating") == 1)
- {
- PlayerSpectatePlayer(playerid, RandomPlayer(),SPECTATE_MODE_NORMAL);
- }
- }
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- if(cpcounter[playerid] < 17){
- cpcounter[playerid]++;
- SetPlayerRaceCheckpoint(playerid,0,CP[cpcounter[playerid]][0],CP[cpcounter[playerid]][1],CP[cpcounter[playerid]][2],CP[cpcounter[playerid]+1][0],CP[cpcounter[playerid]+1][1],CP[cpcounter[playerid]+1][2],14);
- } else if(cpcounter[playerid] >= 17){
- DisablePlayerRaceCheckpoint(playerid);
- SetPlayerVirtualWorld(playerid,13);
- ROBBERS_FINISH++;
- cpcounter[playerid]= -1;
- GameTextForPlayer(playerid,"Winner",5000,5);
- }
- }
- public OnPlayerRequestSpawn(playerid)
- {
- /*
- if(CallRemoteFunction("IsPlayerVIP", "i", playerid)) return 1;
- new team1count, team2count;
- for(new i, m = GetMaxPlayers(); i < m; i++)
- {
- if (IsPlayerConnected(i))
- {
- if (gTeam[i] == TEAM_GREEN) team1count++;
- else if (gTeam[i] == TEAM_BLUE) team2count++;
- }
- }
- if (gTeam[playerid] == TEAM_GREEN)
- {
- if(team1count > team2count)
- {
- SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
- return 0;
- }
- }
- else if (gTeam[playerid] == TEAM_BLUE)
- {
- if (team2count > team1count)
- {
- SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
- return 0;
- }
- }
- return 1;
- }
- */
- if(CallRemoteFunction("IsPlayerVIP", "i", playerid)) return 1;
- new team1count, team2count;
- PlayersOnline++;
- for(new i, m = GetMaxPlayers(); i < m; i++)
- {
- if (IsPlayerConnected(i))
- {
- if (gTeam[i] == TEAM_GREEN) team1count++;
- else if (gTeam[i] == TEAM_BLUE) team2count++;
- }
- }
- if (gTeam[playerid] == TEAM_GREEN)
- {
- if(team1count > team2count+1)
- {
- SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
- return 0;
- }
- }
- else if (gTeam[playerid] == TEAM_BLUE)
- {
- if (team2count > team1count+1)
- {
- SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
- return 0;
- }
- }
- return 1;
- }
- //---------------------------------------------------------
- public GetGMid()
- {
- return GMid;
- }
- //---------------------------------------------------------
- public CountDown(playerid)
- {
- Seconds--;
- if(Seconds <= -1)
- {
- Minutes--;
- Seconds = 59;
- }
- else if(Minutes <= 0 && Seconds <= 0)
- {
- KillTimer(timer1);
- }
- new string[178];
- format(string,sizeof(string),"Time Left: %02d:%02d",Minutes, Seconds);
- TextDrawSetString(Textdraw1,string);
- return 1;
- }
- //---------------------------------------------------------
- public CheckRoundEnd()
- {
- new HalfPlayers = PlayersOnline/2;
- if(ROBBERS_COUNTER < HalfPlayers || ROBBERS_COUNTER == 0)
- {
- TextDrawShowForAll(TextdrawBwin);
- SetTimer("TimeUpBwin", 6000, false);
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && gTeam[i] == TEAM_BLUE && GetPlayerState(i) == PLAYER_STATE_ONFOOT)
- {
- CallRemoteFunction("AddPlayerSurvivedCount","d",i);
- SetPlayerScore(i,GetPlayerScore(i)+5);
- GiveMoney(i,1000);
- }
- }
- SetTimer("ExitTheGameMode",3500,0);
- }
- else if(ROBBERS_FINISH >= HalfPlayers)
- {
- TextDrawShowForAll(TextdrawGwin);
- SetTimer("TimeUpGwin", 6000, false);
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && gTeam[i] == TEAM_GREEN && GetPlayerState(i) == PLAYER_STATE_ONFOOT)
- {
- CallRemoteFunction("AddPlayerSurvivedCount","d",i);
- SetPlayerScore(i,GetPlayerScore(i)+5);
- GiveMoney(i,1000);
- }
- }
- SetTimer("ExitTheGameMode",3500,0);
- }
- }
- //---------------------------------------------------------
- public RoundEnd()
- {
- new HalfPlayers = PlayersOnline/2;
- if(ROBBERS_COUNTER < HalfPlayers ||ROBBERS_COUNTER == 0)
- {
- TextDrawShowForAll(TextdrawBwin);
- SetTimer("TimeUpBwin", 6000, false);
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && gTeam[i] == TEAM_BLUE)
- {
- SetPlayerScore(i,GetPlayerScore(i)+5);
- GiveMoney(i,1000);
- }
- }
- SetTimer("ExitTheGameMode",3500,0);
- }
- if(ROBBERS_FINISH >= HalfPlayers)
- {
- TextDrawShowForAll(TextdrawGwin);
- SetTimer("TimeUpGwin", 6000, false);
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && gTeam[i] == TEAM_GREEN)
- {
- SetPlayerScore(i,GetPlayerScore(i)+5);
- GiveMoney(i,1000);
- }
- }
- SetTimer("ExitTheGameMode",3500,0);
- }
- }
- //STOCKS
- stock RandomPlayer()
- {
- new yplayer[MAX_PLAYERS+1];
- for (new y = 0; y != MAX_PLAYERS; y ++) {
- new Float:health;
- GetPlayerHealth(y,health);
- if (IsPlayerConnected(y) && health > 0 && GetPlayerState(y) == PLAYER_STATE_ONFOOT) {
- yplayer[0] ++;
- yplayer[yplayer[0]] = y;
- }
- }
- if (yplayer[0] == 0) return -1;
- return yplayer[random(yplayer[0])+1];
- }
- stock PlayerName(playerid)
- {
- new name[24];
- GetPlayerName(playerid, name, 24);
- return name;
- }
- stock GiveMoney(playerid, amount)
- {
- CallRemoteFunction("GivePlayerCash","dd", playerid, amount);
- }
- public TimeUpGwin()
- {
- TextDrawHideForAll(TextdrawGwin);
- }
- public TimeUpBwin()
- {
- TextDrawHideForAll(TextdrawBwin);
- }
- public TimeUpDraw()
- {
- TextDrawHideForAll(TextdrawDraw);
- }
- public TimeUpDraw2()
- {
- TextDrawHideForAll(TextdrawDraw2);
- }
- public CuentaRegresiva(playerid){
- if(CuentaNum > 0){
- for(new i; i < MAX_PLAYERS; i++){
- TogglePlayerControllable(i,false);
- }
- new conteotext[256];format(conteotext,sizeof(conteotext),"%i",CuentaNum);
- GameTextForAll(conteotext,1000,5);
- CuentaNum --;
- } else {
- GameTextForAll("GOOO!!!",1000,5);
- KillTimer(CuentaTimer);
- CuentaNum = -1;
- for(new i; i < MAX_PLAYERS; i++){
- TogglePlayerControllable(i,true);
- }
- }
- return 1;
- }
- CMD:statics(playerid,params[]){
- new textt[256];
- format(textt,sizeof(textt),"Players Spawneados: %i", PlayersOnline);
- SendClientMessage(playerid,0xFF0000,textt);
- format(textt,sizeof(textt),"Players Robbers que ganaron: %i", ROBBERS_FINISH);
- SendClientMessage(playerid,0xFF0000,textt);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement