AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plese HELP! (https://forums.alliedmods.net/showthread.php?t=132603)

totalcsscripting 07-16-2010 17:55

Plese HELP!
 
i'm starting with scripting and i'm developing my firsts plugins.

I have this problem. I want to create a plugin wich gives me more health and armor.

but i noticed that the maximum of health is 250 and of armor is 900
if i run the cvar twice creates a totatally desaster.

i want to no how to pud like an if statement, saying that if health is 250, and yo add 100, only add 50 instead of 100.


thankss!!

wrecked_ 07-16-2010 18:05

Re: Plese HELP!
 
There isn't a maximum health cap. The health number in your HUD will only show up to 255 (or 250, don't remember) and then reset once it passes that, but your actual health value will differ from what the HUD displays.

If you still wanted to do this, you'd do something similar to:
Code:
#define MAX_HEALTH  255 #define ADD_HEALTH  100 set_user_health( id, min( ( get_user_health( id ) + ADD_HEALTH ), MAX_HEALTH ) )


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

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