Jump to content
  • 0

Anti-reclama


Xcite

Question

Salut , am in gamemode Findip care gaseste ip si la comenzi e adaugat if(FindIP(cmdtext)) return Kick4ip(playerid);

Codul findip:

FindIP(StrToChk[])
{
   if(strfind("hai pe serveru asta", ".com", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
   }
   else if(strfind("se dau admine", ".ro", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
   }
   else if(strfind("intra pe", ".net", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
   }
   else if(strfind("hai aici", ".info", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
   }
   else if(strfind("7777", ".in", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
   }
   new IpLevel = 0;
   for(new a = 0; a < strlen(StrToChk); a++)
   {

      switch(IpLevel)
      {
         case 0:
         {
             if(IsNum(StrToChk[a])) IpLevel++;
         }
         case 1, 2:
         {
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 4;
                else IpLevel = 0;
         }
         case 3:
         {
             if(StrToChk[a] == '.') IpLevel++;
             else IpLevel = 0;
         }
         case 4:
         {
             if(IsNum(StrToChk[a])) IpLevel++;
             else IpLevel = 0;
         }
         case 5, 6:
         {
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 8;
                else IpLevel = 0;
         }
         case 7:
         {
             if(StrToChk[a] == '.') IpLevel++;
             else IpLevel = 0;
         }
         case 8:
         {
             if(IsNum(StrToChk[a])) IpLevel++;
             else IpLevel = 0;
         }
         case 9, 10:{
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 12;
                else IpLevel = 0;
         }
         case 11:
         {
             if(StrToChk[a] == '.') IpLevel++;
             else IpLevel = 0;
         }
         case 12:
         {
             if(IsNum(StrToChk[a])) return 1;
                else IpLevel = 0;
         }
	  }
   }
   return 0;
}
Am incercat :
if(strfind("hai pe serveru asta", ".com", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
   {
    return Kick4IP(playerid);
   }

dar primesc eroare ca nu e definit playerid.

ar trebui sa fac FindIP(playerid, StrToChk[])  ?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

daca gasesti ".com" in "hai pe serverul asta" iti dau adminul meu!

trebuie sa faci ceva gen strfind(StrToChk,"hai pe serveru asta",true) != -1)

Nu am mai avut tangete cu strfind incat sa stiu cum se foloseste , am vazut doar pe net la un post exemplu , iar pe wiki era altfel , nu mi-am dat seama cum se foloseste , deci sa fac:

if(strfind(StrToChk,"hai pe serveru asta",true) != -1)

?

EDIT: Am gasit cum se formeaza strfind , dar cum le adaug la FindIP ( aveti mai sus ) , el normal cauta dupa IP , dar vreau sa ii pun si daca gaseste .com / .net / .ro , la comanda sa returneze Kick4ip(playerid);

Link to comment
Share on other sites

vezi aici http://www.sa-mp.ro/forum/index.php/topic,9010.0.html ia ceva ideei :P

Dar eu am FindIP ( am postat in primul post ) care gaseste doar pe ip , dar as vrea sa adaug la el si daca gaseste .com .net .ro si alte extensii de domenii , pentru ca gaseste doar ip , nu si extensii , as vrea sa adaug tot la el si cu extensii sa nu adaug 2 randuri la fiecare comanda , ci una singura pentru Findip.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.