Jump to content

[HELP] Anti IP Advertisment


Rouzbeh

Recommended Posts

Posted

hello guys.

i am looking for best way to detect ip in strings

and also i want it detect when a text contains numbers higher than 10

help plz?!!! :!:

Posted
function getIPType(ip) 
  local R = {ERROR = 0, IPV4 = 1, IPV6 = 2, STRING = 3} 
  if type(ip) ~= "string" then return R.ERROR end 
  
  -- check for format 1.11.111.111 for ipv4 
  local chunks = {ip:match("(%d+)%.(%d+)%.(%d+)%.(%d+)")} 
  if #chunks == 4 then 
    for _,v in pairs(chunks) do 
      if tonumber(v) > 255 then return R.STRING end 
    end 
    return R.IPV4 
  end 
  
  -- check for ipv6 format, should be 8 'chunks' of numbers/letters 
  -- without trailing chars 
  local chunks = {ip:match(("([a-fA-F0-9]*):"):rep(8):gsub(":$","$"))} 
  if #chunks == 8 then 
    for _,v in pairs(chunks) do 
      if #v > 0 and tonumber(v, 16) > 65535 then return R.STRING end 
    end 
    return R.IPV6 
  end 
  
  return R.STRING 
end 

What do you mean by detect when a text contains numbers higher than 10? You could loop through text and count numbers (or do you want to know how long the string is?)

Posted
What do you mean by detect when a text contains numbers higher than 10? You could loop through text and count numbers (or do you want to know how long the string is?)

For Example You Write: "my ip is 110 229 10 30" OR say "ip is 180", i want it be detected

  • Moderators
Posted

You can't do that as you will also detect "I need 25 $". Dude you are going too far with that Anti-ip advertisement ! :o And "My ip is 180" is not an IP so how can it be an advirtisement ?

You are going to ban all numbers on your server.

Posted

What he wants is to check if the number is in an ip format, and if so not allow it. Aka

192.168.1.1, 4 decimals 4 numbers.

Some thing that can be added to prevent mis-bans is to check if it is a valid ip some how.

Posted

Some people would just use domain names instead or say the name if their server instead of posting links. I never actually seen anyone leaving a server just because some random guy joins just to advertise a different one, I also recommend musing them instead of banning them, that way they probably stay in your server and realize that your server is better than the (possible) shit they just advertised for :)

Posted
You can't do that as you will also detect "I need 25 $". Dude you are going too far with that Anti-ip advertisement ! :o And "My ip is 180" is not an IP so how can it be an advirtisement ?

You are going to ban all numbers on your server.

Trust me , i had sa-mp server for many years and saw players advertise like this:

ip: 185

87

183

90

(press enter instead of '.' or write ip without '.'

i dont want ban numbers, i just wanna it report it to admins

Posted

You could ban typing numbers alone - that way every message would need at least a word along with it, so "IP is 127" "0" "0" "1" won't work (last 3 messages blocked)

Posted
You can't do that as you will also detect "I need 25 $". Dude you are going too far with that Anti-ip advertisement ! :o And "My ip is 180" is not an IP so how can it be an advirtisement ?

You are going to ban all numbers on your server.

Trust me , i had sa-mp server for many years and saw players advertise like this:

ip: 185

87

183

90

(press enter instead of '.' or write ip without '.'

i dont want ban numbers, i just wanna it report it to admins

Are you serious? Do you think that anyone will leave your server because some pathetic idiot spams an IP in chat? Think again.. I myself dont even bother banning these if it occurs, they just join, send IP and leave. Noone cares.

Posted

Most efficient way would be to get some moderators which are online most of the time and ban those who advertise.

Posted

Really you don't need a script for this. First as MIK said, yes they're idiots who have nothing better to do, no one listens. Secound that's what active admins are for. Stuff like this..

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...