Raised This Month: $ Target: $400
 0% 

get cvar value that already exist?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dels
Senior Member
Join Date: Apr 2009
Old 05-31-2009 , 23:55   get cvar value that already exist?
Reply With Quote #1

new to amxx Pawn, let say we want to grab some value that has registered on CS engine or by other plugins

let say:
PHP Code:
mp_freezetime 30 
could this work?
PHP Code:
new delay;
delay get_pcvar_num("mp_freezetime") - 10
also for other value (string/float)?

thanks
__________________
dels is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-01-2009 , 00:02   Re: get cvar value that already exist?
Reply With Quote #2

No, you are confusing regular cvar retrieval with pcvar retrieval.

Use this:

PHP Code:
new freezetime
freezetime 
get_cvar_num("mp_freezetime"
OR:

PHP Code:
new freezetimepointer
// . . . 
freezetimepointer get_cvar_pointer("mp_freezetime")
// . . .
new freezetime
freezetime 
get_pcvar_num(freezetimepointer
The latter is more efficient.

String/Float:
PHP Code:
new mystring[32]
get_cvar_string("my_string_cvar"mystring31)

new 
Float:myfloat
myfloat 
get_cvar_float("my_float_cvar"
Although, use pcvar instead (same analogous syntax as above).
__________________

Last edited by fysiks; 06-01-2009 at 00:06.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2009 , 00:03   Re: get cvar value that already exist?
Reply With Quote #3

Edit: With that you need to first

PHP Code:
freezetimepointer get_cvar_pointer"mp_freezetime" 
get_cvar_num( "mp_freezetime" )

get_pcvar_num() is for cvar pointers.
__________________
Bugsy is offline
dels
Senior Member
Join Date: Apr 2009
Old 06-01-2009 , 00:11   Re: get cvar value that already exist?
Reply With Quote #4

thanks all

so it just my misconception about pcvar and cvar actually
__________________
dels is offline
Reply



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 13:47.


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