Where should I put something like this?
#1

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

Depends when you want to use it. When they type something, type a command, press a button, what?
Reply
#3

You do realize that will kill anyone who's health is 1 or above ?

Reply
#4

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.
Reply
#5

He said "anyone" so I suppose he meant by whoever got checked by it.
Reply
#6

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

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.
Reply
#8

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.
Reply
#9

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)