TheIceman1 Posted March 15, 2013 Share 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 Link to comment
Castillo Posted March 15, 2013 Share Posted March 15, 2013 You forgot the addEvent function: addEvent ( "onColorPickerOK", true ) Link to comment
Tete omar Posted March 15, 2013 Share Posted March 15, 2013 If you don't use the following arguments: elements, hex; why are you passing them to this function? Link to comment
Tete omar Posted March 15, 2013 Share Posted March 15, 2013 Nothing happens. Show us how did you add castillo's code Link to comment
TheIceman1 Posted March 15, 2013 Author Share 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) Link to comment
Castillo Posted March 15, 2013 Share Posted March 15, 2013 No errors on your debugscript? you are clicking the "OK" button after choosing the color, right? Link to comment
Tete omar Posted March 15, 2013 Share Posted March 15, 2013 It seems right to me, but can you show us what debugscript says? Link to comment
TheIceman1 Posted March 15, 2013 Author Share Posted March 15, 2013 No errors.Yes im 100% sure i clicked "OK" Link to comment
Castillo Posted March 15, 2013 Share 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. Link to comment
TheIceman1 Posted March 15, 2013 Author Share Posted March 15, 2013 Castillo,it outputs r,g,b,but look this this code set only edit[2],edit[3] text. Link to comment
Tete omar Posted March 15, 2013 Share Posted March 15, 2013 Are you putting the code in the same resource 'cpicker'?? Link to comment
Castillo Posted March 15, 2013 Share Posted March 15, 2013 So, it's only loading R and G colors? Link to comment
Jaysds1 Posted March 15, 2013 Share Posted March 15, 2013 maybe you created the blue editbox first, so try guiSetText ( GUIEditor_Edit[1], b ) Link to comment
Castillo Posted March 15, 2013 Share Posted March 15, 2013 Yes The problem must be on your GUI then. Link to comment
TheIceman1 Posted March 15, 2013 Author Share Posted March 15, 2013 GUIEditor_Edit[4] = guiCreateEdit(139,90,49,34,"",false,GUIEditor_Window[1]) Link to comment
Castillo Posted March 15, 2013 Share Posted March 15, 2013 Maybe you got messed up indexs. Link to comment
TheIceman1 Posted March 15, 2013 Author Share Posted March 15, 2013 Solved,i found problem! Link to comment
TheIceman1 Posted March 15, 2013 Author Share 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 ) Link to comment
Castillo Posted March 15, 2013 Share 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 } ) Link to comment
TheIceman1 Posted March 15, 2013 Author Share 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! 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