Jump to content

Element Problem


Mossy

Recommended Posts

Hey, I'm creating a UCP for my server and for some reason it's not defining the element.

Here's a part of the script with the error:

function outputMoney () 
        triggerServerEvent("onPlayerAskMoney", localPlayer) 
        destroyElement ( GUIEditor.button[4] ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[4], outputMoney ) 

It says the 2nd argument's element returns nil.

Here's a part of my script with the element:

GUIEditor.button[4] = guiCreateButton(409, 359, 101, 43, "Free $100", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") 

Any help? Thanks.

Link to comment

You confused me a bit. Here's the full code:

GUIEditor = { 
    button = {}, 
    label = {}, 
    window = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(346, 214, 756, 511, "User Control Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.label[1] = guiCreateLabel(52, 37, 640, 63, "Welcome!", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "sa-gothic") 
        guiLabelSetColor(GUIEditor.label[1], 74, 240, 86) 
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) 
        GUIEditor.label[2] = guiCreateLabel(50, 122, 641, 116, "Welcome to Fly San Andreas! Right now you are viewing the incomplete UCP. Our server is not finished so just look \naround and see what we have for now!", false, GUIEditor.window[1]) 
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
        GUIEditor.label[3] = guiCreateLabel(123, 252, 490, 35, "To get started type /work and follow the instructions!", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[3], "default-bold-small") 
        guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) 
        GUIEditor.button[1] = guiCreateButton(14, 468, 79, 34, "Close", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
        GUIEditor.button[2] = guiCreateButton(224, 359, 101, 43, "News", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") 
        GUIEditor.button[4] = guiCreateButton(409, 359, 101, 43, "Free $100", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA")     
    end 
) 
  
function outputMoney () 
        triggerServerEvent("onPlayerAskMoney", localPlayer) 
        destroyElement ( GUIEditor.button[4] ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[4], outputMoney ) 
  
function closeWindow () 
    destroyElement ( GUIEditor.window[1] ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], closeWindow ) 

Now what do I put where? Please be more specific.

Link to comment

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