[Ajuda] Combustivel
#1

Como faзo isso funcionar ?

aparece tudo mais nгo cai a barra de combustivel

Код:
#include <a_samp>
#include <progress>

static Text:Velocimetro[MAX_PLAYERS],
	   Bar:bVelocimetro[MAX_PLAYERS],
	   bool:Vel[MAX_PLAYERS];
	   
new Combustivel[MAX_VEHICLES]; //variбvel do combustivel dos veiculos

#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	for(new i=0;i<MAX_VEHICLES;i++) {
	    Combustivel[i] = 100; //sets every car's fuel to 100 in a loop
	}
 	return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#endif

public OnPlayerUpdate(playerid)
{
	new vid = GetPlayerVehicleID(playerid);
    new string[32];
    new Float:Vhealth;
    if(!IsPlayerConnected(playerid)) return 1;
    if(Vel[playerid] == true)
    {
        GetVehicleHealth(GetPlayerVehicleID(playerid),Vhealth);
        format(string,sizeof string,"Combu:%i",Combustivel[vid]); //quickly doing a small update on fuel (so it wont jump from 100 to its real value)
		TextDrawSetString(Velocimetro[playerid],string);
        SetProgressBarMaxValue(bVelocimetro[playerid], 100.0);
        SetProgressBarValue(bVelocimetro[playerid], Combustivel[vid]);
        UpdateProgressBar(bVelocimetro[playerid], playerid);
        if(IsPlayerInAnyVehicle(playerid))
        {
            TextDrawShowForPlayer(playerid,Velocimetro[playerid]);
            ShowProgressBarForPlayer(playerid,bVelocimetro[playerid]);
        }
        else
        {
            TextDrawHideForPlayer(playerid,Velocimetro[playerid]);
            HideProgressBarForPlayer(playerid,bVelocimetro[playerid]);
        }
    }
	return 1;
}

public OnPlayerConnect(playerid)
{
    Vel[playerid] = true;
    Velocimetro[playerid] = TextDrawCreate(37.000000, 288.000000, " ");
    TextDrawBackgroundColor(Velocimetro[playerid], 255);
    TextDrawFont(Velocimetro[playerid], 1);
    TextDrawLetterSize(Velocimetro[playerid], 0.5, 2.0);
    TextDrawColor(Velocimetro[playerid], -1);
    TextDrawSetOutline(Velocimetro[playerid], 0);
    TextDrawSetProportional(Velocimetro[playerid], 1);
    TextDrawSetShadow(Velocimetro[playerid], 1);
    bVelocimetro[playerid] = CreateProgressBar(27.00, 328.00, 30.50, 8.19, 65435, 10.0);
	return 1;
}
Reply
#2

Up. sу preciso saber como faзo para usar um timer de progresso da bar , pfv me ajduem!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)