Lose Health
#1

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
Reply
#2

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

Код:
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
Reply
#4

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

Why don't you use a loop?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)