Jump to content

[HELP] Cancel chat on voting


LonelyRoad

Recommended Posts

Posted

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.

Posted

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

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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