how to certain team can enter a car TEAM_MEDIC etc - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to certain team can enter a car TEAM_MEDIC etc (
/showthread.php?tid=129489)
how to certain team can enter a car TEAM_MEDIC etc -
hardstop - 22.02.2010
I want
that TEAM_MEDIC can drive Ambulance car and other teams cant
Re: how to certain team can enter a car TEAM_MEDIC etc -
Torran - 22.02.2010
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(vehicleid) == 416)
{
if(!GetPlayerTeam .....
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
SORRY THATS WRONG IL EDIT IT
EDITED TRY THT
Re: how to certain team can enter a car TEAM_MEDIC etc -
hardstop - 22.02.2010
Where i add it under ?
Re: how to certain team can enter a car TEAM_MEDIC etc -
Torran - 22.02.2010
[B]OnPlayerStateChange
Re: how to certain team can enter a car TEAM_MEDIC etc -
hardstop - 22.02.2010
i get 4 errors
Re: how to certain team can enter a car TEAM_MEDIC etc -
Torran - 22.02.2010
Lol yeah sorry about that
Here this is from my script,
Edit it, It should work i havent tested it yet
pawn Код:
forward IsACopCar(vehicleid);
forward IsAmbulance(vehicleid);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsACopCar(vehicleid))
{
if(GetPlayerTeam(playerid) == TEAM_POLICE)
{
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
if(IsAmbulance(vehicleid))
{
if(GetPlayerTeam(playerid) == TEAM_MEDIC)
{
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to drive this vehicle");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
public IsACopCar(vehicleid)
{
if(GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599)
{
return 1;
}
else return 0;
}
public IsAmbulance(vehicleid)
{
if(GetVehicleModel(vehicleid) == 416)
{
return 1;
}
else return 0;
}
Re: how to certain team can enter a car TEAM_MEDIC etc -
hardstop - 22.02.2010
1 warning
Код:
warning 219: local variable "vehicleid" shadows a variable at a preceding level
Re: how to certain team can enter a car TEAM_MEDIC etc -
Torran - 22.02.2010
Do you have vehicleid at top of your script?
Re: how to certain team can enter a car TEAM_MEDIC etc -
hardstop - 22.02.2010
I think not
?
Re: how to certain team can enter a car TEAM_MEDIC etc -
Torran - 22.02.2010
Search your script for
new vehicleid = GetPlayerVehicleID(playerid);
Do you find it anywhere?
If not then
new vehicleid;
See if you can find that