Z góry dzięki
#include <amxmodx>
#include <file>
#include <string>
public plugin_init()
{
register_plugin("HugeBan", "0.1", "kbr_Kobra")
register_concmd("amx_hugeban","ban_ip_range",ADMIN_BAN,"<amx_hugeban> amx_hugeban <ip_from> <ip_to> <time>")
//set_task(30.0, "checkIp",1222)
}
public client_connect(id)
{
new ip[16],ip1[16],ip2[16],ip3[16],ip4[16]
new ipA[16],ipB[16],a1[16],a2[16],a3[16],a4[16],b1[16],b2[16],b3[16],b4[16]
new czas[20],a,index,i,plik[100],len,nieban,c
new tmp[100],aq1,aq2,aq3,aq4,bq1,bq2,bq3,bq4,iq1,iq2,iq3,iq4
new CurrentTime[25],iplog[16],name[50]
new ipLarge,aLarge,bLarge
CurrentTime=""
get_time("%Y.%d.%m - %H:%M:%S - ",CurrentTime,25)
if(file_exists("addons/amxmodx/configs/ban.txt")!=0)
get_user_ip(id,ip,16,1)
while( contain ( ip, "." ) > -1 )
replace( ip, 16, ".", " " )
ip1=""
ip2=""
ip3=""
ip4=""
parse(ip,ip1,5,ip2,5,ip3,5,ip4,5)
iq1=str_to_num(ip1)
iq2=str_to_num(ip2)
iq3=str_to_num(ip3)
iq4=str_to_num(ip4)
ipLarge=iq1*255*255*255+iq2*255*255+iq3*255+iq4
index=1
a=0
while (index!=0)
{
index=read_file("addons/amxmodx/configs/ban.txt",a,plik,100,len)
if(index!=0)
{
parse(plik,ipA,16,ipB,16,czas,10)
while( contain ( ipA, "." ) > -1 )
replace( ipA, 16, ".", " " )
a1=""
a2=""
a3=""
a4=""
parse(ipA,a1,5,a2,5,a3,5,a4,5)
aq1=str_to_num(a1)
aq2=str_to_num(a2)
aq3=str_to_num(a3)
aq4=str_to_num(a4)
while( contain ( ipB, "." ) > -1 )
replace( ipB, 16, ".", " " )
b1=""
b2=""
b3=""
b4=""
parse(ipB,b1,5,b2,5,b3,5,b4,5)
bq1=str_to_num(b1)
bq2=str_to_num(b2)
bq3=str_to_num(b3)
bq4=str_to_num(b4)
aLarge=aq1*255*255*255+aq2*255*255+aq3*255+aq4
bLarge=bq1*255*255*255+bq2*255*255+bq3*255+bq4
if(aLarge<=ipLarge<=bLarge)
{
iplog=ip
while( contain(iplog, " " ) > -1 )
replace(iplog, 16, " ", "." )
tmp=""
add(tmp,100,CurrentTime)
add(tmp,100,iplog)
get_user_name(id,name,50)
add(tmp,100," <")
add(tmp,100,name)
add(tmp,100,">")
nieban=0
i=1
c=0
new tmpNick[50],tmpPass[50],tmpX[100];
while (i!=0)
{
tmpX="";
tmpNick="";
tmpPass="";
i=read_file("addons/amxmodx/configs/konta.ini",c,tmpX,100,len)
parse(tmpX,tmpNick,50,tmpPass,50)
if(equal(name,tmpNick))
{
nieban=1
}
c++
}
if(nieban==0)
{
write_file("addons/amxmodx/logs/ban_zakaz.log",tmp);
client_cmd(id,"echo ^"Twoje ip jest zablokowane!! Wejdz na www aby zarejestrowac konto neo.^";disconnect")
index=0
} else
{
add(tmp,100," EXCL")
write_file("addons/amxmodx/logs/ban_zgoda.log",tmp);
}
}
}
a++
}
}
public checkIp()
{
new ip[16],ip1[16],ip2[16],ip3[16],ip4[16]
new ipA[16],ipB[16],a1[16],a2[16],a3[16],a4[16],b1[16],b2[16],b3[16],b4[16]
new czas[20],a,index,i,plik[100],len,nieban,c
new tmp[100],aq1,aq2,aq3,aq4,bq1,bq2,bq3,bq4,iq1,iq2,iq3,iq4
new CurrentTime[25],name[50],iplog[16]
new ipLarge,aLarge,bLarge
CurrentTime=""
get_time("%Y.%d.%m - %H:%M:%S - ",CurrentTime,25)
if(file_exists("addons/amxmodx/configs/ban.txt")!=0)
for(new id=1;id<33;id++)
{
get_user_ip(id,ip,16,1)
while( contain ( ip, "." ) > -1 )
replace( ip, 16, ".", " " )
ip1=""
ip2=""
ip3=""
ip4=""
parse(ip,ip1,5,ip2,5,ip3,5,ip4,5)
iq1=str_to_num(ip1)
iq2=str_to_num(ip2)
iq3=str_to_num(ip3)
iq4=str_to_num(ip4)
ipLarge=iq1*255*255*255+iq2*255*255+iq3*255+iq4
index=1
a=0
while (index!=0)
{
index=read_file("addons/amxmodx/configs/ban.txt",a,plik,100,len)
if(index!=0)
{
parse(plik,ipA,16,ipB,16,czas,10)
while( contain(ipA, "." ) > -1 )
replace(ipA, 16, ".", " ")
a1=""
a2=""
a3=""
a4=""
parse(ipA,a1,5,a2,5,a3,5,a4,5)
aq1=str_to_num(a1)
aq2=str_to_num(a2)
aq3=str_to_num(a3)
aq4=str_to_num(a4)
while( contain(ipB, "." ) > -1 )
replace(ipB, 16, ".", " " )
b1=""
b2=""
b3=""
b4=""
parse(ipB,b1,5,b2,5,b3,5,b4,5)
bq1=str_to_num(b1)
bq2=str_to_num(b2)
bq3=str_to_num(b3)
bq4=str_to_num(b4)
aLarge=aq1*255*255*255+aq2*255*255+aq3*255+aq4
bLarge=bq1*255*255*255+bq2*255*255+bq3*255+bq4
if(aLarge<=ipLarge<=bLarge)
{
iplog=ip
while( contain(iplog, " " ) > -1 )
replace(iplog, 16, " ", "." )
tmp=""
add(tmp,100,CurrentTime)
add(tmp,100,iplog)
name=" <"
get_user_name(id,name,50)
add(name,50,">")
add(tmp,100,name)
nieban=0
i=1
c=0
new tmpNick[50],tmpPass[50],tmpX[100];
while (i!=0)
{
tmpX="";
tmpNick="";
tmpPass="";
i=read_file("addons/amxmodx/configs/konta.ini",c,tmpX,100,len)
parse(tmpX,tmpNick,50,tmpPass,50)
if(equal(name,tmpNick))
{
nieban=1
}
c++
}
if(nieban==0)
{
new lReason[64]
format(lReason, 63, "%L", id, "Twoje ip jest zablokowane!! Wejdz na www aby zarejestrowac konto neo.")
write_file("addons/amxmodx/logs/ban_zakaz.log",tmp);
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
client_cmd(id,"echo ^"Twoje ip jest zablokowane!! Wejdz na wwwu aby zarejestrowac konto neo.^";disconnect")
index=0
} else
{
add(tmp,100," EXCL")
write_file("addons/amxmodx/logs/ban_zgoda.log",tmp);
}
}
}
a++
}
}
if(task_exists(1222,0)==1) remove_task(1222,0)
set_task(30.0, "checkIp",1222)
}
public ban_ip_range(id)
{
if(read_argc()==4)
{
new ipfrom[20],ipto[20],time[20],tmp[100]
read_argv(1,ipfrom,20)
read_argv(2,ipfrom,20)
tmp=""
add(tmp,100,ipfrom)
add(tmp,100," ")
add(tmp,100,ipto)
add(tmp,100," ")
add(tmp,100,time)
write_file("addons/amxmodx/configs/ban.txt",tmp)
} else
{
console_print(id,"Uzycie: amx_hugeban fromIp toIp Time")
}
}


Dodatki SourceMod



Temat jest zamknięty








