25.03.2011, 20:43
Hello,
I made this changename command for administrators
to use to change the name of the players. But i've got
a problem now. When I do /changename [playerid] [name],
nothing happens. Here is the script, I don't get error though:
Hope to get answer asap, thanks!
I made this changename command for administrators
to use to change the name of the players. But i've got
a problem now. When I do /changename [playerid] [name],
nothing happens. Here is the script, I don't get error though:
Код:
dcmd_changename(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] >= 1)
{
if(params[0] == 0 || params[1] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changename [playerid] [name] | Ex. John_Saint");
return 1;
}
if(params[0] != INVALID_PLAYER_ID)
{
new oldname[MAX_PLAYER_NAME], newname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME], arank[128], string[256];
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(params[0], oldname, sizeof(oldname));
SetPlayerName(params[0], params[1]);
GetPlayerName(params[0], newname, sizeof(newname));
if(PlayerInfo[playerid][pAdminLevel] == 1)
{
arank = "Moderator";
}
if(PlayerInfo[playerid][pAdminLevel] == 2)
{
arank = "Admin";
}
if(PlayerInfo[playerid][pAdminLevel] == 3)
{
arank = "Lead Admin";
}
if(PlayerInfo[playerid][pAdminLevel] == 4)
{
arank = "Server Owner";
}
format(string, sizeof(string), "* %s %s has changed your name '%s' to '%s'.", arank, aname, oldname, newname);
SendClientMessage(params[0], COLOR_NICEBLUE, "%s %s has changed your name %s to %s.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use this command.");
}
return 1;
}


