Raised This Month: $ Target: $400
 0% 

Need to find CURRENT hp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hippo.exe
Junior Member
Join Date: Sep 2006
Old 10-12-2006 , 04:28   Need to find CURRENT hp
Reply With Quote #1

Title pretty much sums it up..

I need to know what would give me the info of someones CURRENT HP. So i could plug that into an equasion.
hippo.exe is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 10-12-2006 , 07:08   Re: Need to find CURRENT hp
Reply With Quote #2

new health=get_user_health(id)
Requires to include fun.inc:
#include <fun>
Next Time try searching in the amxmodx.org FuncWiki first:
http://www.amxmodx.org/funcwiki.php
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Imanoobie
BANNED
Join Date: Sep 2006
Old 10-12-2006 , 09:53   Re: Need to find CURRENT hp
Reply With Quote #3

*cough*

Isnt that wrong?

shouldnt it be

Code:
new g_hp g_hp = get_user_health(id)


You just need to include the file "Amxmodx"


Btw, the HP data is saved to the variable g_hp.

And silencer is right, look in the FuncWiki before asking. (I hate it, but whatever )
Imanoobie is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-12-2006 , 09:57   Re: Need to find CURRENT hp
Reply With Quote #4

Quote:
Originally Posted by Imanoobie View Post
*cough*

Isnt that wrong?

shouldnt it be

Code:
new g_hp g_hp = get_user_health(id)




You just need to include the file "Amxmodx"


Btw, the HP data is saved to the variable g_hp.

And silencer is right, look in the FuncWiki before asking. (I hate it, but whatever )
what are you talking about all you did was change the name of the variable, that changes nothing, and get_user_health(id) I believe is a comand reserved for the amxmodx module here is the code from the include file:
Code:
/* Returns player health. */
native get_user_health(index);
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 10-12-2006 at 10:04.
Rolnaaba is offline
Imanoobie
BANNED
Join Date: Sep 2006
Old 10-12-2006 , 10:01   Re: Need to find CURRENT hp
Reply With Quote #5

No, its just that you cant do:

Code:
new g_hp = get_user_health(id)

You must do:
Code:
new g_hp g_hp = get_user_health(id)
Imanoobie is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 10-12-2006 , 10:05   Re: Need to find CURRENT hp
Reply With Quote #6

incorrect, infact it is sometimes better to initialize a variable at a specific value otherwise the variable when created can be any number of things
Code:
new health = get_user_health
is correct as is your way but the above is better
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 10-12-2006 , 10:07   Re: Need to find CURRENT hp
Reply With Quote #7

u can
Code:
new iHp = get_user_health(id)

and there is no need to include fun
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Imanoobie
BANNED
Join Date: Sep 2006
Old 10-12-2006 , 10:09   Re: Need to find CURRENT hp
Reply With Quote #8

Hmm...i saw in the old AmxX doc that you have to do it the way i did.

Oh well.
Imanoobie is offline
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 10-12-2006 , 11:21   Re: Need to find CURRENT hp
Reply With Quote #9

both can be used:
Code:
new g_hp g_hp = get_user_health(id)
Code:
new g_hp = get_user_health(id)

But"new g_hp = get_user_health(id)" is better.
Here the explain why.
The "new" command reserve memory to store the value.If you use "new g_hp" the variable "g_hp" can hold a number that was stored in the memory from another (old) variable.This is a high risk when you use something like this
Code:
new g_hp //sometimes "g_hp" are not initalize with "0" if(!g_hp) //if g_hp was not initalize with "0" ,the if can be false and not work right   {//g_hp was used befor it was initalize.   g_hp = get_user_health(id) //initalize g_hp with the value of get_user_health(id)   //...   }

Always initalize a variable with a value before you use them.
__________________

Last edited by schnitzelmaker; 10-12-2006 at 11:39.
schnitzelmaker is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 10-12-2006 , 17:09   Re: Need to find CURRENT hp
Reply With Quote #10

Incorrect. Pawn automaticly zeroes variables, unlike the C family.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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