[FilterScript] A command to rename a player.
#1

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 :

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;
}
If you have any questions, do not hesitate!
Reply


Messages In This Thread
A command to rename a player. - by BrendaSAMP - 20.08.2013, 21:52
Re: A command to rename a player. - by -Prodigy- - 20.08.2013, 21:59
Re: A command to rename a player. - by NinjahZ - 20.08.2013, 22:04
Re: A command to rename a player. - by BrendaSAMP - 20.08.2013, 22:17
Re: A command to rename a player. - by NinjahZ - 20.08.2013, 22:20
Re: A command to rename a player. - by xF4Life - 20.08.2013, 22:22
Re: A command to rename a player. - by RedFusion - 21.08.2013, 11:39
Re: A command to rename a player. - by DaniceMcHarley - 21.08.2013, 17:08
Re: A command to rename a player. - by d0nTtoucH - 21.08.2013, 19:13
Re: A command to rename a player. - by x96664 - 22.08.2013, 00:14

Forum Jump:


Users browsing this thread: 2 Guest(s)