Helló!Én is most csinálok RP szervert, meg sokan csinálnak még most(bár én ezt a scriptet a modomhoz nem használom fel)
nagyon megtetszett, gondoltam áthozom ide. Youtube:
https://www.youtube.com/watch?x-yt-ts=1422579428&v=J70KsfYiBAI&x-yt-cl=85114404
//A Sampforumra hozta: WeAreHoW
//Eredeti téma:http://forum.sa-mp.com/showthread.php?t=510091
#include <a_samp>
#include <zcmd>
#include <progress>
new PlayerBar:HungerBar[MAX_PLAYERS];
new progressUpdater[MAX_PLAYERS];
new healthUpdater[MAX_PLAYERS];
new Hunger[MAX_PLAYERS];
new hbHealth[MAX_PLAYERS];
public OnFilterScriptInit();
public OnPlayerSpawn(playerid)
{
Hunger[playerid] = 100, hbHealth[playerid] = 100;
HungerBar[playerid] = CreatePlayerProgressBar(playerid, 547.5, 58.0, 59.0, 5, 0x52875AFF, 100.0);
ShowPlayerProgressBar(playerid, HungerBar[playerid]);
SetPlayerProgressBarValue(playerid, HungerBar[playerid], 100);
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
progressUpdater[playerid] = SetTimer(\"HungerProgressBar\", 1000, true); // 1000 = 1 second, change this to whatever time you want
return 1;
}
forward HungerProgressBar(playerid);
public HungerProgressBar(playerid)
{
if(Hunger[playerid] == 0)
{
KillTimer(progressUpdater[playerid]);
healthUpdater[playerid] = SetTimer(\"LoseHealth\", 1000, true); // Losing 5 HP every one second, it\'s recommended you change this
}
else if(Hunger[playerid] > 0)
{
Hunger[playerid] -= 5;
SetPlayerProgressBarValue(playerid, HungerBar[playerid], Hunger[playerid]);
UpdatePlayerProgressBar(playerid, HungerBar[playerid]);
}
return 1;
}
forward LoseHealth(playerid);
public LoseHealth(playerid)
{
new Float: health;
hbHealth[playerid] -= 5;
SetPlayerHealth(playerid, hbHealth[playerid]);
if(GetPlayerHealth(playerid, health) == 0) KillTimer(healthUpdater[playerid]);
return 1;
}