Preventing classes from entering vehicles? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Preventing classes from entering vehicles? (
/showthread.php?tid=330461)
Preventing classes from entering vehicles? -
daac - 01.04.2012
I am trying to exclude a specific class from entering vehicles (Zombies)
Is there any function for this, I cannot find one.
Thanks
Re: Preventing classes from entering vehicles? -
antonio112 - 01.04.2012
You can either use OnPlayerEnterVehicle or OnPlayerStateChange:
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(/* is player zombie variable */)
ClearAnimations(playerid);
return 1;
}
or
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(/*IsPlayerZombie Variable*/)
{
new Float: Pos[4];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1] + 2, Pos[2]);
}
}
return 1;
}