Textdraw does not work - 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 does not work (
/showthread.php?tid=656091)
Textdraw does not work -
zZzTGTzZz - 06.07.2018
Hi, when a player changes from being a driver to standing, the textdraw does not work.
Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
if(GetPVarInt(playerid,"Test_Variable") == 1)
{
if(GetPlayerVehicleID(playerid) == Job_Vehicle[1] || GetPlayerVehicleID(playerid) == Job_Vehicle[2] || GetPlayerVehicleID(playerid) == Job_Vehicle[3] || GetPlayerVehicleID(playerid) == Job_Vehicle[4] || GetPlayerVehicleID(playerid) == Job_Vehicle[5])
{
new string[256];
TimeJob[playerid] = 30;
TimerJob[playerid] = SetTimerEx("TimerCose", 1000, true, "i", playerid);
format(string,sizeof(string),"You have %s seconds to return to the vehicle.", TimeJob[playerid]);
PlayerTextDrawSetString(playerid, TD_Msg[playerid], string);
PlayerTextDrawShow(playerid, TD_Msg[playerid]);
}
}
}
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
if(GetPVarInt(playerid,"Test_Variable") == 1)
{
if(GetPlayerVehicleID(playerid) == Job_Vehicle[1] || GetPlayerVehicleID(playerid) == Job_Vehicle[2] || GetPlayerVehicleID(playerid) == Job_Vehicle[3] || GetPlayerVehicleID(playerid) == Job_Vehicle[4] || GetPlayerVehicleID(playerid) == Job_Vehicle[5])
{
PlayerTextDrawHide(playerid, TD_Msg[playerid]);
PlayerTextDrawSetString(playerid, TD_Msg[playerid], "_");
KillTimer(TimerJob[playerid]);
TimeJob[playerid] = 30;
}
}
}
return 1;
}