Quote:
Originally Posted by Obbin
I would like to implement something like client cvars for my plugins!
I would like to create my own register_clcvar dynamic native!
I'd allso like to implement get/set_clcvar_string/num/float(id, cvar, string/num/float)
I'd like some help to start out!
The question is, how am I gonna store the value at the client?
If it's not possible to store the values at the client I'll do it in vault or SQL
Thanks!
|
Your idea about the "get/set_clcvar_string" is kinda stupid, we already have query_client_cvar as well as client_cmd.
Here's an example:
Code:
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Query Client Cvar Example","1.0","Hawk552")
register_clcmd("test","CmdTest",ADMIN_KICK,"- executes query_client_cvar test")
}
public CmdTest(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
query_client_cvar(id,"cl_crosshaircolor","HandleCrosshairColor")
return PLUGIN_HANDLED
}
public HandleCrosshairColor(id,const Cvar[],const Value[])
client_print(id,print_chat,"The cvar queried is %s and the value is %s",Cvar,Value)
Also, it's not a good idea to store a value on the client, as it can be changed by them. If you really have to though, you can use the info buffer (set_user_info/get_user_info). I'm not sure about this, I think if you add a * to the key name then only the server can change it (i.e. set_user_info(id,"*mykey","myvalue"))
__________________