20.07.2014, 17:04
Tente isto:
PS: Leia os comentбrios.
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.