[Ajuda] ProgressBar
#2

Tente isto:
pawn Код:
#include a_samp

#define FomeTempo  1 //define o tempo para ficar com fome
forward Fome(playerid);

// ****** ATENЗГO Mude "FomeB" para "FomeB[MAX_PLAYERS]"
new FomeB[MAX_PLAYERS];




// **** ATENЗГO MUDE PARA ONPLAYERCONNECT
public OnPlayerConnect(playerid)
{
    FomeB[playerid] = CreateProgressBar(552.00, 321.00, 55.50, 4.19, -16776961, 100.1);
    SetProgressBarMaxValue(FomeB[playerid], 100);
    return 1;
}

public OnGameModeExit()
{
    HideProgressBarForAll(FomeB[playerid]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPVarInt(playerid,"Fome", 100);
    ShowProgressBarForPlayer(playerid, FomeB[playerid]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetTimerEx("Fome", FomeTempo*60000 , 1, "i", playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SetProgressBarValue(FomeB[playerid],0);
    UpdateProgressBar(FomeB[playerid],playerid);
    SetPVarInt(playerid,"Fome",101);
    return 1;
}

public Fome(playerid)
{
    static
        tBar
    ;
   
    tBar = GetPVarInt(playerid, "Fome");
   
    tBar --;

    // Simples DEBUG
    printf("Barra: %d", tBar);
   
    SetPVarInt(playerid,"Fome", tBar);
   
    SetProgressBarValue(FomeB[playerid], tBar);
   
    UpdateProgressBar(FomeB[playerid], playerid);
   
   
    if(GetPVarInt(playerid, "Fome") <= 10)
    {
        new Float:vida;
        GetPlayerHealth(playerid, vida), SetPlayerHealth(playerid, vida-90.0);
        SendClientMessage(playerid, BRANCO, "|STATUS| Vocк esta com Fome, coma algum lanche ou vai Morrer de Fome");
        PlayerPlaySound(playerid, 1057, 0, 0, 0);
    }
    return true;
}

PS: Leia os comentбrios.
Reply


Messages In This Thread
ProgressBar - by FernandoSS - 20.07.2014, 12:07
Re: ProgressBar - by zSuYaNw - 20.07.2014, 17:04
Re: ProgressBar - by FernandoSS - 20.07.2014, 17:36
Re: ProgressBar - by zSuYaNw - 20.07.2014, 17:38
Re: ProgressBar - by FernandoSS - 20.07.2014, 17:43
Re: ProgressBar - by zSuYaNw - 20.07.2014, 17:48
Re: ProgressBar - by FernandoSS - 20.07.2014, 17:50
Re: ProgressBar - by zSuYaNw - 20.07.2014, 17:59
Re: ProgressBar - by FernandoSS - 20.07.2014, 18:26
Re: ProgressBar - by zSuYaNw - 20.07.2014, 18:27

Forum Jump:


Users browsing this thread: 2 Guest(s)