SA-MP Forums Archive
Removing player from vehicle - 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: Removing player from vehicle (/showthread.php?tid=112414)



Removing player from vehicle - WardenCS - 07.12.2009

Hey,i got problem.i wanted to make that zombies can not drive with vehicles,but humans cant 2...heres the code

whats wrong with it
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (playerid,TEAM_ZOMBIE)
	{
	RemovePlayerFromVehicle(playerid);
	TogglePlayerControllable(playerid, 1);
	SendClientMessage(playerid,TEAM_ZOMBIE_COLOR,"Zombies can not drive with vehicles");
	}
	return 1;
}



Re: Removing player from vehicle - Correlli - 07.12.2009

OnPlayerEnterVehicle callback is called every time when player is near a vehicle and when he presses a ENTER key. The entry can be canceled but the callback is still called.
RemovePlayerFromVehicle - will only work if player is IN vehicle, but not if he's trying to enter it.
You could use OnPlayerStateChange callback or you could use GetPlayerPos & SetPlayerPos with the OnPlayerEnterVehicle callback.

Quote:
Originally Posted by ZzZzZ
Код:
if (playerid,TEAM_ZOMBIE)
And this is also wrong.


Re: Removing player from vehicle - WardenCS - 07.12.2009

i thought something is wrong with it,how its right?


Re: Removing player from vehicle - Correlli - 07.12.2009

Quote:
Originally Posted by ZzZzZ
i thought something is wrong with it,how its right?
Quote:
Originally Posted by ZzZzZ
Код:
if (playerid,TEAM_ZOMBIE)
Something like:
pawn Код:
if(GetPlayerTeam(playerid) == TEAM_ZOMBIE)
{
  // your code.
}
or:
pawn Код:
if(gTeam[playerid] == TEAM_ZOMBIE)
{
  // your code.
}
or whatever you do to check the player's team.