[REQUEST]/changename commands for players
#9

Im not so professional scripter so i have no idea how to do it...

Could anyone help ? Here is the cmd:

pawn Код:
if(strcmp(cmd, "/changename", true) == 0)
    {
      GetPlayerName(playerid, sendername, sizeof(sendername));
        new tmpp[256];
        tmpp = strtok(cmdtext, idx);
        if(!strlen(tmpp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /changename [playerid] [new_nick]");
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: Remember to ban/delete old Firstname_Lastname from 'accounts' folder!!");
            return 1;
        }
        giveplayerid = strval(tmpp);
        tmp = strtok(cmdtext, idx);
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(IsPlayerConnected(playerid))
        {
          if(PlayerInfo[playerid][pAdmin] >= 1337)
          {
            if(IsPlayerConnected(giveplayerid))
            {
                    SetPlayerName(giveplayerid, tmp);
                    format(string, sizeof(string), "[SERVER]: %s(%i) has changed Your name to %s", sendername, playerid, tmp);
                    SendClientMessage(giveplayerid, COLOR_GREEN, string);
                    format(string, sizeof(string), "[SERVER]: You have changed ID %i's name to %s", giveplayerid, tmp);
                    SendClientMessage(playerid, COLOR_GREEN, string);
                    format(string, sizeof(string), "[SERVER]: Remember to ban/delete %s's old Firstname_Lastname!", tmp);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    format(string, 256, "[SERVER]: %s has changed %s's his name to %s.", sendername,giveplayer, tmp);
                    ABroadCast(COLOR_RED,string,1);
                }
                else
                {
                  format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                    SendClientMessage(playerid, COLOR_GREY, string);
                }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, "You do not have permission to use that command!");
            }
        }
        else
        {
          SendClientMessage(playerid, COLOR_GREY, "You Must be logged in to use this command!");
        }
        return 1;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)