Removing player from vehicle
#1

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;
}
Reply
#2

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.
Reply
#3

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)