14.02.2014, 17:21
Hey everyone, I'm trying to create vehicles that can only be entered by specific teams, it compiles with no errors, however the script doesn't work for, except for 1 car (Burrito, from Grovestreet)..
Here's the script
I think I might know what I did wrong, because it only has 1 place to store the car it only stores the latest cars, e.g. RifeCar6, VagosCar6... Not sure how to fix this. Anyone?
Here's the script
Код HTML:
enum TeamCars { Grove, Ballas, Vagos, Rifa } new Cars[TeamCars];
Код HTML:
public OnPlayerStateChange(playerid, newstate, oldstate) { if (AdminDuty[playerid] == 0) { if(newstate == 2) { new CarCheck = GetPlayerVehicleID(playerid); if(CarCheck == Cars[Grove] ) { if(gTeam[playerid] != TEAM_GROVE) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "Only Grovestreet members can enter this vehicle!"); return 1; } } else if(CarCheck == Cars[Ballas]) { if(gTeam[playerid] != TEAM_BALLAS) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "Only Ballas members can enter this vehicle!"); return 1; } } else if(CarCheck == Cars[Vagos]) { if(gTeam[playerid] != TEAM_VAGOS) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "Only Vagos members can enter this vehicle!"); return 1; } } else if(CarCheck == Cars[Rifa]) { if(gTeam[playerid] != TEAM_RIFA) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "Only Rifa members can enter this vehicle!"); return 1; } } return 1; } } return 1; }
Код HTML:
Cars[Grove] = CreateVehicle(566,2505.5374,-1679.1711,13.2399,318.4229,137,137,900); // GroveCar1 Cars[Grove] = CreateVehicle(534,2501.8450,-1655.5796,13.1842,64.4578,137,137,30); // GroveCar2 Cars[Grove] = CreateVehicle(567,2473.1482,-1692.2168,13.3855,359.5531,137,1,30); // GroveCar3 Cars[Grove] = CreateVehicle(560,2468.8552,-1653.2006,13.1075,91.6074,137,137,30); // GroveCar4 Cars[Grove] = CreateVehicle(549,2468.5483,-1670.8950,13.0936,9.6306,16,191,30); // GroveCar5 Cars[Grove] = CreateVehicle(482,2479.6206,-1747.2933,13.6672,0.1330,137,137,30); // GroveCar6 Cars[Ballas] = CreateVehicle(560,2186.6372,-1664.1183,14.4850,167.9805,179,179,30); // BallasCar1 Cars[Ballas] = CreateVehicle(405,2180.9707,-1695.8414,13.5073,355.4989,179,179,30); // BallasCar2 Cars[Ballas] = CreateVehicle(492,2179.8796,-1633.0276,14.7230,75.5031,179,242,30); // BallasCar3 Cars[Ballas] = CreateVehicle(562,2230.5303,-1669.5588,14.6620,347.1230,179,179,30); // BallasCar4 Cars[Ballas] = CreateVehicle(542,2172.0669,-1726.8837,13.2831,267.4980,179,179,30); // BallasCar5 Cars[Ballas] = CreateVehicle(533,2223.2341,-1708.8572,13.2288,174.7177,179,1,30); // BallasCar6 Cars[Vagos] = CreateVehicle(474,2796.3516,-1584.9945,10.6900,269.3987,6,228,30); // VagosCar1 Cars[Vagos] = CreateVehicle(419,2802.8359,-1540.2955,10.7194,181.8919,6,6,30); // VagosCar2 Cars[Vagos] = CreateVehicle(576,2796.8464,-1571.5792,10.5361,271.7090,6,1,30); // VagosCar3 Cars[Vagos] = CreateVehicle(575,2821.9460,-1557.8423,10.5277,89.5763,6,126,30); // VagosCar4 Cars[Vagos] = CreateVehicle(475,2851.3184,-1555.0378,10.8089,162.4337,6,5,30); // VagosCar5 Cars[Vagos] = CreateVehicle(560,2796.2771,-1558.6921,10.6268,90.6884,6,6,30); // VagosCar6 Cars[Rifa] = CreateVehicle(474,2656.1956,-2009.3064,13.2271,268.6646,135,1,30); // RifaCar1 Cars[Rifa] = CreateVehicle(567,2644.8674,-2032.7892,13.4145,0.5363,135,1,30); // RifaCar2 Cars[Rifa] = CreateVehicle(560,2684.7190,-1990.5293,13.2595,181.0272,135,1,30); // RifaCar3 Cars[Rifa] = CreateVehicle(482,2764.7307,-2007.2057,13.6727,0.3411,135,1,30); // RifaCar4 Cars[Rifa] = CreateVehicle(527,2788.3364,-1989.4805,13.1794,86.1457,135,1,30); // RifaCar5 Cars[Rifa] = CreateVehicle(466,2786.8862,-1944.7605,13.2887,87.9375,135,1,30); // RifaCar6