04.02.2014, 21:53
pawn Код:
CMD:cname(playerid, params[])
{
if(PlayerInfo[playerid][Admin] < 2) return 1;
new targetid, newName[MAX_PLAYER_NAME];
if(sscanf(params, "us[24]", targetid, newName)) return SCM(playerid, 0xF70505FF, "Usage: {FFFFFF}/cname <playerid> <new name>");
if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Invalid playerid.");
new clientMessage[128], pname[MAX_PLAYER_NAME];
GetPlayerName(targetid, pname, sizeof(pname));
format(clientMessage, sizeof(clientMessage), "UPDATE `playerdata` SET `user` = '%s' WHERE `user` = '%s'", sanitize(newName), pname);
mysql_function_query(mysqlc, clientMessage, false, "", "");
SetPlayerName(targetPlayer, "TEMP_CNAME");
SetPlayerName(targetPlayer, newName);
format(clientMessage, sizeof(clientMessage), "%s (lvl %d) %s (%d) changed %s (%d)'s account name to %s.", AdminLevelToName(playerid), PlayerInfo[playerid][Admin], GetPlayersName(playerid) ,playerid, pname, targetid, newName);
SendStaffMessage(pink, clientMessage);
strins(clientMessage, "1,8", 0);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, clientMessage);
return 1;
}