Where is the bug
#2

Give this a try, this should work.

Код:
if(strcmp(cmd, "/ban", true) == 0)
	{
		if (!IsPlayerAdmin(playerid) && adminlevel[playerid] < 3)
		{
 			SendClientMessage(playerid, COLOR_RED, "You have not enough rights to use this command!");
			return 1;
 		}
 		if(IsPlayerAdmin(playerid) || adminlevel[playerid] > 2)
 		{
  			tmp = strtok(cmdtext, idx);
  		if(!strlen(tmp))
  		{
  			SendClientMessage(playerid, COLOR_GRAD, "USAGE: /ban [playerid] [reason]");
  	 		return 1;
  		}
  		if(!IsPlayerConnected(playerid))
  		{
  	 		SendClientMessage(playerid, COLOR_RED, "That player is not connected!");
  	    return 1;
  	  	}
  	  	giveplayerid = strval(tmp);
  	  new length = strlen(cmdtext);
  	  while ((idx < length) && (cmdtext[idx] <= ' '))
  	  {
  	    idx++;
  	  }
  	  new offset = idx;
  	  new result[64];
  	  while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  	  {
  	    result[idx - offset] = cmdtext[idx];
  	    idx++;
  	  }
  	  result[idx - offset] = EOS;
  	  if ((IsPlayerAdmin(giveplayerid)))
  	  {
  	    SendClientMessage(playerid, COLOR_RED, "You can not ban the server owner!");
  	    return 1;
  	  }
  	  if ((IsPlayerAdmin(playerid)) || adminlevel[playerid] >= 3)
  	  {
  	  	  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
   	 	 	GetPlayerName(playerid, sendername, sizeof(sendername));
   	    format(string,sizeof(string),"*** Admin %s has banned %s (reason: %s) ***",sendername,giveplayer, result);
    	  SendClientMessageToAll(COLOR_RED,string);
      	printf("*** Admin %s has banned %s with reason: %s ***",sendername,giveplayer, result);
      	Ban(giveplayerid);
      	return 1;
    	}
  		 	else
    	{
    	 	  SendClientMessage(playerid,COLOR_RED,"You have not enough rights to use this command!");
   		 	return 1;
    	}
   	}
   	return 1;
	}
Reply


Messages In This Thread
Where is the bug - by Battlaman - 30.08.2009, 20:00
Re: Where is the bug - by JR ! - 30.08.2009, 22:03
Re: Where is the bug - by Battlaman - 31.08.2009, 12:27
Re: Where is the bug - by MenaceX^ - 31.08.2009, 12:34
Re: Where is the bug - by JR ! - 31.08.2009, 17:45

Forum Jump:


Users browsing this thread: 1 Guest(s)