Raised This Month: $ Target: $400
 0% 

g[s]et_cvar and g[s]et_pcvar


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-04-2007 , 09:47   Re: g[s]et_cvar and g[s]et_pcvar
Reply With Quote #7

Quote:
Originally Posted by Emp` View Post
if you really wanted to optimize it, you could just do:
Code:
public plugin_init()
{
    register_plugin("test", "", "")
}

public client_putinserver(id)
{
    static test_pcvar;
    if( !test_pcvar )
        test_pcvar = register_cvar("amx_test_cvar", "1")
    if (get_pcvar_num(test_pcvar))
        client_print(0, print_chat, "test")
}
thats not better.

memory usage to his pcvar example: identical
performance: worst. you check everytime in client_putinserver if the cvar is registered which will cost performance(not much, but it costs performance).
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
 



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 01:21.


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