Textdraw in OnPlayerEnterVehicle
#1

Hi,
Why this code is don`t work?

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
	    TextDrawShowForPlayer(playerid, Textdraw;
	}
	return 1;
}
I want show this textdraw when player sit in vehicle. Please help me.
Reply
#2

"OnPlayerEnterVehicle" gets called when a player is entering a vehicle.
Remove the 'GetPlayerState' check.
Reply
#3

Quote:
Originally Posted by Kerth
Посмотреть сообщение
Код:
	    TextDrawShowForPlayer(playerid, Textdraw; <---- you're missing something... 
Something curvy.
Reply
#4

Like Kyance said, getplayerstate won't work in that callback. That's because the player is not in the car yet when OnPlayerEnterVehicle is called.

You better use OnPlayerStateChange:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        TextDrawShowForPlayer(playerid, Textdraw);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)