Raised This Month: $ Target: $400
 0% 

Plugin efficiency


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 04-15-2012 , 19:30   Plugin efficiency
Reply With Quote #1

Would it be more efficient for this code if I were to take the pcvar and make a global variable for its value to be used instead of calling the get_pcvar_num fuction every time I need the value for a pcvar? I know I would have to change the map for the cvar to be updated.

Like this:

PHP Code:
#include <amxmodx>

new pcvar
new g_pcvarvalue

public plugin_init()
{
    
register_plugin("efficient","1.0","r4ndomz")

    
pcvar register_cvar("qwerty""1");
}

public 
plugin_cfg()
{
    
g_pcvarvalue get_pcvar_num(pcvar);
}

public function(
id)
{
    
client_print(idprint_chat"%i"g_pcvarvalue);

__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 04-15-2012 at 19:32.
r4ndomz is offline
Send a message via Skype™ to r4ndomz
 


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 07:42.


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