is it possible to make a script where if people post a link to “advertise” for another server or some kind of line besides my servers discord link or website it will kick them from the server for advertising? also i can use for people who wanna spam profanity?
1 Like
Do some simple regexing, if find a certian string dropplayer
1 Like
AddEventHandler('chatMessage', function(source, name, message)
message = string.lower(message)
if (message == "******") then
DropPlayer(source, 'That Type Of Language Will Not be Tollerated On This Server!!!')
CancelEvent()
else
if (message == "discord.gg")
then
DropPlayer(source, 'Dont Advertise For Another server!!!')
CancelEvent()
end
end)
this is what i have in the cl_chat.lua file i made and in __resource.lua i have
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
client_script 'cl_chat.lua'
went in game and said both of them and nothing happened.
1 Like
That code is meant to be serverside…
2 Likes
blockedWords = blockedWords or {}
blockedWords = {".gg", ".com", ".net"}
AddEventHandler('chatMessage', function(source, name, message)
for k,v in pairs(blockedWords) do
if string.match(message, v) then
DropPlayer(source, 'That kind of language is uncalled for.')
CancelEvent()
print (' A player was Kicked for Advertising' )
end
end
end)
2 Likes
server_script ‘sv_chat.lua’
2 Likes
ohh i get what u mean i had it wrong lol my bad passing out in my chair.
1 Like
what about commands cause we have commands for /cad, /discord and stuff that wont cause a issue right? sense this checks for a player source?
1 Like
yeah that will not be a problem.There would be noone to drop.
1 Like
figures as much thank you so much im still new to LUA and iv been up all night writing permissions and editing handling files
2 Likes