15.05.2014, 12:52
try this...
but this script is untested yet...
but this script is untested yet...
pawn Код:
CMD:changename(playerid,params[]) {
if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
new tmp[128], tmp2[128], Index;
if(sscanf(params,"is[128]",tmp,tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
new length = strlen(tmp2), string[128], file[256], file2[256];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(!IsPlayerConnected(tmp) || tmp != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
format(file, sizeof(file), "/ladmin/users/%s.sav",pName(tmp));
format(file2, sizeof(file2), "/ladmin/users/%s.sav",pName(tmp2));
if(!udb_Exists(file2)){
CMDMessageToAdmins(playerid,"CHANGENAME");
format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(tmp), tmp2); SendClientMessage(playerid,blue,string);
SetPlayerName(tmp, tmp2);
OnPlayerConnect(tmp);
SaveToFile("NAMECHANGELOG ",string);
udb_UserSet(file,"%s.sav",tmp2);
} else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
return 1;
}