Where should I put something like this? - 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: Where should I put something like this? (
/showthread.php?tid=82250)
Where should I put something like this? -
FreeSoul - 17.06.2009
Where should I put something like this? On what callback?
Quote:
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 5.0 || health > 0.0)
{
SetPlayerHealth(playerid,0);
return 1;
}
|
Thanks
Re: Where should I put something like this? -
Grim_ - 17.06.2009
Depends when you want to use it. When they type something, type a command, press a button, what?
Re: Where should I put something like this? -
BMUK - 17.06.2009
You do realize that will kill anyone who's health is 1 or above ?
Re: Where should I put something like this? -
shitbird - 17.06.2009
Quote:
Originally Posted by BM[UK
]
You do realize that will kill anyone who's health is 1 or above ?
|
pawn Код:
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 5.0 || health > 0.0)
{
SetPlayerHealth(playerid,0);
return 1;
}
Not everyone, he didnt create a loop, this will only check playerid 0's health.
Re: Where should I put something like this? -
Grim_ - 17.06.2009
He said "anyone" so I suppose he meant by whoever got checked by it.
Re: Where should I put something like this? -
BMUK - 17.06.2009
I think you'll find that it will affect anyone who uses the command/function where he wanted to put it
*Sigh*
Quote:
Originally Posted by Swift_
He said "anyone" so I suppose he meant by whoever got checked by it.
|
Yes!
Re: Where should I put something like this? -
shitbird - 17.06.2009
Quote:
Originally Posted by BM[UK
]
I think you'll find that it will affect anyone who uses the command/function where he wanted to put it
*Sigh*
Quote:
Originally Posted by Swift_
He said "anyone" so I suppose he meant by whoever got checked by it.
|
Yes!
|
Ooooo.... i thought u ment that it would affect everyone as in a function with a loop. My mistake.
Re: Where should I put something like this? -
FreeSoul - 17.06.2009
Instead of the || I should put &&,so it's my mystake.
No,I want it to have effect any time.Like whenever a player has only 5HP or less left,he would die.
Re: Where should I put something like this? -
SiJ - 17.06.2009
Maybe in public OnPlayerUpdate(playerid)
Quote:
Important note: Remember! This callback is called VERY frequently! Avoid having a lot of code in it!
|
P.S. I think this isn't a "lot of code" so you can put your code in there..