SA-MP Forums Archive
[FilterScript] A command to rename a player. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] A command to rename a player. (/showthread.php?tid=459076)



A command to rename a player. - BrendaSAMP - 20.08.2013

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!


Re: A command to rename a player. - -Prodigy- - 20.08.2013

Clearly copied from another scrip. Someone delete this shit


Re: A command to rename a player. - NinjahZ - 20.08.2013

This section is not for copy&pasting codes,this is for releasing Filterscripts,not snippets from gamemodes that you have either downloaded or just made for the hell of it,please either turn this into a filterscript code or move it into a tutorial on how to make a /changename command.


Re: A command to rename a player. - BrendaSAMP - 20.08.2013

It is not the copy / paste is done in French (my language) and translate.

I clearly stated that it is not hard to do.


Re: A command to rename a player. - NinjahZ - 20.08.2013

Quote:
Originally Posted by BrendaSAMP
View Post
It is not the copy / paste is done in French (my language) and translate.

I clearly stated that it is not hard to do.
Well,it could of also been quite easily added into a filterscript aswell,not just a plain copy n paste into a post,because you could of just shared it in script help on one of the post's there,because I seen someone looking for help about /changename command.


Re: A command to rename a player. - xF4Life - 20.08.2013

lol the guy want and high reputation xd


Re: A command to rename a player. - RedFusion - 21.08.2013

Someone is hungry for reputation points


Re: A command to rename a player. - Beckett - 21.08.2013

Either you make something yourself or don't just copy-paste.



Re: A command to rename a player. - d0nTtoucH - 21.08.2013

dont get this .. ?:S how will it change the name of the person if the players folder not selected ? is that possible,? can someone explain it to me .. .


Re: A command to rename a player. - x96664 - 22.08.2013

This is clearly copied from another script, if it wasn't it wouldn't lack the command for admin duty and also the admin levels. You could've made it with rcon instead of copy-pasting and proving that it's not your code.