30.04.2010, 16:23
FIXED
if(!strcmp(cmd, "/changename", true)) { if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In"); tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]"); GetPlayerName(playerid, playername, sizeof(playername)); if(fexist(udb_encode(playername))) { if(!fexist(udb_encode(tmp))) { SetPlayerName(playerid, tmp); frename(udb_encode(playername),udb_encode(tmp)); format(string, sizeof(string), "%s has changed his/her name to %s.",playername, tmp); SendClientMessageToAll(COLOR_YELLOW, string); format(string, sizeof(string), "You have succesfully changed your name to %s.", tmp); SendClientMessage(playerid, COLOR_GREEN, string); }else SendClientMessage(playerid, COLOR_GREEN, "This name is already in use"); }//else SendClientMessage(playerid, COLOR_GREEN, "You dont have account"); return 1; }
Originally Posted by Jefff
Код:
if(!strcmp(cmd, "/changename", true)) { if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In"); tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]"); GetPlayerName(playerid, playername, sizeof(playername)); if(fexist(udb_encode(playername))) { if(!fexist(udb_encode(tmp))) { SetPlayerName(playerid, tmp); frename(udb_encode(playername),udb_encode(tmp)); format(string, sizeof(string), "%s has changed his/her name to %s.",playername, tmp); SendClientMessageToAll(COLOR_YELLOW, string); format(string, sizeof(string), "You have succesfully changed your name to %s.", tmp); SendClientMessage(playerid, COLOR_GREEN, string); }else SendClientMessage(playerid, COLOR_GREEN, "This name is already in use"); }//else SendClientMessage(playerid, COLOR_GREEN, "You dont have account"); return 1; } |
Originally Posted by ruckfules99
Can you please help me out? i've been looking for a /changename command for a while now, and cannot find one.
I use dudb and i tried adding this into my script, compiled without errors but when i go in game and type /changename Jeff nothing happens. |
Originally Posted by CAR
Quote:
|
if(!strcmp(cmd, "/changename", true))
{
if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In"); // delete if you don't use
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]");
GetPlayerName(playerid, playername, sizeof(playername));
new playerfile[30], newfile[30], newname;
newname = strval(tmp);
format(playerfile, sizeof(playerfile), "%s.dudb, playername);
format(newfile, sizeof(newfile), %s.dudb, newname);
if(fexist(playerfile)) {
if(!fexist(newfile)) {
SetPlayerName(playerid, tmp);
frename(playerfile,newfile);
format(string, sizeof(string), "%s has changed his/her name to %s.",playername, tmp);
SendClientMessageToAll(COLOR_YELLOW, string);
format(string, sizeof(string), "You have succesfully changed your name to %s.", tmp);
SendClientMessage(playerid, COLOR_GREEN, string);
}else SendClientMessage(playerid, COLOR_GREEN, "This name is already in use");
}//else SendClientMessage(playerid, COLOR_GREEN, "You dont have account");
return 1;
}
error 017: undefined symbol "playername" error 017: undefined symbol "playername" error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
new playername[32];
invalid string (possibly non-terminated string) error 029: invalid expression, assumed zero error 017: undefined symbol "dudb" fatal error 107: too many error messages on one line