29.06.2017, 23:02
Galera queria saber como eu faзo para colocar um textdraw para ir diminuindo em um certo tempo?
//No topo
#include ProgressBar
static Gasolina[MAX_PLAYERS],
TimerGasolina[MAX_PLAYERS],
PlayerBar:BarraGasolina[MAX_PLAYERS];
// ----------------------------------------------------------------------------------------------------------- //
public OnPlayerConnect(playerid)
{
BarraGasolina[playerid] = CreatePlayerProgressBar(playerid, Float:x, Float:y, 55.5, 3.2, 0xFFFF00AA, 100.0); //Substitua pelas suas coordenadas e cor
return 1;
}
// ----------------------------------------------------------------------------------------------------------- //
forward DiminuirGasolina(playerid);
public DiminuirGasolina(playerid)
{
new StringGasolina[20];
Gasolina[playerid]--;
SetPlayerProgressBarValue(playerid, BarraGasolina[playerid], Gasolina[playerid]);
if(Gasolina[playerid] == 0)
{
SendClientMessage(playerid, -1, "[ x ] Sua gasolina acabou!");
KillTimer(TimerGasolina[playerid]);
return SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, 0, -1, -1, -1, -1, -1);
}
if(Gasolina[playerid] <= 10) SendClientMessage(playerid, -1, "[ > ] Vocк estб ficando sem gasolina, abasteзa no posto mais prуximo.");
return 1;
}
// ----------------------------------------------------------------------------------------------------------- //
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
ShowPlayerProgressBar(playerid, BarraGasolina[playerid]);
if(Gasolina[playerid] == 0)
{
SendClientMessage(playerid, -1, "[ x ] Vocк estб sem gasolina e precisa abastecer!");
return SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, 0, -1, -1, -1, -1, -1);
}
TimerGasolina[playerid] = SetTimerEx("DiminuirGasolina", 300000, true, "d", playerid); //5 minutos
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
HidePlayerProgressBar(playerid, BarraGasolina[playerid]);
KillTimer(TimerGasolina[playerid]);
}
return 1;
}
// ----------------------------------------------------------------------------------------------------------- //
public OnPlayerDisconnect(playerid, reason)
{
if(IsPlayerInAnyVehicle(playerid) && Gasolina[playerid] > 0) KillTimer(TimerGasolina[playerid]);
return 1;
}