SA-MP Forums Archive
IRC Command Help - 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: IRC Command Help (/showthread.php?tid=111962)



IRC Command Help - CJ101 - 05.12.2009

Код:
irccmd_bans(conn, channel[], user[], params[])
{
  #pragma unused conn,channel,user
  	new string[200],list;
	if(!strlen(params)) return IrcSay("USAGE: !bans <ip>");
	if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
 	new File:myFilez = fopen("/config/badips.txt", io_read);
 	new bans;
	if(myFilez)
  {
    while(fread(myFilez, string, sizeof(string)))
    {
      if(strfind(params,string, true) == 0)
      {
      bans++;
		  }
    }

		if(bans == 0)
		  {
	  		format(string,sizeof(string),"3 The Server has found no bans for the ip '%s'",params);
	      IrcSay(string);
		  }
		  else
		  {
		  	format(string,sizeof(string),"3 The Server has found %d bans for the ip '%s'",list,params);
	      IrcSay(string);
		  }

    fclose(myFilez);
  }
	return 1;
}
If if search for the ip it says its not banned when it is banned..


Re: IRC Command Help - dice7 - 05.12.2009

Strfind returns the index of the first letter in the searching string (params)


Re: IRC Command Help - CJ101 - 05.12.2009

So if i just switch to strcmp it will work?