Hero192 Posted March 8, 2016 Posted March 8, 2016 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..
Moderators Citizen Posted March 9, 2016 Moderators Posted March 9, 2016 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.
Hero192 Posted March 9, 2016 Author Posted March 9, 2016 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
SpecT Posted March 9, 2016 Posted March 9, 2016 (edited) Event: OnPlayerChat if msg == "leave" then cancelEvent That's all you have to do .. Edited March 9, 2016 by Guest
pro-mos Posted March 9, 2016 Posted March 9, 2016 where shall I add it? well, your code is unclear, so add it before the code line that checks for text content, and dont forget to use end after the if statment
Moderators Citizen Posted March 9, 2016 Moderators Posted March 9, 2016 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
Hero192 Posted March 10, 2016 Author Posted March 10, 2016 worked tnx, one more simple question, I just want to be sure of it, Is it possible to make a message visible on all players by using root in client side?
Moderators Citizen Posted March 10, 2016 Moderators Posted March 10, 2016 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now