Speedo help
#1

Hey, I just created this speedo and it isn't working like it should, the fuel doesn't update and it wont hide when I get out of the vehicle, here is the code.
pawn Код:
public SpeedoUpdate()
{
    for(new i = 0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
            fuelbar[i] = CreateProgressBar(511.00, 317.00, 86.50, 3.20, 0x33AA33FF, 100.0);
            new Float:x,Float:y,Float:z,string[24],vehicleid = GetPlayerVehicleID(i);
            ShowProgressBarForPlayer(i,fuelbar[i]);
            TextDrawShowForPlayer(i,Box[i]);
            TextDrawShowForPlayer(i,Speed[i]);
            TextDrawShowForPlayer(i,Full[i]);
            TextDrawShowForPlayer(i,Empty[i]);
            TextDrawShowForPlayer(i,Status[i]);
            GetVehicleVelocity(vehicleid,x,y,z);
            format(string,sizeof(string),"MPH: %d",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667));
            TextDrawSetString(Speed[i],string);
            SetProgressBarValue(Fuel[vehicleid], fuelbar[i]);
            UpdateProgressBar(fuelbar[i], i);
            }
            else
            {
            //HideProgressBarForPlayer(i,fuelbar[i]);
            TextDrawHideForPlayer(i,Box[i]);
            TextDrawHideForPlayer(i,Speed[i]);
            TextDrawHideForPlayer(i,Full[i]);
            TextDrawHideForPlayer(i,Empty[i]);
            TextDrawHideForPlayer(i,Status[i]);
            }
        }
    }
    return 1;
}
//Under OnGameModeInit I set the timer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)