TheIceman1 Posted March 15, 2013 Posted March 15, 2013 (edited) addEventHandler("onClientGUIClick", GUIEditor_Button[1], function() exports.cpicker:openPicker(localPlayer, "#FFAA00", "Clan system") end) addEvent ( "onColorPickerOK", true ) addEventHandler("onColorPickerOK", root, function(element, hex, r, g, b) guiSetText(GUIEditor_Edit[2], r ) guiSetText(GUIEditor_Edit[3], g ) guiSetText(GUIEditor_Edit[4], b ) end) Edited March 15, 2013 by Guest
Castillo Posted March 15, 2013 Posted March 15, 2013 You forgot the addEvent function: addEvent ( "onColorPickerOK", true )
Tete omar Posted March 15, 2013 Posted March 15, 2013 If you don't use the following arguments: elements, hex; why are you passing them to this function?
Tete omar Posted March 15, 2013 Posted March 15, 2013 Nothing happens. Show us how did you add castillo's code
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 If you don't use the following arguments:elements, hex; why are you passing them to this function? if i delete "element" and "hex" then in edit says "#f0f00"(hex code). addEventHandler("onClientGUIClick", GUIEditor_Button[1], function() exports.cpicker:openPicker(localPlayer, "#FFAA00", "Clan system") end) addEvent ( "onColorPickerOK", true ) addEventHandler("onColorPickerOK", root, function(element, hex, r, g, b) guiSetText(GUIEditor_Edit[2], r ) guiSetText(GUIEditor_Edit[3], g ) guiSetText(GUIEditor_Edit[4], b ) end)
Castillo Posted March 15, 2013 Posted March 15, 2013 No errors on your debugscript? you are clicking the "OK" button after choosing the color, right?
Tete omar Posted March 15, 2013 Posted March 15, 2013 It seems right to me, but can you show us what debugscript says?
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 No errors.Yes im 100% sure i clicked "OK"
Castillo Posted March 15, 2013 Posted March 15, 2013 addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], function ( ) exports.cpicker:openPicker ( localPlayer, "#FFAA00", "Clan system" ) end ,false ) addEvent ( "onColorPickerOK", true ) addEventHandler ( "onColorPickerOK", root, function ( element, hex, r, g, b ) guiSetText ( GUIEditor_Edit[2], r ) guiSetText ( GUIEditor_Edit[3], g ) guiSetText ( GUIEditor_Edit[4], b ) outputChatBox ( r ..", ".. g ..", ".. b ) end ) See what it outputs to chat.
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 Castillo,it outputs r,g,b,but look this this code set only edit[2],edit[3] text.
Tete omar Posted March 15, 2013 Posted March 15, 2013 Are you putting the code in the same resource 'cpicker'??
Jaysds1 Posted March 15, 2013 Posted March 15, 2013 maybe you created the blue editbox first, so try guiSetText ( GUIEditor_Edit[1], b )
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 GUIEditor_Edit[4] = guiCreateEdit(139,90,49,34,"",false,GUIEditor_Window[1])
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 There was two edits with name GUIEditor_Edit[4],but i have new problem Why this dont set element data?Error "setElementData"[Expected bool at argument 4, got string"59"] local r = guiGetText ( GUIEditor_Edit[2] ) local g = guiGetText ( GUIEditor_Edit[3] ) local b = guiGetText ( GUIEditor_Edit[4] ) setElementData ( localPlayer, "color", r, g, b )
Castillo Posted March 15, 2013 Posted March 15, 2013 Because you are setting it wrong, "r, g, b" should be a table instead, like this: setElementData ( localPlayer, "color", { r, g, b } )
TheIceman1 Posted March 15, 2013 Author Posted March 15, 2013 Because you are setting it wrong, "r, g, b" should be a table instead, like this: setElementData ( localPlayer, "color", { r, g, b } ) Thanks!
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