Raised This Month: $ Target: $400
 0% 

get_cvar_num,get_pcvar_num


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 06-06-2009 , 16:17   get_cvar_num,get_pcvar_num
Reply With Quote #1

is that the same?
or which way is better?
PHP Code:
new g_something

public plugin_init()
{
    
g_something register_cvar("I_am_cvar","0")
}

public function(
id)
{
    if(
get_pcvar_num(g_something))
    {
        ...    
//code
    
}

PHP Code:
public plugin_init()
{
    
register_cvar("I_am_cvar","0")
}

public function(
id)
{
    if(
get_cvar_num("I_am_cvar"))
    {
        ...    
//code
    
}

__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-06-2009 , 16:19   Re: get_cvar_num,get_pcvar_num
Reply With Quote #2

It's practicly the same, but pcvars is slightly faster.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-06-2009 , 16:20   Re: get_cvar_num,get_pcvar_num
Reply With Quote #3

Use cvar pointers (the first method)
__________________
Bugsy is offline
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 06-06-2009 , 20:49   Re: get_cvar_num,get_pcvar_num
Reply With Quote #4

that mean pcvar is better?
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-06-2009 , 21:07   Re: get_cvar_num,get_pcvar_num
Reply With Quote #5

Yes

g_CVARPointer = register_cvar( "the_cvar" );

Then access the value with the get_pcvar_X() functions.

You can also get a pointer for a cvar that already exists with:

g_pDLURL = get_cvar_pointer( "sv_downloadurl" );
__________________
Bugsy is offline
--kml--
Senior Member
Join Date: Jan 2009
Old 06-07-2009 , 02:18   Re: get_cvar_num,get_pcvar_num
Reply With Quote #6



OUH YES thx for the thread starter and reply ... i was just going to open a same thread lol xD

__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-07-2009 , 03:58   Re: get_cvar_num,get_pcvar_num
Reply With Quote #7

Quote:
Originally Posted by Xellath View Post
It's practicly the same, but pcvars is slightly faster.
~ x5 more faster.
__________________
Arkshine 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