Jump to content

Help.


Vanlot

Recommended Posts

"انا جديد بالبرمجة و نحب نصنع "لوقن بانل

I want function which let me open new Window when i press a button. My friend Sparrow gave me this function:

function nub() 
if (source == registerBtn) then 
guiSetVisible(registerWindow, true) 
guiBringToFront(registerWindow) 
end 
end 
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), nub) 

but it didn't work. Help plz , Thanx :)

Link to comment
"انا جديد بالبرمجة و نحب نصنع "لوقن بانل

I want function which let me open new Window when i press a button. My friend Sparrow gave me this function:

function nub() 
if (source == registerBtn) then 
guiSetVisible(registerWindow, true) 
guiBringToFront(registerWindow) 
end 
end 
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), nub) 

but it didn't work. Help plz , Thanx

firstly

getResourceRootElement(getThisResource())

doesn't make sense with ' onClientGUIClick '

try this

function nub() 
if (source == registerBtn) then 
   guiSetVisible(registerWindow, true) 
   guiBringToFront(registerWindow) 
end 
end 
addEventHandler("onClientGUIClick", root, nub) 

root = getRootElement()

P.S. this getResourceRootElement(getThisResource()) make more sense with

https://wiki.multitheftauto.com/wiki/OnResourceStart

or

https://wiki.multitheftauto.com/wiki/OnC ... ourceStart

and this is predefined as 'resourceRoot'

resourceRoot = getResourceRootElement(getThisResource())

that's better

Link to comment

شف المثال هذه يمكن يفيدك

addEventHandler (  
        'onClientResourceStart', resourceRoot, 
    function () 
        Window = guiCreateWindow(...) 
        Button = guiCreateButton(...) 
        guiSetVisible ( Window, false ) 
        addEventHandler ( 'onClientGUIClick', Button, Visible, false ) 
    end 
) 
  
function Visible () 
    guiSetVisible ( Window, not guiGetVisible ( Window ) ) 
end 

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