AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_cvar_num,get_pcvar_num (https://forums.alliedmods.net/showthread.php?t=94123)

biscuit628 06-06-2009 16:17

get_cvar_num,get_pcvar_num
 
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
    
}



Xellath 06-06-2009 16:19

Re: get_cvar_num,get_pcvar_num
 
It's practicly the same, but pcvars is slightly faster.

Bugsy 06-06-2009 16:20

Re: get_cvar_num,get_pcvar_num
 
Use cvar pointers (the first method)

biscuit628 06-06-2009 20:49

Re: get_cvar_num,get_pcvar_num
 
that mean pcvar is better?

Bugsy 06-06-2009 21:07

Re: get_cvar_num,get_pcvar_num
 
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" );

--kml-- 06-07-2009 02:18

Re: get_cvar_num,get_pcvar_num
 
:crab::crab::crab::crab:

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

:crab::crab::crab::crab:

Arkshine 06-07-2009 03:58

Re: get_cvar_num,get_pcvar_num
 
Quote:

Originally Posted by Xellath (Post 843229)
It's practicly the same, but pcvars is slightly faster.

~ x5 more faster.


All times are GMT -4. The time now is 13:47.

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