Because get_pcvar_num() is a function, everytime when another function (public) is called the function get_pcvar_num() is working. I know, I read somewhere get_pcvar_num() is ~5x faster than get_cvar_num(), but what if I put into a global variable? It's more faster?
#1 -> called each time if function print() is called
PHP Code:
new g_cvar
public plugin_init(){
///
g_cvar = register_cvar("amx_cvar", "1")
}
public print(){
client_print(0, print_chat, "--> THIS ONE ! %d", get_pcvar_num(g_cvar) )
}
#2 -> once called in plugin_cfg()
PHP Code:
new g_cvar, g_newCvar
public plugin_init(){
///
g_cvar = register_cvar("amx_cvar", "1")
}
public plugin_cfg(){
g_newCvar = get_pcvar_num(g_cvar)
}
public print(){
/* Can't use:
client_print(0, print_chat, "--> %d", g_cvar)
*/
client_print(0, print_chat, "--> %d", g_newCvar)
}
I know it's a disadvantage for people who want's to modify their cvars while server is running.
I made this topic beacause I'm trying to find the fastest way, because one of the function is called everytime when a player get damaged.