xXMADEXx Posted February 7, 2013 Share Posted February 7, 2013 Hey guys, im trying to make my edit only allow numbers 0-9, but not really any luck. The text to show that you're only allowed to use 0-9 will work, but it won't cancel the event. addEventHandler("onClientGUIChanged",root, function () if source == rog_modshop_colors_edit_red then local t = tonumber(guiGetText(rog_modshop_colors_edit_red)) if (t=="1") then else outputChatBox("Modshop: You are only allowed to use 3 characters, of 0-9",255,0,0) cancelEvent() end end end ) Link to comment
myonlake Posted February 7, 2013 Share Posted February 7, 2013 Your code is weird. You are checking a string against an integer, which is not possible. And you are also forgetting to check the values in case they are strings or less/more than 0-9. Client-side addEventHandler("onClientGUIChanged", root, function() if source == rog_modshop_colors_edit_red then local t = tonumber(guiGetText(rog_modshop_colors_edit_red)) if t then if (not t >= 0) and (not t <= 9) then outputChatBox("Modshop: You are only allowed to use 3 characters, of 0-9.", 255, 0, 0, false) end else outputChatBox("Modshop: You are only allowed to use 3 characters, of 0-9.", 255, 0, 0, false) end end end ) Link to comment
Guest Guest4401 Posted February 7, 2013 Share Posted February 7, 2013 cancelEvent doesn't work for that event. Replace your entire code with guiSetProperty(rog_modshop_colors_edit_red,'ValidationString','[0-9]?[0-9]?[0-9]?|') 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