Ban problem
#1

When i ban someone it says Gogeta(myname) has banned Gogeta(AGAIN MY NAME WHICH SHOULD SAY THE TARGET) Reasonworks.

pawn Код:
CMD:ban(playerid, params[])
{
    if(Player[playerid] [pAdmin] >=1)
    {
        new targetid;
        new admin[MAX_PLAYER_NAME];
        new target[MAX_PLAYER_NAME];
        new reason[50];
        new string[120];
        GetPlayerName(playerid,admin,sizeof(admin));
        GetPlayerName(targetid,target,sizeof(target));
        if(sscanf(params,"us",targetid,reason)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/ban [PlayerID] [REASON]");
        format(string,sizeof(string),"Administrator %s has banned %s reason: %s.",admin,target,reason);
        SendClientMessageToAll(COLOR_RED,string);
        SavePlayer(targetid);
        Ban(targetid);
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"[SERVER]:You are not allowed to use this command");
    }
    return 1;
}
Reply
#2

I use params and use pName

is something

pawn Код:
CMD:ban(playerid, params[])
{
    if(Player[playerid] [pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED,"[SERVER]:You are not allowed to use this command");
        new string[120];
        if(sscanf(params,"rs[128]",params[0],params[1])) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/ban [PlayerID] [REASON]");
        format(string,sizeof(string),"Administrator %s has banned %s reason: %s.",pName(playerid),pName(params[0]),params[1]);
        SendClientMessageToAll(COLOR_RED,string);
        SavePlayer(params[0]);
        Ban(params[0]);
      return 1;
}
to set the pName and you're not putting the new admin or other thing only to detect the user's name

pawn Код:
stock pName(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}
let me know if it helps? or do not understand what happens to your command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)