06.07.2018, 23:24
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;
}
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;
}