SA-MP Forums Archive
What is the problem with this command? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What is the problem with this command? (/showthread.php?tid=88273)



What is the problem with this command? - Puzi - 25.07.2009

Код:
	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


Re: What is the problem with this command? - GTA_Rules - 25.07.2009

You format the string but don't send it.

Add SendClientMessageToAll(COLOR_RED, string); under format(string...


Re: What is the problem with this command? - abhinavdabral - 25.07.2009

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;
    }
    }