SA-MP Forums Archive
Textdraw in OnPlayerEnterVehicle - 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)
+--- Thread: Textdraw in OnPlayerEnterVehicle (/showthread.php?tid=551915)



Textdraw in OnPlayerEnterVehicle - Kerth - 21.12.2014

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.


Re: Textdraw in OnPlayerEnterVehicle - Kyance - 21.12.2014

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


Re: Textdraw in OnPlayerEnterVehicle - Nimrod - 21.12.2014

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


Re: Textdraw in OnPlayerEnterVehicle - Schneider - 21.12.2014

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;
}