OnPlayerDeath doesn't recognise if a player was in a vehicle?
#1

I am trying this:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
	SendClientMessageToAll(-1, "ION just died.");
	if(IsPlayerInAnyVehicle(playerid)) SendClientMessageToAll(-1, "ION was in a vehicle.");
	return 1;
}
The second message doesn't get displayed. And I am in a vehicle.
Is the OnPlayerDeath not recognising whether a player was in a vehicle or not option possible?
Reply
#2

Well i guess OnPlayerDeath is callef after the players death since once you die you exit the vehicle, what you can do is set a variable true at onplayerdeath that resets at onplayerspawn lets name it playerdied[playerid] then go to onplayerstatechange and use if (oldstate == 2 || oldstate == 3) && playerdied[playerid] ...//code
Something within the lines of that ^
Reply
#3

when player dies he's automatically removed from vehicle before this callback.
Reply
#4

^^ This... Track the players last vehicle in an array (LastUsedCar[MAX_PLAYERS]), and use OnPlayerEnterVehicle, OnPlayerExitVehicle to see which car needs to be updated to it.
Reply
#5

Yeah well, I've used OnPlayerStateChange as a workaround.
Thank you guys anyway.
Reply
#6

That's an interesting thing too, StateChange will occur.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)