Jump to content

anti-flood


Nerses

Recommended Posts

here is my Lua

local ads = 
{ 
    'AD1', 
    'AD2', 
    'AD3', 
    'AD4', 
    'AD5', 
} 
addEventHandler("onPlayerChat", root, 
 function(msg) 
     for _,v in ipairs(ads) do 
     if string.find(msg,v) then 
     banPlayer( source ) 
       end 
     end 
  end 
) 
  

here is my meta

<meta> 
    <info author='ners' version='1.1' name='Anti-Flood' type='script' /> 
    <script src="anti_flood.lua" type="server" /> 
</meta> 

Link to comment

Oh *facepalm* ...

Your code incorrect, Onix+ already wrote correct variant:

local ads = 
{ 
    'AD1', 
    'AD2', 
    'AD3', 
    'AD4', 
    'AD5' -- Don't forget to keep the last one without comma. 
} 
addEventHandler("onPlayerChat", root, 
function(msg) 
     for index, v in ipairs(ads) do 
          if string.find(msg,v) then 
               cancelEvent() 
               banPlayer ( source, false, false, true ) 
          end 
     end 
end 
) 

Link to comment
Oh *facepalm* ...

Your code incorrect, Onix+ already wrote correct variant:

local ads = 
{ 
    'AD1', 
    'AD2', 
    'AD3', 
    'AD4', 
    'AD5' -- Don't forget to keep the last one without comma. 
} 
addEventHandler("onPlayerChat", root, 
function(msg) 
     for index, v in ipairs(ads) do 
          if string.find(msg,v) then 
               cancelEvent() 
               banPlayer ( source, false, false, true ) 
          end 
     end 
end 
) 

Still doesn't work. Not responding

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