Jump to content

function


golanu21

Recommended Posts

Posted

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?

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted
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 

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

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

Maybe something like this:

  
function Gui() 
    guiSetVisible(guiwindow, false) 
    bindKey("F2","down", 
    function () 
    guiSetVisibile(guiwindow, true) 
    end) 
end 
  

Posted

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 

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted
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

Posted
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

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

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