Raised This Month: $ Target: $400
 0% 

query_client_cvar cant read *.000 value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-14-2013 , 05:57   query_client_cvar cant read *.000 value
Reply With Quote #1

I,m trying to get all players with ( for example ) mp_decals 300.000000
so I did

PHP Code:
query_client_cvar(id"mp_decals""ag")

public 
ag(id, const cvar[], const value[]) {
                        
             new 
iValue str_to_float(value)
             
server_print("user has %.2f",iValue
             if(
iValue == 300.000000 ) {
             
            
// do
                    
             
}
            
    

but server_print debug show me ONLY float value like 300.00 and not 300.000000 , so my condition if ( ivalue == 300.000000) not working

how to get more digits after zero ?
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 08-14-2013 at 06:13.
avril-lavigne is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 08-14-2013 , 06:59   Re: query_client_cvar cant read *.000 value
Reply With Quote #2

Code:
new Float:iValue = str_to_float(value)

Also, since you're printing using %.2f you restrict it from printing more than 2 decimals. Use %f. IIRC, str_to_float() is also known to be slightly inaccurate at times. It can sometimes return 0.999~ when the number is in fact 1.0.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2013 , 15:42   Re: query_client_cvar cant read *.000 value
Reply With Quote #3

Don't convert string, directly check the string.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-14-2013 , 21:19   Re: query_client_cvar cant read *.000 value
Reply With Quote #4

ok. works fine with if(equal(value,"300.000000"))
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 08-14-2013 at 21:19.
avril-lavigne is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 08-15-2013 , 00:28   Re: query_client_cvar cant read *.000 value
Reply With Quote #5

Isn't mp_decals a server cvar ?
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-15-2013 , 04:55   Re: query_client_cvar cant read *.000 value
Reply With Quote #6

It's a player cvar afaik.
__________________
Kia 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 15:54.


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