Need working /ban command with reason show
#1

Now I use this ban command:

Код:
		else if (streq(cmd,"/ban")) {
			new id=GetId(playerid,rest);
			if (id==INVALID_PLAYER_ID) return 1;
      new ID = strval(cmdtext[6]);
      new pName[24], str[64];
      if(IsPlayerConnected(ID))
      GetPlayerName(ID, pName, 24);
      format(str, 64, "%s has been banned from the server for: %s", pName,rest);
      SendClientMessageToAll(COLOR_ORED, str);
      print("Player banned");
 			Ban(ID);

			return 1;

    }
This shows on NAME has been banned for: reason

Name always replaces the ID 0 name, if I kicked example ID 1

I've also tried this in my code:
Код:
	
	
else if(strcmp(cmdtext, "/ban", true, 5)==0)
{
  if(!IsPlayerAdmin(playerid)) return 0;
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /ban [playerid] [reason]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
    format(str, 64, "%s has been banned from the server for: %s", pName,rest);
    SendClientMessageToAll(COLOR_ORED, str);
    print("Player banned");
    Ban(ID);
  }
  return 1;
}
But this one appears many errors, what is wrong and could someone give me working version


Thanks


Reply
#2

You havn't told us what is 'good', what exactly do u want in the ban command?

Post the errors you get along with which line is which number. Alternatively, why not have a look at the admin filterscripts or the Useful Commands thread, there are some good ones there.
Reply
#3

I mean working with reason show
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)