Jump to content

[HELP] Anti IP Advertisment


Rouzbeh

Recommended Posts

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?)

Link to comment
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

Link to comment
  • Moderators

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.

Link to comment

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 :)

Link to comment
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

Link to comment
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.

Link to comment

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...