Jump to content

Color picker problem


TheIceman1

Recommended Posts

Posted (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 by Guest

Need paid scripter just pm me i will accept every job!

Posted

You forgot the addEvent function:

addEvent ( "onColorPickerOK", true ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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) 
  

Need paid scripter just pm me i will accept every job!

Posted

No errors on your debugscript? you are clicking the "OK" button after choosing the color, right?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

So, it's only loading R and G colors?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Yes

The problem must be on your GUI then.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Maybe you got messed up indexs.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What was it?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

Need paid scripter just pm me i will accept every job!

Posted

Because you are setting it wrong, "r, g, b" should be a table instead, like this:

setElementData ( localPlayer, "color", { r, g, b } ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Because you are setting it wrong, "r, g, b" should be a table instead, like this:
setElementData ( localPlayer, "color", { r, g, b } ) 

Thanks!

Need paid scripter just pm me i will accept every job!

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...