Float health and altitude won't change.
#6

Not trying to offend you, but you're offering to teach scripting where you've none to less scripting and actual knowledge of SA-MP. Some stuff that I'd suggest you is, that you read the SA-MP wiki, it has almost everything you need.

Use 1000 ms (1 second) timer, and call it under OnGameModeInit, kill it under OnGameModeExit. Use foreach or player-pool size loop instead of MAX_PLAYERS loop, I'd recommend foreach though, but it's totally up to you that which one you choose to use.

EDIT: Example given below:
PHP код:
// Along with other defines
#define METRES_TO_FEET(%0) \
    
((%0) / 0.3047999995367040007042099189296)
// Under OnGameModeInit
SetTimer("updateVehicleTD"1000true);
// Somewhere in the script
forward    updateVehicleTD();
public    
updateVehicleTD()
{
    new 
string[50], FloatvehXFloatvehYFloatvehZvehHealth;
    foreach(new 
Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            
format(stringsizeof string"~b~KM/H: ~w~%d"GetKMHSpeed(i));
            
PlayerTextDrawSetString(ivehKMH[i], string);
            
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
            
format(stringsizeof string"~b~Health: ~w~%0.0f"vHealth);
            
PlayerTextDrawSetString(ivehHealth[i], string);
            
GetVehiclePos(GetPlayerVehicleID(playerid), vehXvehYvehZ);
            
format(stringsizeof string"~b~Altitude: ~w~%d M"floatround(METRES_TO_FEET(z)));
            
PlayerTextDrawSetString(ivehAlt[i], string);
        }
    }
    return 
1;

Reply


Messages In This Thread
Float health and altitude won't change. - by NealPeteros - 28.04.2017, 12:02
Re: Float health and altitude won't change. - by Logic_ - 28.04.2017, 12:15
Re: Float health and altitude won't change. - by NealPeteros - 28.04.2017, 12:18
Re: Float health and altitude won't change. - by Logic_ - 28.04.2017, 12:20
Re: Float health and altitude won't change. - by NealPeteros - 28.04.2017, 12:22
Re: Float health and altitude won't change. - by Logic_ - 28.04.2017, 12:26
Re: Float health and altitude won't change. - by NealPeteros - 28.04.2017, 13:27
Re: Float health and altitude won't change. - by Vince - 28.04.2017, 15:18
Re: Float health and altitude won't change. - by NealPeteros - 28.04.2017, 16:10

Forum Jump:


Users browsing this thread: 3 Guest(s)