|
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
|

04-19-2007
, 20:11
command not working right
|
#1
|
I am creating a plugin that sets select client's names during client_authorized or client_putinserver. But, it will not exec the command. I have tried doing it through another function, identical code, and it works. Am I not allowed to change the client's name that early?
Here is my code if it helps any
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Name Randomizer"
#define VERSION "1.0"
#define AUTHOR "Yami Kaitou"
#define YAMIDEFAULT "Yami"
new configdir[128];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_concmd("newname","newname",ADMIN_ALL," - If you have random names, generates you a new name");
get_configsdir(configdir,127);
}
public client_putinserver(id)
{
new authid[34];
get_user_authid(id,authid,33);
if (equal(authid,"STEAM_0:0:9176827")) //Yami
{
new name[32],file[128];
format(file,127,"%s/names/yami.txt",configdir);
if (!file_exists(file))
{
format(name,31,"]LA[ %s v2",YAMIDEFAULT);
}
else
{
new num[5],junklen,number;
read_file(file,0,num,4,junklen);
number = str_to_num(num);
new line[512],len;
new rand = random_num(1,number);
read_file(file,rand,line,511,len);
format(name,31,"]LA[ %s v2",line);
}
client_cmd(id,"name ^"%s^"",name);
}
}
public newname(id)
{
new authid[34];
get_user_authid(id,authid,33);
if (equal(authid,"STEAM_0:0:9176827")) //Yami
{
new name[32],file[128];
format(file,127,"%s/names/yami.txt",configdir);
if (!file_exists(file))
{
format(name,31,"]LA[ %s v2",YAMIDEFAULT);
}
else
{
new num[5],junklen,number;
read_file(file,0,num,4,junklen);
number = str_to_num(num);
new line[512],len;
new rand = random_num(1,number);
read_file(file,rand,line,511,len);
format(name,31,"]LA[ %s v2",line);
}
client_cmd(id,"name ^"%s^"",name);
}
return PLUGIN_HANDLED;
}
__________________
ProjectYami Laboratories
I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
|
|