block ip on class

Сообщения
10
Реакции
0
I need a suggestion how to block an ip on class? We initially blocked: STEAM_ID_LAN and VALVE_ID_LAN, but I also want to be able to block an IP on the class (exe: 96.55.x.x).
I don't want to ban IP by class, I want those who have at least slot to enter the server

Thanks!
Код:
public client_authorized(id)
{
if(get_pcvar_num(ValveEnabled) == 0)
{
return PLUGIN_CONTINUE
}
    
if (get_user_flags(id) & ADMIN_USER)
{
new Name[32],IP[40], Authid[35]
get_user_authid(id,Authid,34)
get_user_name(id,Name,31)
get_user_ip(id,IP,39, 1)

if(equal(Authid,"STEAM_ID_LAN") || equal(Authid, "VALVE_ID_LAN"))
{
log_amx("%s (IP: %s) was kicked for having %s",Name,IP,Authid)
server_cmd("kick #%d",get_user_userid(id))
}
}
return PLUGIN_HANDLED
}
 
Сообщения
2,491
Реакции
2,790
Помог
61 раз(а)
lulu3192, you can create plugin with client command that will run server cmd addip if player has access to it
 
Сообщения
10
Реакции
0
I was misunderstood, i didn't mean those with slot to have access to that command. I mean those who have a slot even if they have IP 96.55.1.2 or 96.55.42.22 to can connect server, even if that ip is blocked.

this is an example:
public client_authorized(id)
{
if(get_pcvar_num(IPEnabled) == 0)
{
return PLUGIN_CONTINUE
}
if (get_user_flags(id) & ADMIN_USER)
{
new Name[32],IP[40], Authid[35]
get_user_ip(id,IP,39, 1)
if(equal(IP,"96.55.1.2"))
{
get_user_authid(id,Authid,34)
get_user_name(id,Name,31)
log_amx("%s (IP: %s) was kicked for having %s",Name,IP,Authid)
server_cmd("kick #%d",get_user_userid(id))
}
}
return PLUGIN_HANDLED
}
But if my ip changes from 96.55.1.2 to 96.55.42.22, can i come in. I do not want to let me in, no matter how it changes last 2 class ip: (
when I say class ip, I mean 96.55.x.x - these .x.x)
I'm glad if you could help me in a way
 

Ayk

Сообщения
763
Реакции
476
Помог
19 раз(а)
lulu3192, get user's ip, split it in 4 parts (or split on 2nd dot) , check if the first 2 parts are equals to what you need.
 
Сообщения
10
Реакции
0
ok, but how?

I tried to use this function, but I did not make it functional, do you have any idea?

Код:
new address[32]
get_user_ip(player, address, 31, 1)
new ip1[4], ip2[4], tmp2[32], iptoban[32]
    
strtok(address, ip1, 3, tmp1, 31, '.')
strtok(tmp1, ip2, 3, tmp2, 31, '.')

format(iptoban, 31, "96.55.%s.%s", ip1, ip2)
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу