Jump to content

I need help


Hero192

Recommended Posts

Hey guys, I am doing anti spam system,

and if the text is equal to msg already stored in messages table,

but I want to allow just the text "leave" can be spammed, how can do it?

local bool = false 
local messages = {} 
  
for i, v in pairs(messages) do 
        local msg = v[1] 
        if text == msg then   
            bool = true  
            break 
       end   
end   
if bool == true then return end 
--code.. 

Link to comment
First, are you sure that the current code is working ??

It looks like you truncated some parts needed for that code to work.

A code should be working before extending it.

Its just a part of my code and its working fine, but I want only "leave" can be spammed

Link to comment
  • Moderators
First, are you sure that the current code is working ??

It looks like you truncated some parts needed for that code to work.

A code should be working before extending it.

Its just a part of my code and its working fine, but I want only "leave" can be spammed

Hmmm okay then just replace this line:

if text == msg then 

by this line:

if text == msg and text ~= "leave" then 

or this line if you don't want it to be case-sensitive:

if text == msg and string.lower(text) ~= "leave" then 

Link to comment
  • Moderators

No, on the client-side, the function signature of outputChatBox is:

bool outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) 

and doesn't accept the visibleTo like the server-side version.

If you need to do it from the client side, you have to use triggerServerEvent on an event you will create on the server-side and use that event to call a function in which you will use your outputChatBox.

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