Turbe$Z Posted December 10, 2016 Share Posted December 10, 2016 When i type a big character, the script mute me.. But i want, when i type more than one big character, then mute me. How to fix this? /sorry for my bad english/ code: (server only) addEventHandler('onPlayerChat',getRootElement(),function(key) if string.byte(key) > 40 and string.byte(key) < 91 then -- pressed an alphabedical symbol with CAPS LOCK ON! setPlayerMuted( source, true ) gPlayerMuteTimer[ source ] = setTimer( unmutePlayer, gSettings.muteTime * 1000, 1, source ) outputChatBox( "#14B866[M] #FF699CPlaybot#898395: #696969Ne írj csupa nagybetűvel a chatben. Köszi! (#ffFFff"..getPlayerName(source).."#696969) (mute)", root, 255, 0, 0, true ) end end) Link to comment
Dimos7 Posted December 10, 2016 Share Posted December 10, 2016 that you can do it with that string.len Link to comment
Turbe$Z Posted December 10, 2016 Author Share Posted December 10, 2016 4 minutes ago, Dimos7 said: that you can do it with that string.len like this? addEventHandler('onPlayerChat',getRootElement(),function(key) if string.len(key) > 40 and string.len(key) < 91 then Link to comment
Administrators Lpsd Posted December 10, 2016 Administrators Share Posted December 10, 2016 (edited) function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) I guess something like this should work. Change the "2" to increase the amount of capitals needed to mute. For example, if I changed it from 2 to 10, I'd have to type "AAAAAAAAAA" to get muted, rather than "AA" Also, 45 minutes ago, Dimos7 said: that you can do it with that string.len No you can't. Not just with "string.len" Edited December 10, 2016 by LopSided_ 1 Link to comment
Turbe$Z Posted December 10, 2016 Author Share Posted December 10, 2016 3 minutes ago, LopSided_ said: function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) I guess something like this should work. Change the "2" to increase the amount of capitals needed to mute. For example, if I changed it from 2 to 10, I'd have to type "AAAAAAAAAA" to get muted, rather than "AA" Thanks 13 minutes ago, LopSided_ said: function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) I guess something like this should work. Change the "2" to increase the amount of capitals needed to mute. For example, if I changed it from 2 to 10, I'd have to type "AAAAAAAAAA" to get muted, rather than "AA" Also, No you can't. Not just with "string.len" oh wait.. when i type this 'Asd asd asd' for example, me muted.. why? 1 Link to comment
Turbe$Z Posted December 10, 2016 Author Share Posted December 10, 2016 32 minutes ago, LopSided_ said: function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) I guess something like this should work. Change the "2" to increase the amount of capitals needed to mute. For example, if I changed it from 2 to 10, I'd have to type "AAAAAAAAAA" to get muted, rather than "AA" Also, No you can't. Not just with "string.len" oh wait.. when i type this 'Asd asd asd' for example, me muted.. why? Link to comment
Administrators Lpsd Posted December 10, 2016 Administrators Share Posted December 10, 2016 function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) Fixed, my bad. 1 Link to comment
Turbe$Z Posted December 10, 2016 Author Share Posted December 10, 2016 3 minutes ago, LopSided_ said: function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) Fixed, my bad. ahh thanks Link to comment
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