OnPlayerText
#1

I am trying to make admin command through OnPlayerText.
The problem is when i type the command wrong sscanf works great but when i type it correctly nothing happens
i am using zcmd and my friend is doing the same as me right now and in his gamemode works we are both using the same method.

here is the code
pawn Код:
if(pInfo[playerid][Adminlevel] >= 1)
    {
       if(strcmp(text,"!warn",true,5))
       {
          new ID,reason[50];
          if(sscanf(text,"us[50]",ID,reason))
          {
             SendClientMessage(playerid,COLOR_ERROR,"USAGE: !warn (Player Name/ID) (Reason)");
             return 0;
          }
          if(ID == INVALID_PLAYER_ID)
          {
             format(string,sizeof(string),"ID %d is not connected to the server.",ID);
             return 0;
          }
          if(WarnTimes[ID] >= 2)
          {
             format(string,sizeof(string),"%s(%d) has been auto kicked from the server because he has reached maximum warnings [3/3 Warnings].",GetName(ID),ID);
             SendClientMessageToAll(COLOR_PINK,string);
             
             format(string, sizeof(string), "~W~You Have Been ~R~Kicked ~W~From The Server");
             GameTextForPlayer(ID ,string, 99999999999999999999999, 3);
             KickTime[ID] = 3;
             return 0;
          }
          else
          {
             WarnTimes[ID]+=1;
             if(WarnTimes[ID]==1)
             {
                format(string,sizeof(string),"%s(%d) has warned %s(%d) reason: %s. [1/3 Warnings].",GetName(playerid),playerid,GetName(ID),ID,reason);
                SendClientMessageToAll(COLOR_PINK,string);
                return 0;
             }
             else if(WarnTimes[ID]==2)
             {
                format(string,sizeof(string),"%s(%d) has warned %s(%d) reason: %s. [2/3 Warnings].",GetName(playerid),playerid,GetName(ID),ID,reason);
                SendClientMessageToAll(COLOR_PINK,string);
                return 0;
             }
          }
      }
      return 0;
    }
Reply


Messages In This Thread
OnPlayerText - by DarkLored - 31.03.2014, 03:28
Re: OnPlayerText - by DarkLored - 31.03.2014, 03:59
Re: OnPlayerText - by LocMax - 31.03.2014, 05:31
Re: OnPlayerText - by DarkLored - 31.03.2014, 22:23
Re: OnPlayerText - by Vince - 31.03.2014, 22:29
Re: OnPlayerText - by DarkLored - 31.03.2014, 22:39
Re: OnPlayerText - by Jefff - 31.03.2014, 22:49
Re: OnPlayerText - by DarkLored - 31.03.2014, 23:13
Re: OnPlayerText - by SickAttack - 01.04.2014, 01:22
Re: OnPlayerText - by Threshold - 01.04.2014, 04:24

Forum Jump:


Users browsing this thread: 2 Guest(s)