Setting a car for just one team not working. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Setting a car for just one team not working. (
/showthread.php?tid=454920)
Setting a car for just one team not working. -
Magic_Time - 30.07.2013
Hello,
I'm trying to set car ID 574 just for one team so if a player is from other team, he won't be able to enter in the car and drive it.
Here is my code:
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new sweeper = GetPlayerVehicleID(playerid);
if(sweeper == 574)
{
if(Team[playerid] != TEAM_SWEEPER)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_LIRED, " You need to be a Street Sweeper to use this car ");
}
else
{
SendClientMessage(playerid, -1, "You're driving car id 574");
}
}
}
return 1;
}
Sorry for my bad english.
Re: Setting a car for just one team not working. -
IstuntmanI - 30.07.2013
Change
pawn Код:
new sweeper = GetPlayerVehicleID(playerid);
if(sweeper == 574)
to
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
574 is the model, not the vehicle ID.