SA-MP Forums Archive
Lose Health - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Lose Health (/showthread.php?tid=127907)



Lose Health - falor - 15.02.2010

Hey guys, i'm making my RPG server and i need help.

I try to make a system who take 5points of your life every 60000ms.
Код:
public Faim(playerid)
{
  new Float:health;
  new pertevie = 5;
  new vie = GetPlayerHealth(playerid,health);
  new mvie = vie-pertevie;//10k for testing purposes
  SetPlayerHealth(playerid, mvie);
  SetTimer("Faim", 60000, 0);
	return 1;
}
But it doesn't work.
Any ideas?
Thanks



Re: Lose Health - Correlli - 15.02.2010

Use SetTimerEx-function in this case, but it's better if you use SetTimer-function with loop for all players.


Re: Lose Health - BlackFoX - 15.02.2010

Код:
public losehealth()
{
	for(new i = 0;i<MAX_PLAYERS;i++){
	if(!IsPlayerConnected(i) || IsPlayerNPC(i))continue;
	new Float:hh;
	GetPlayerHealth(i,hh);
	SetPlayerHealth(i,(hh-yourvalue));
	}
	return 1;
}
and SetTimer("losehealth",60000,1); in onGamemodeinit


//й : SetTimerEx use to many Ressources cause you must set it for every Player


Re: Lose Health - falor - 15.02.2010

Thank you!
My code was effectively bad, i'll know for later
Thank you again


Re: Lose Health - VonLeeuwen - 15.02.2010

Why don't you use a loop?