golanu21 Posted April 6, 2013 Posted April 6, 2013 how i can make function in another function ? for example function gui () -- this is a function --there is a gui guiSetVisibile(guiwindow, false) --and here i want to start other function with bindKey or, how i make setElementData for a gui? [Dev]BloWnRPG - We BloW the World [1%]
CapY Posted April 6, 2013 Posted April 6, 2013 function Gui() -- this is a function --there is a gui guiSetVisible(guiwindow, false) --and here i want to start other function with bindKey bindKey("yourkey", keystate, functionname) --keystate = "up" or "down" end
golanu21 Posted April 6, 2013 Author Posted April 6, 2013 function Gui() -- this is a function --there is a gui guiSetVisible(guiwindow, false) --and here i want to start other function with bindKey bindKey("yourkey", keystate, functionname) --keystate = "up" or "down" end for example function Gui() -- this is a function --there is a gui guiSetVisible(guiwindow, false) --and here i want to start other function with bindKey bindKey("F2","down", showgui) function showgui () guiSetVisibile(guiwindow, true) end end i can make that ? [Dev]BloWnRPG - We BloW the World [1%]
Axel Posted April 6, 2013 Posted April 6, 2013 Maybe something like this: function Gui() guiSetVisible(guiwindow, false) bindKey("F2","down", function () guiSetVisibile(guiwindow, true) end) end
tosfera Posted April 6, 2013 Posted April 6, 2013 Why do you want to create a function in another function, create it outside of it so you can call it back alot more. Thats called OOP (Object Orientated Programming). function Gui() guiSetVisible(guiwindow, false); bindKey("F2","down", showgui); showGui("guiwindow"); end function showGui (window) guiSetVisibile(window, true) end If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
ixjf Posted April 6, 2013 Posted April 6, 2013 Why do you want to create a function in another function, create it outside of it so you can call it back alot more. Thats called OOP (Object Orientated Programming). function Gui() guiSetVisible(guiwindow, false); bindKey("F2","down", showgui); showGui("guiwindow"); end function showGui (window) guiSetVisibile(window, true) end Is it? I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
golanu21 Posted April 6, 2013 Author Posted April 6, 2013 function createcomand(cmd, gangname, ...) local gangname = table.concat({...}, " ") if gangname then guiSetVisible(factionwindow, true) guiSetText(factionwindow, "Faction-System|By: 'golanu21',"..gangname..".") else outputChatBox("[invalid Syntax]: /createfaction NAME", source, 255, 0, 0) end end addCommandHandler("makefaction", createcomand) the gangname is global, wtf ???, this is the eror [Dev]BloWnRPG - We BloW the World [1%]
ixjf Posted April 6, 2013 Posted April 6, 2013 You aren't passing any other argument to the function, but you're trying to concatenate a list of variables (which don't exist). Delete line 2 and ", ..." from the parameters list of the function. I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
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