23/10/2022 18:13
(23/10/2022 17:20)hiwyn Escreveu:Colocou a include e o plugin Pawn-Regex?(19/10/2022 11:50)Hatiro Escreveu:(18/10/2022 08:37)hiwyn Escreveu: Peguei meu anti divulgação de IPs de outros servidores da net, mas está kickando pessoas inocentes, pessoas que nem estavam divulgando, só mandaram uns numeros tão tomando kick...
Alguém que tenha um funcional que não bane inocente, poderia me passar esse script?
meu script:
Código:if(FindIpPattern(playerid,ver_string)) {
new string[128];
format(string,sizeof(string),"%s kickado por divulgação", PlayerName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
Kick(playerid);
return 0;
}
Código:forward FindIpPattern(playerid,const string[]); public FindIpPattern(playerid,const string[]) {
new stringNumeric = false, stringBegin, ipDigits = 0;
for(new i=0; i<strlen(string); i++) {
if(string[i]<='9' && string[i]>='0')
{
if(!stringNumeric) // first digit
{
stringNumeric=true;
stringBegin=i;
if(i==strlen(string)-1) // string ends with one digit number
{
ipDigits++;
if(ipDigits>3) // 4 digits
return 1;
}
}
else
{
if(i==strlen(string)-1) // string ends with the last digit
{
new stringn[256];
new number;
for(new j=stringBegin; j<i+1; j++)
stringn[j-stringBegin]=string[j];
stringn[i-stringBegin+1]=0;
number=strval(stringn);
if(number>=0 && number<256) // our case
{
ipDigits++;
if(ipDigits>3) // 4 digits
return 1;
}
}
}
}
else
{
if(stringNumeric) // last digit+1
{
stringNumeric=false;
new stringn[256];
new number;
for(new j=stringBegin; j<i; j++)
stringn[j-stringBegin]=string[j];
stringn[i-stringBegin]=0;
number=strval(stringn);
if(number>=0 && number<256) // our case
{
ipDigits++;
if(ipDigits>3) // 4 digits
return 1;
}
else // not in ip-group range
{
ipDigits=0; // reset ip digit counter;
}
}
}
}
return 0;
}
Usa Pawn Regex vai ser melhor
Obs: Não testei mas provavelmente vai funcionar.Código:#include <Pawn.Regex>
// Stock criada
stock IsIp(const texto_ip[])
{
static Regex:regex;
if (!regex) regex = Regex_New("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
return Regex_Check(texto_ip, regex);
}
Código:[14:47:34] [debug] Run time error 19: "File or function is not found"
[14:47:34] [debug] Regex_New
[14:47:34] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:35] [debug] Run time error 19: "File or function is not found"
[14:47:35] [debug] Regex_New
[14:47:35] [debug] Regex_Check
[14:47:36] [debug] Run time error 19: "File or function is not found"
[14:47:36] [debug] Regex_New
[14:47:36] [debug] Regex_Check
[14:47:36] [debug] Run time error 19: "File or function is not found"
[14:47:36] [debug] Regex_New
[14:47:36] [debug] Regex_Check
[14:47:37] [debug] Run time error 19: "File or function is not found"
[14:47:37] [debug] Regex_New
[14:47:37] [debug] Regex_Check
[14:47:37] [debug] Run time error 19: "File or function is not found"
[14:47:37] [debug] Regex_New
[14:47:37] [debug] Regex_Check
[14:47:38] [debug] Run time error 19: "File or function is not found"
[14:47:38] [debug] Regex_New
[14:47:38] [debug] Regex_Check
[14:47:38] [debug] Run time error 19: "File or function is not found"
[14:47:38] [debug] Regex_New
[14:47:38] [debug] Regex_Check
[14:47:39] [debug] Run time error 19: "File or function is not found"
[14:47:39] [debug] Regex_New
[14:47:39] [debug] Regex_Check
[14:47:39] [debug] Run time error 19: "File or function is not found"
[14:47:39] [debug] Regex_New
[14:47:39] [debug] Regex_Check
[14:47:40] [debug] Run time error 19: "File or function is not found"
[14:47:40] [debug] Regex_New
[14:47:40] [debug] Regex_Check
[14:47:41] [debug] Run time error 19: "File or function is not found"
[14:47:41] [debug] Regex_New
[14:47:41] [debug] Regex_Check
[14:47:41] [debug] Run time error 19: "File or function is not found"
[14:47:41] [debug] Regex_New
[14:47:41] [debug] Regex_Check
[14:47:42] [debug] Run time error 19: "File or function is not found"
[14:47:42] [debug] Regex_New
[14:47:42] [debug] Regex_Check
[14:47:42] [debug] Run time error 19: "File or function is not found"
[14:47:42] [debug] Regex_New
[14:47:42] [debug] Regex_Check
[14:47:43] [debug] Run time error 19: "File or function is not found"
[14:47:43] [debug] Regex_New
[14:47:43] [debug] Regex_Check
[14:47:43] [debug] Run time error 19: "File or function is not found"
[14:47:43] [debug] Regex_New
[14:47:43] [debug] Regex_Check
[14:47:44] [debug] Run time error 19: "File or function is not found"
[14:47:44] [debug] Regex_New
[14:47:44] [debug] Regex_Check
[14:47:44] [debug] Run time error 19: "File or function is not found"
[14:47:44] [debug] Regex_New
[14:47:44] [debug] Regex_Check
[14:47:45] [debug] Run time error 19: "File or function is not found"
[14:47:45] [debug] Regex_New
[14:47:45] [debug] Regex_Check
[14:47:45] [debug] Run time error 19: "File or function is not found"
[14:47:45] [debug] Regex_New
[14:47:45] [debug] Regex_Check
[14:47:46] [sampgdk:error] Too many callback arguments (at most 32 allowed)
[14:47:46] [debug] Run time error 19: "File or function is not found"
[14:47:46] [debug] Regex_New
[14:47:46] [debug] Regex_Check
https://github.com/katursis/Pawn.Regex
Não estou disponível para realizar serviços relacionados ao SA-MP e não costumo responder a mensagens privadas, a menos que estejam relacionadas à moderação do fórum.