20.08.2013, 21:52
Good evening one and all.
This code is not difficult, but I would still like to share, it can still be used for other players.
You will need includes ZCMD, sscanf2, can be downloaded on the net.
The code :
If you have any questions, do not hesitate!
This code is not difficult, but I would still like to share, it can still be used for other players.
You will need includes ZCMD, sscanf2, can be downloaded on the net.
The code :
pawn Code:
// ENUM
enum pinfo
{
admin,
adminduty
};
new PlayerInfo[MAX_PLAYERS][pinfo];
// CMD
CMD:rename(playerid, params[])
{
if(PlayerInfo[playerid][admin] >= 1)
{
new giveplayerid, nom[128], string[128], string1[128];
if(PlayerInfo[playerid][adminduty] == 0) { return SendClientMessage(playerid, 0xFFEE0010AA, "You are not in /duty."); }
if(sscanf(params, "us", giveplayerid, nom)) { return SendClientMessage(playerid, 0xFF4BB5C1AA, "/rename [playerid] [New_Name]"); }
if(!IsPlayerConnected(giveplayerid)) { return SendClientMessage(playerid, 0xFFEE0010AA, "Player not connected."); }
format(string, sizeof(string), "Admin %s you rename in: %s.", PlayerName(playerid), nom);
SendClientMessage(giveplayerid, 0xFFEE0010AA, string);
format(string1, sizeof(string1), "AdminWarning: %s a rename %s in %s", PlayerName(playerid), PlayerName(giveplayerid), nom);
SendAdminMessage(string1);
SetPlayerName(giveplayerid, nom);
}
else
{
SendClientMessage(playerid, 0xFFEE0010AA, "You are not a member of Administration.");
}
return 1;
}
// STOCK
stock SendAdminMessage(message[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][admin] && PlayerInfo[i][adminduty] >= 1)
{
SendClientMessage(i, 0xFFFF5214AA, message);
}
else return 0;
}
return 1;
}
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
mysql_real_escape_string(name, name);
return name;
}