AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why it doesn't work as it should ? (https://forums.alliedmods.net/showthread.php?t=325155)

Abhinash 06-10-2020 06:36

Why it doesn't work as it should ?
 
Hey there guys.
I have set a variable NEM_HEALTH = 150000
And when I am setting it using fm_set_user_health() something weird is happening and the health getting set is 114204721 which is not what I want.
Does anyone knows what is happening ?

HamletEagle 06-10-2020 06:42

Re: Why it doesn't work as it should ?
 
Show some code.

condoriano90 06-10-2020 06:52

Re: Why it doesn't work as it should ?
 
Probably integer/float problem

Abhinash 06-10-2020 06:59

Re: Why it doesn't work as it should ?
 
It's just 2 line Hamlet.
First --
PHP Code:

new NEMESIS_HEALTH 150000 

Second --
PHP Code:

fm_set_user_health(idNEMESIS_HEALTH

Thats it bro.
Can you help me out

SHIELD755 06-10-2020 07:24

Re: Why it doesn't work as it should ?
 
it happens with me one time when i try to set an entity health
try

PHP Code:

 fm_set_user_health(id,float(NEMESIS_HEALTH)) 

If i am wrong correct me

Abhinash 06-10-2020 07:44

Re: Why it doesn't work as it should ?
 
Quote:

Originally Posted by SHIELD755 (Post 2704928)
it happens with me one time when i try to set an entity health
try

PHP Code:

 fm_set_user_health(id,float(NEMESIS_HEALTH)) 

If i am wrong correct me

I tried.
It still doesn't work

HamletEagle 06-10-2020 07:49

Re: Why it doesn't work as it should ?
 
Nope, that stupid function wants in integer so the problem isn't integer/float conversion. Anyway, please don't use functions from fakemeta_util like the one you are using.

How do you know the value is incorrect? The health hud can show max 255.

Abhinash 06-10-2020 08:14

Re: Why it doesn't work as it should ?
 
Quote:

Originally Posted by HamletEagle (Post 2704933)
Nope, that stupid function wants in integer so the problem isn't integer/float conversion. Anyway, please don't use functions from fakemeta_util like the one you are using.

How do you know the value is incorrect? The health hud can show max 255.

I am using set_hudmessage to display a I am doing it inside Zombie Plague Addon. So, from there I am able to see.
How, can I fix it ?

Natsheh 06-10-2020 08:19

Re: Why it doesn't work as it should ?
 
hire a professional

HamletEagle 06-10-2020 08:20

Re: Why it doesn't work as it should ?
 
Your assumption is that the value is not set properly, but I'm pretty sure your bug is in how you actually check the value.
Show the hudmessage code.


All times are GMT -4. The time now is 17:12.

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