AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Health problem (https://forums.alliedmods.net/showthread.php?t=11108)

FoX Rider 03-09-2005 20:22

Health problem
 
How would I make set_user_health, be anything above 0 and less that 101

Sp4rt4n 03-09-2005 20:27

This might work, but im a noob scripter and you might wanna wait for another answer...

Code:
if (( set_user_health < 0) || (set_user_health > 101)) {     return PLUGIN_HANDLED }

KCE 03-09-2005 20:29

Re: Health problem
 
Quote:

Originally Posted by FoX Rider
How would I make set_user_health, be anything above 0 and less that 101

Do something like this:
Code:
//i is the health to set it to if ( (i > 0) && (i < 101) ) { //check if i is between 0 and 101 set_user_health(id,i) //set user health to i value }

xeroblood 03-10-2005 09:43

From core.inc:
Code:
native clamp(value, min=cellmin, max=cellmax);

Example:
Code:
new TempHealth = 123 set_user_health( id, clamp(TempHealth, 1, 100) )

That would set the users HP to 100...


All times are GMT -4. The time now is 14:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.