23.08.2013, 19:26
hey there ,
my problem is kinda weird , actually it is weird . I'll go directly to the problem. This is a script for /changename i added to my script , when i compile it , it actually success in compiling it but when i go in-game it says invalid cmd.
i really tried different ways none worked , and the weird part is that it successfully compiled , so if anyone can help me i'll be grateful
dcmd_changename(playerid, params[])
{
if(AccountInfo[playerid][aLevel] < 5) SendClientMessage(playerid, COLOR_RED, "AdminLevel 5 needed for this command!");
new name[MAX_PLAYER_NAME], newname[16];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params,"s", newname)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changename [new name]");
if(dini_Exists(newname)) return SendClientMessage(playerid, COLOR_RED, "That name has already been taken!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", name);
dini_Set(file, "%s.txt", newname);
SendClientMessage(playerid, COLOR_GREEN, "Your name has been successfully been changed");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "That name is too short, pick something else!");
}
return 1;
}
my problem is kinda weird , actually it is weird . I'll go directly to the problem. This is a script for /changename i added to my script , when i compile it , it actually success in compiling it but when i go in-game it says invalid cmd.
i really tried different ways none worked , and the weird part is that it successfully compiled , so if anyone can help me i'll be grateful
dcmd_changename(playerid, params[])
{
if(AccountInfo[playerid][aLevel] < 5) SendClientMessage(playerid, COLOR_RED, "AdminLevel 5 needed for this command!");
new name[MAX_PLAYER_NAME], newname[16];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params,"s", newname)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changename [new name]");
if(dini_Exists(newname)) return SendClientMessage(playerid, COLOR_RED, "That name has already been taken!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", name);
dini_Set(file, "%s.txt", newname);
SendClientMessage(playerid, COLOR_GREEN, "Your name has been successfully been changed");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "That name is too short, pick something else!");
}
return 1;
}