Jump to content

[HELP] Cancel chat on voting


LonelyRoad

Recommended Posts

Hey guys,

I was looking to get some help with something, I want to know if the race gamemode calls an event when map voting starts.

Also, I would like to know if I how to check onPlayerChat for numbers 1-9 and if it contains that, to replace it with an X or something like that.

Regards.

Link to comment

use this to cancel all messages starting with number and not having any a-z letters

function trim (s)
return (string.gsub(s, "^%s*(.+)%s*$", "%1"))
end
 
addEventHandler("onPlayerChat", getRootElement(), function(msg, type)
if (string.find(trim(msg), "^[0-9]+[^a-z]*$")~=nil) then
cancelEvent()
end
end)

these will be cancelled:

1

1!!!!!!

111111111111!!!!!!!!!

1111111111111$%^%$& 1111111111

11111111111 11111111111

these will not be cancelled:

1 is very cool, vote!

vote for 1

x 111111111111

i want 1!!!!!!!!!!!!!!!!

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