Mefisto_PL Posted December 28, 2012 Posted December 28, 2012 I found in dxGUI resource that script: --[[ /*************************************************************************************************************** * * PROJECT: dxGUI * LICENSE: See LICENSE in the top level directory * FILE: dxAnimation.lua * PURPOSE: Animation Functions * DEVELOPERS: Skyline * * dxGUI is available from [url=https://community.multitheftauto.com/index.php?p=resources&s=details&id=4871]https://community.multitheftauto.com/index.php?p= ... ls&id=4871[/url] * ****************************************************************************************************************/ ]] function dxMove(dxElement,xMove,yMove,titleMove) if not dxElement or not xMove or not yMove then outputDebugString("dxMove gets wrong parameters (dxElement,xMove,yMove[,titleMove=true])") return end if titleMove == nil then titleMove = true end local x,y,tx,ty = dxGetPosition(dxElement) move = function() local movex,movey,movetx,movety = false,false,false,false local xx,yy,txx,tyy = dxGetPosition(dxElement) if ( xx ~= x+xMove ) then if (xx > x+xMove ) then xx = xx - 1 else xx = xx + 1 end else movex = true end if (yy ~= y+yMove) then if (yy > y+yMove) then yy = yy -1 else yy = yy +1 end else movey = true end if (tx) then if ( txx ~= tx+xMove ) then if (txx > tx+xMove ) then txx = txx - 1 else txx = txx + 1 end else movetx = true end else movetx = true end if (ty) then if ( tyy ~= ty+yMove ) then if (tyy > ty+yMove ) then tyy = tyy - 1 else tyy = tyy + 1 end else movety = true end else movety = true end dxSetPosition(dxElement,xx,yy,false,false) if (titleMove and getElementType(dxElement) == "dxWindow") then dxWindowSetTitlePosition(dxElement,txx,tyy) end if movex and movey and movetx and movety then removeEventHandler('onClientRender',getRootElement(),move) triggerEventHandler('onClientDXMove',dxElement,xx,yy,txx,tyy) end end addEventHandler('onClientRender',getRootElement(),move) end But how to export and use it?
Anderl Posted December 28, 2012 Posted December 28, 2012 Add: <export function="functionName" type="client/server"/> To your meta.xml To call it use: exports.resource:functionName(); --or exports['resource']:functionName(); "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Mefisto_PL Posted December 28, 2012 Author Posted December 28, 2012 But how use it in export ? Make an example pls ;x
Anderl Posted December 28, 2012 Posted December 28, 2012 What do you mean? "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Mefisto_PL Posted December 28, 2012 Author Posted December 28, 2012 dxMove(dxElement,xMove,yMove,titleMove) Show me it "in action"
Castillo Posted December 28, 2012 Posted December 28, 2012 exports.dxGUI:dxMove ( theElement, 0, 0 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Anderl Posted December 29, 2012 Posted December 29, 2012 I gave you an example when I explained you how to export functions. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Mefisto_PL Posted December 29, 2012 Author Posted December 29, 2012 Hmm so for example I create dx button and that function move this button from first position to second position, right?
Castillo Posted December 29, 2012 Posted December 29, 2012 Exactly, I think it was obviously, but well. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted December 29, 2012 Posted December 29, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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