What is the problem with this command?
#1

Код:
	if ( strcmp ( cmd , "/kick" , true ) == 0 && IsPlayerAdmin ( playerid ) )
	{
	  new tmp [ 256 ];

		new message [ 256 ];

		tmp = strtok ( cmdtext , idx );

    if( ! strlen ( tmp ) )
		{
		  SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /kick [playerid]" );
		  return 1;
	  }

	  new giveplayerid = strval(tmp);

	  tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))
	  {
	    if (IsPlayerConnected(giveplayerid))
	    {
	    SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
      format(string, sizeof(string), "*** %s has been kicked / dostał kicka. (player: %d) / (Reason/Powуd: %s.)",GetName(giveplayerid), giveplayerid, message);
      SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
			Kick(giveplayerid);
			return 1;
		  }
			else
			{
        format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
      }
    }

    if(giveplayerid < 10)
    {
		  strmid(message, cmdtext, 7, strlen(cmdtext));
    }
		else
		{
      strmid(message, cmdtext, 8, strlen(cmdtext));
    }

  	  if (IsPlayerConnected(giveplayerid))
	  {
	    SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
      format(string, sizeof(string), "*** %s has been kicked / dostał kicka. (player: %d) / (Reason/Powуd: %s.)",GetName(giveplayerid), giveplayerid, message);
      SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
			Kick(giveplayerid);
			return 1;
	  }
		else
		{
      format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
      SendClientMessage(playerid, COLOR_WHITE, string);
      return 1;
    }
	}
Yes, the kick works ...But this is what appears when someone gets kicked by admin

Код:
_______________________________________________
_______________________________________________
Can someone help or tell me what is wrong?

Thanks and Regards
Puzi
Reply
#2

You format the string but don't send it.

Add SendClientMessageToAll(COLOR_RED, string); under format(string...
Reply
#3

LOL .... crazzy bug
see the fixed one
pawn Код:
if ( strcmp ( cmd , "/kick" , true ) == 0 && IsPlayerAdmin ( playerid ) )
    {
      new tmp [ 256 ];

        new message [ 256 ];

        tmp = strtok ( cmdtext , idx );

    if( ! strlen ( tmp ) )
        {
          SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /kick [playerid]" );
          return 1;
      }

      new giveplayerid = strval(tmp);

      tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))
      {
        if (IsPlayerConnected(giveplayerid))
        {
        SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
      format(string, sizeof(string), "*** %s has been kicked / dostał kicka. (player: %d) / (Reason/Powуd: %s.)",GetName(giveplayerid), giveplayerid, message);
      SendClientMessageToAll(COLOR_RED,string);
SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
            Kick(giveplayerid);
            return 1;
          }
            else
            {
        format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
      }
    }

    if(giveplayerid < 10)
    {
          strmid(message, cmdtext, 7, strlen(cmdtext));
    }
        else
        {
      strmid(message, cmdtext, 8, strlen(cmdtext));
    }

      if (IsPlayerConnected(giveplayerid))
      {
        SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
      format(string, sizeof(string), "*** %s has been kicked / dostał kicka. (player: %d) / (Reason/Powуd: %s.)",GetName(giveplayerid), giveplayerid, message);
      SendClientMessageToAll(COLOR_RED,string);
SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
            Kick(giveplayerid);
            return 1;
      }
        else
        {
      format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
      SendClientMessage(playerid, COLOR_WHITE, string);
      return 1;
    }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)