Hi, guys! I made a little test plugin, but it doesn't work. I tried to make dynamic prefixes for the message, but it didn't work. Can you tell me what have i done wrong? Here is the code:
Code:
#include <amxmodx>
new cvar_test, cvar_prefix
public plugin_init()
{
register_plugin("Test", "1.0", "seed")
cvar_test = register_cvar("test1", "1")
cvar_prefix = register_cvar("test2", "dynamic")
register_clcmd("say /test", "gotest")
}
public gotest(id)
{
static testprefix[16]
new testcheck, prefixc[16]
get_pcvar_num(cvar_test)
get_pcvar_string(cvar_prefix, prefixc, 15)
if(testcheck == 1)
formatex(testprefix, 15, "[1]")
else if(testcheck == 2)
formatex(testprefix, 15, "[2]")
else if(testcheck == 3)
formatex(testprefix, 15, "%s", prefixc)
client_print(id, print_chat, "%s asd", testprefix)
}
I want to make the prefix "[1]" when test1 cvar is 1, "[2]" when test1 cvar is 2 and if test1 cvar is 3 - the prefix gets test2's string.