dcmd_changename(playerid,params[])
{
if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
{
new Index;
new tmp[256]; tmp = strtok(params, Index);
if(!strlen(tmp)) return
SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /changename [NewName]") &&
SendClientMessage(playerid, 0xFFFFFFFF, "{FF9900}Function: Will change your name to new name");
new length = strlen(tmp);
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid, 0xFFFFFFFF,"{FF0000}ERROR: Incorrect Name Length");
new string[64];
SendCommandToAdmins(playerid,"ChangeName");
format(string,sizeof(string),"You have set your Name to %s", tmp);
SendClientMessage(playerid, LIGHTGREEN, string);
OnPlayerDisconnect(playerid, -1);
udb_RenameUser(pName(playerid),tmp);
SetPlayerName(playerid, tmp);
return OnPlayerConnect(playerid);
}
else return ErrorMessages(playerid, 1);
}
if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "*** Player not connected ***");
Heres something you could add to it aswell;
Код:
if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "*** Player not connected ***"); |
if(dini_Exists(string)) { SendClientMessage(playerid, COLOR_WHITE, "User Already Exist."); return 1; }
im giving you a little exemple for dini
Код:
if(dini_Exists(string)) { SendClientMessage(playerid, COLOR_WHITE, "User Already Exist."); return 1; } |
new path[128];
format(path,sizeof(path),"Your directory/%s.ini",tmp);
if(fexists(path)) return SendClientMessage(playerid,-1,"This name is taken.. try again!");