Stranger Posted October 27, 2013 Share Posted October 27, 2013 hello guys i have a little problem in tihs code addEventHandler( "onClientGUIClick", root, function() if (source == set ) then if not tonumber ( guiGetText ( pass ) ) then guiSetText(pass, "Only Numbers") return end triggerServerEvent( "setpassword", getLocalPlayer(), pass ) outputChatBox("Password has been set to " ..guiGetText ( pass ).. " ", 0, 255, 0) guiSetVisible ( GUIEditor.window[1],not guiGetVisible ( GUIEditor.window[1] ) ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) else outputChatBox( "There is no password ", 255, 0, 0 ) end end ) it's should be working but no, i think the problem in the trigger ? this is the trigger : addEvent("setpassword", true) addEventHandler("setpassword", root, function (pass) setServerPassword( pass) end ) Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 little help please . Link to comment
xXMADEXx Posted October 27, 2013 Share Posted October 27, 2013 any /debugscript 3 errors? Link to comment
Cadu12 Posted October 27, 2013 Share Posted October 27, 2013 (edited) addEventHandler("onClientGUIClick", root, function() if (source == set) then if (tonumber(guiGetText(pass)) == nil) then guiSetText(pass, "Only Numbers") return end triggerServerEvent("setpassword", getLocalPlayer(), pass) outputChatBox("Password has been set to " .. guiGetText(pass) .. " ", 0, 255, 0) guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end end) Edited October 27, 2013 by Guest Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 you forget one end, and this code it's not working Link to comment
Renkon Posted October 27, 2013 Share Posted October 27, 2013 pass is a GUI Element.... you should use guiGetText(pass) in order to know the password. you are triggering the GUI element iself Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 do you mean like this ? addEventHandler("onClientGUIClick", root, function() if (source == set) then if not tonumber ( guiGetText ( pass ) ) then guiSetText(pass, "Only Numbers") return end triggerServerEvent("setpassword", getLocalPlayer(), guiGetText ( pass )) outputChatBox("Password has been set to " ..guiGetText(pass).. " ", 0, 255, 0) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end ) Link to comment
Cadu12 Posted October 27, 2013 Share Posted October 27, 2013 Try copy my post edited. Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 Well, "Renkon", i did but not working @ Cadu12 i did but not working Link to comment
Renkon Posted October 27, 2013 Share Posted October 27, 2013 Because set is a method, not a var Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 so i did change the name of the "button", and nothing 'happened'. Link to comment
Cadu12 Posted October 27, 2013 Share Posted October 27, 2013 pass is a GUI Element.... you should use guiGetText(pass) in order to know the password. you are triggering the GUI element iself Oh, I see it now, he is right. Try copy: addEventHandler("onClientGUIClick", root, function() -- Check if "set" and "pass" is GUI elements, you can remove two lines: outputChatBox("(set) Is GUI-Button?: " .. (isElement(set) and getElementType(set) == "gui-button") and "true" or "false")) outputChatBox("(pass) Is GUI-Edit?: " .. (isElement(pass) and getElementType(pass) == "gui-edit") and "true" or "false")) if (source == set) then local password = tonumber(guiGetText(pass)) if (password == nil) then guiSetText(pass, "Only Numbers") return end triggerServerEvent("setpassword", getLocalPlayer(), password) outputChatBox("Password has been set to " .. password, 0, 255, 0) guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end end) Link to comment
Stranger Posted October 27, 2013 Author Share Posted October 27, 2013 oh, i just fix it, thank you guys 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