[Ajuda] Velocimetro nгo desaparece apуs sair do veнculo
#1

O Velocimetro/Textdraw nгo estб desaparecendo apуs sair do veнculo

PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
        
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
enginelightsalarmdoorsbonnetbootobjective;
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        if(
IsABike(vehicleid)) SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
        if(!
IsABike(vehicleid))
        {   
            
VelocimetroUpdate[playerid] = SetTimerEx("UpdateVehicleHud"1000true"i"playerid);
            if(
vInfo[vehicleid][vHasEngine] == true)
            {  
                if(
vInfo[vehicleid][vFuel] <= 0)
                {    
                    
KillTimer(GasolinaTimer[playerid]);
                    
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
                }
                if(
vInfo[vehicleid][vFuel] > 0)
                {  
                    
GasolinaTimer[playerid] = SetTimerEx("GasolinaTime"5000true"ii"playeridvehicleid);
                }
            }
        }
    }
    else
    {
        for(new 
0sizeof(CarroHUD); i++) PlayerTextDrawHide(playeridCarroHUD[playerid][i]);
        
KillTimer(GasolinaTimer[playerid]);
        
KillTimer(VelocimetroUpdate[playerid]);
    }
    return 
1;

PHP Code:
public UpdateVehicleHud(playerid)
{
    new 
str[34];
    new 
vehicleid GetPlayerVehicleID(playerid);
    
format(strsizeof(str), "Vehicle Health: ~g~%.0f%"GetVehicleHealthEx(vehicleid));
    
PlayerTextDrawSetString(playeridCarroHUD[playerid][1], str);
    if(
vInfo[vehicleid][vHasEngine] == truePlayerTextDrawSetString(playeridCarroHUD[playerid][2], "Engine: ~g~Yes");
    else if(
vInfo[vehicleid][vHasEngine] == falsePlayerTextDrawSetString(playeridCarroHUD[playerid][2], "Engine: ~r~No");
    for(new 
0sizeof(CarroHUD); i++) PlayerTextDrawShow(playeridCarroHUD[playerid][i]);
    return 
1;

Quem puder ajudar ai agradeзo, й uma coisa boba sу que eu nгo estou conseguindo arrumar :P
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 6 Guest(s)