11.11.2013, 21:26
Here's Changename:
pawn Код:
CMD:changename(playerid, params[])
{
if(PInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR, "You have to be an admin to use this command!"); // restrict command to Admin use only!
new newname[MAX_PLAYER_NAME], oldname[MAX_PLAYER_NAME], targetid; // Variables to save names
if(sscanf(playerid, "us", targetid, newname)) return SendClientMessage(playerid, COLOR, "Usage: /changename [playerid] [new Name]"); // Check parameters use
new message[144]; // Variable which will be formated
GetPlayerName(targetid, oldname, sizeof(oldname)); // Get the person who will have his name changed and save it in oldname
SetPlayerName(targetid, newname); // Set His name to newname
format(message,sizeof(message), "You have changed %s 's name to %s!", oldname, newname); // Format message accordingly
SendClientMessage(playerid, COLOR, message); // Actually send the message
new adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
format(message, sizeof(message), "Admin %s has changed your name to %s!", adminname, newname);
SendClientMessage(targetid, COLOR, message);
return 1;
} // By: Elie1996