27.05.2014, 16:34
E uma simples [FS] que vai pegar o valor de combustнvel da conta ou do carro do player e vai transformar em um progresso mostrando a quantidade na barra...
print
Download:
Download:
#include <a_samp>
#include <DOF2>
#include <progress>
#define PASTA_CONTAS "Contas/%s.ini"
new Bar:Combustivel[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
public OnFilterScriptInit()
{
SetTimer("ProgressBar", 500, 1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyProgressBar(Combustivel[playerid]);
Combustivel[playerid] = INVALID_BAR_ID;
return 1;
}
public OnFilterScriptExit()
{
DOF2_Exit();
return 1;
}
forward ProgressBar();
public ProgressBar() //Eu prefiro nгo usar OnPlayerUpdate com textdraws
{
for(new playerid; playerid < MAX_PLAYERS; playerid++) //Eu recomendo para cada (Player, playerid)
{
SetProgressBarValue(Combustivel[playerid], DOF2::GetInt(PegarConta(playerid), "Gaso"));
UpdateProgressBar(Combustivel[playerid], playerid);
}
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
DestroyProgressBar(Combustivel[playerid]);
Combustivel[playerid] = INVALID_BAR_ID;
}
if(newstate == PLAYER_STATE_DRIVER)
{
Combustivel[playerid] = CreateProgressBar(530.00, 421.00, _, _, 0x00FF00FF, 100.0);
ShowProgressBarForPlayer(playerid, Combustivel[playerid]);
}
return 1;
}
stock PegarConta(playerid)
{
static Arquivo[33];
format(Arquivo, sizeof(Arquivo), PASTA_CONTAS, getName(playerid));
return Arquivo;
}
stock getName(playerid)
{
static Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, sizeof(Nome));
return Nome;
}