12.08.2012, 15:24
My problem is I can change name even the name is already taken So I can get his stats and messed everything.
Anyone know how to fix this? if Player is already registered with the same name im going to change name, and I do "/changename Samplename"
SendClientMessage "The name is already taken"
Anyone know how to fix this? if Player is already registered with the same name im going to change name, and I do "/changename Samplename"
SendClientMessage "The name is already taken"
pawn Код:
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);
}