DarkRP - hook autoban

Hello.
I have an interesting question. I tried to make autoban if the player writes ip of servers. But I faced such problem that if to specify ip of nothing occurs, reacts only if to write the text which is specified in hook. Whether it is possible to change somehow check that would work at input fully of ip?



hook.Add( "PlayerSay", "urashit", function( ply, text, public )
text = string.lower( text )
if ( text == "27015" ) or ( text == "27016" ) or ( text == "27017" ) or ( text == "27020" ) or ( text == "27028" ) then
RunConsoleCommand("ulx", "ban", ply:Nick(), "0", "Advert IP")
return false
end
end )


P.S. Excuse me for my bad English.

http://puu.sh/k1c2k/32ec0b3d4d.png

Wrong section, but:




local Chata = 
{
":27015",
":27016",
":27017",
":27020"
}

hook.Add( "PlayerSay", "urashit", function( ply, text, public )
  for k,v in pairs(Chata) do 
       if string.find(text, v) then 
          RunConsoleCommand("ulx", "ban", ply:Nick(), "0", "Advertising IP")
          return ""
       end 
  end
end )


No need to string.lower numbers haha

You should use ulx banid ply:SteamID() instead of what you’re currently using as it’s exploitable.

Edit: I see how it’s exploitable. Good point haha!



local Chata = 
{
":27015",
":27016",
":27017",
":27020"
}

hook.Add( "PlayerSay", "urashit", function( ply, text, public )
  for k,v in pairs(Chata) do 
       if string.find(text, v) then 
          RunConsoleCommand("ulx", "banid", ply:SteamID(), "0", "Advertising IP")
          return ""
       end 
  end
end )


Sorry, I didn’t pay attention. The following time I will be more attentive. I thank for the help