enum pInfo { pHambre }; PlayerInfo[playerid][pHambre] = 0; public OnPlayerUpdateTime(playerid) { INI_WriteInt( PlayerAcc, "Hambre", PlayerInfo[playerid][pHambre]); return 1; } public LoadUser(playerid, name[], value[]) { INI_Int( "Hambre", PlayerInfo[playerid][pHambre]); return 1; } zcmd(hambre, playerid, params[]) { if(IsPlayerConnected(playerid)) { new string[80]; format(string, sizeof(string), "* Tu hambre es del {FFFF00}%d{FFFFFF} porciento.", PlayerInfo[playerid][pHambre]); Message(playerid, COLOR_WHITE, string); } return 1; } function Hambre() { for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new string[128], Float:health; if(PlayerInfo[i][pHambre] >= 65 && PlayerInfo[i][pHambre] < 80) { Message(i, COLOR_WHITE, "Tienes hambre, deberнas comer algo (Restaurantes-Bares-Perritos)"); } else if(PlayerInfo[i][pHambre] >= 80 && PlayerInfo[i][pHambre] < 90) { format(string, sizeof(string), "* %s se siente hambriento.", PlayerName(i)); ProxDetector(20.0, i, string, COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN ,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN); SetHP(i, health-5); } else if(PlayerInfo[i][pHambre] >= 90) { GetPlayerHealth(i, health); format(string, sizeof(string), "* %s esta totalmente hambriento", PlayerName(i)); ProxDetector(20.0, i, string, COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN ,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN); Message(i, COLOR_WHITE, "* Estas muy hambriento, debes comer rapido (Restaurantes-Bares-Perritos)"); SetHP(i, health-15); } } } return 1; } |
public ProgressBar()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
new vehicleid;
if((vehicleid = GetPlayerVehicleID(playerid)) && vhealth[playerid] != INVALID_BAR_ID)
{
new Float:health;
GetVehicleHealth(vehicleid, health);
SetProgressBarValue(vhealth[playerid], health);
UpdateProgressBar(vhealth[playerid], playerid);
}
}
}