Raised This Month: $32 Target: $400
 8% 

Solved Problem with floats in hud [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ludak
Member
Join Date: Oct 2014
Old 12-04-2019 , 16:02   Problem with floats in hud [SOLVED]
Reply With Quote #1

Hello, I have level system fro ZM server.
I want to show the bonus speed and damage per level in the hud.

I have natives:
zp_get_hm_damage(player)
zp_get_hm_speed(player)
zp_get_zp_speed(player)

All of those natives return integers.
Now, in the level plugin, the speeds are divided by 100 and added to the current speed on spawn and the damage is divided by 10 and added for each bullet impact in (Ham_TakeDamage).

So per level player gets 1 / 10 = 0.1 damage bonus, and 1 / 100 = 0.01 speed bonus.
Now, since the values in natives are integers, I want to display them like floats in the hud.

When I try the following:
float(zp_get_hm_speed(player) / 100)
float(zp_get_zp_speed(player) / 100)
float(zp_get_hm_damage(player) / 10)

The format in the hud is: %.5f
The hud just displays 0.00000

I do not know why it is not working, can someone help me.

Last edited by HamletEagle; 12-05-2019 at 08:39.
Ludak is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-04-2019 , 16:10   Re: Problem with floats in hud
Reply With Quote #2

float(native) / 100
__________________
HamletEagle is offline
Ludak
Member
Join Date: Oct 2014
Old 12-04-2019 , 16:43   Re: Problem with floats in hud
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
float(native) / 100
Does not work for some reason.
Then I tried float(native) / 100.0 and it works.

Thanks.

Last edited by Ludak; 12-04-2019 at 16:43.
Ludak is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-05-2019 , 08:38   Re: Problem with floats in hud [SOLVED]
Reply With Quote #4

Do not empty your post. Why do people still do that in 2019 is beyond my understanding.
__________________
HamletEagle 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 07:19.


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