Jump to content

Spice up a Login Script


1feihu

Recommended Posts

i have a working login script for my server but i was wondering when the login window pops up.....is there a way to make the screen pan over sections of the map rather than stick behind your self.....i was on a server a long time ago that had something like that and i was wondering how i would....i am new to Lua but i do tinker with it anytime i can but i am stumped on how to pull this one off....so if there is anyone out there who can help me...i would be SO greatfull

Link to comment

here is my login script

Server

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 
  
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  
function onRegister ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    end 
end 
  
addEvent( "onRegister", true ) 
addEventHandler( "onRegister", getRootElement(), onRegister ) 

Client

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(264,152,255,341,"Welcome!",false) 
guiSetAlpha(GUIEditor_Window[1],1) 
LoginUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginUsername,1) 
LoginPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginPassword,1) 
guiEditSetMasked ( LoginPassword, true ) 
GUIEditor_Label[2] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[2],1) 
guiLabelSetColor(GUIEditor_Label[2],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Label[3] = guiCreateLabel(0.0471,0.2962,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[3],1) 
guiLabelSetColor(GUIEditor_Label[3],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Label[4] = guiCreateLabel(0.0745,0.5279,0.8314,0.0645,"If you are new, please register!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[4],1) 
guiLabelSetColor(GUIEditor_Label[4],255,150,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) 
guiSetFont(GUIEditor_Label[4],"clear-normal") 
GUIEditor_Label[5] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Welcome to James Kile's server",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[5],1) 
guiLabelSetColor(GUIEditor_Label[5],255,150,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) 
guiSetFont(GUIEditor_Label[5],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(0.5216,0.4164,0.3961,0.0909,"Login!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[1],1) 
EditRegisterUsername = guiCreateEdit(0.2902,0.5924,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(EditRegisterUsername,1) 
EditRegisterPassword = guiCreateEdit(0.2902,0.7038,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiEditSetMasked ( EditRegisterPassword, true ) 
guiSetAlpha(EditRegisterPassword,1) 
GUIEditor_Label[6] = guiCreateLabel(0.0392,0.61,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[6],1) 
guiLabelSetColor(GUIEditor_Label[6],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) 
guiSetFont(GUIEditor_Label[6],"default-bold-small") 
GUIEditor_Label[7] = guiCreateLabel(0.0392,0.7185,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[7],1) 
guiLabelSetColor(GUIEditor_Label[7],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) 
guiSetFont(GUIEditor_Label[7],"default-bold-small") 
GUIEditor_Button[2] = guiCreateButton(0.5216,0.8328,0.3961,0.0909,"Register!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[2],1) 
GUIEditor_Image[1] = guiCreateStaticImage(0.0549,0.7918,0.349,0.173,"data/mtalogo.png",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Image[1],1) 
  
guiSetVisible ( GUIEditor_Window[1], false ) 
  
local localPlayer = getLocalPlayer ( ) 
  
function windowHandler( ) 
    local playername = getPlayerName(localPlayer) 
     
    guiSetText(LoginUsername, "") 
    guiSetText(EditRegisterUsername, "") 
  
    guiSetText(LoginUsername, playername) 
    guiSetText(EditRegisterUsername, playername) 
  
    guiSetVisible (  GUIEditor_Window[1], true ) 
  
    guiSetInputEnabled(true) 
    showCursor ( true ) 
end 
  
function onClickBtn ( button, state ) 
    if (source == GUIEditor_Button[1]) then 
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) 
    end 
end 
  
function onClickBtn2 ( button, state ) 
    if (source == GUIEditor_Button[2]) then 
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) 
    end 
end 
  
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
end 
addEvent( "hideLoginWindow", true ) 
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 
  
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false 

Link to comment
You mean you want to move the GUI off from the screen instead of just forcing it with destroyElement?

You could use the arc_'s animation library or then you can invent your own function for it.

If, He Want, To Move The Gui He Can Use :

guiSetPosition 
"onClientRender" 
setTimer 
removeEventHandler 

Link to comment

try this i didn't test it but i'm sure it's working perfect

client:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
-- 
local anims = { }; 
local screenSize = { guiGetScreenSize () }; 
-- 
  
GUIEditor_Window[1] = guiCreateWindow(264,152,255,341,"Welcome!",false) 
guiSetAlpha(GUIEditor_Window[1],1) 
LoginUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginUsername,1) 
LoginPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginPassword,1) 
guiEditSetMasked ( LoginPassword, true ) 
GUIEditor_Label[2] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[2],1) 
guiLabelSetColor(GUIEditor_Label[2],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Label[3] = guiCreateLabel(0.0471,0.2962,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[3],1) 
guiLabelSetColor(GUIEditor_Label[3],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Label[4] = guiCreateLabel(0.0745,0.5279,0.8314,0.0645,"If you are new, please register!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[4],1) 
guiLabelSetColor(GUIEditor_Label[4],255,150,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) 
guiSetFont(GUIEditor_Label[4],"clear-normal") 
GUIEditor_Label[5] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Welcome to James Kile's server",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[5],1) 
guiLabelSetColor(GUIEditor_Label[5],255,150,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) 
guiSetFont(GUIEditor_Label[5],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(0.5216,0.4164,0.3961,0.0909,"Login!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[1],1) 
EditRegisterUsername = guiCreateEdit(0.2902,0.5924,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(EditRegisterUsername,1) 
EditRegisterPassword = guiCreateEdit(0.2902,0.7038,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiEditSetMasked ( EditRegisterPassword, true ) 
guiSetAlpha(EditRegisterPassword,1) 
GUIEditor_Label[6] = guiCreateLabel(0.0392,0.61,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[6],1) 
guiLabelSetColor(GUIEditor_Label[6],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) 
guiSetFont(GUIEditor_Label[6],"default-bold-small") 
GUIEditor_Label[7] = guiCreateLabel(0.0392,0.7185,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[7],1) 
guiLabelSetColor(GUIEditor_Label[7],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) 
guiSetFont(GUIEditor_Label[7],"default-bold-small") 
GUIEditor_Button[2] = guiCreateButton(0.5216,0.8328,0.3961,0.0909,"Register!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[2],1) 
GUIEditor_Image[1] = guiCreateStaticImage(0.0549,0.7918,0.349,0.173,"data/mtalogo.png",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Image[1],1) 
  
-- 
guiSetAlpha( GUIEditor_Window[ 1 ], 0 ); 
-- 
local localPlayer = getLocalPlayer ( ) 
  
function windowHandler( ) 
    local playername = getPlayerName(localPlayer) 
    
    guiSetText(LoginUsername, "") 
    guiSetText(EditRegisterUsername, "") 
  
    guiSetText(LoginUsername, playername) 
    guiSetText(EditRegisterUsername, playername) 
    -- 
    local width, height = guiGetSize( GUIEditor_Window[ 1 ], false ); 
    local x, y = screenSize[ 1 ] / 2 - width / 2, screenSize[ 2 ] / 2 - height / 2; 
    anims.wndLoginFadein = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiFadeIn( 1000 ) ); 
    anims.wndLoginMovein = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiMove( x, y, 750 ) ); 
    anims.wndLoginFadeout = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiFadeOut( 1000 ) ); 
    anims.wndLoginMoveout = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiMove( math.random( -500, 800 ), math.random( -500, 800 ), 750 ) ); 
     
    anims.wndLoginFadein:play( ); 
    anims.wndLoginMovein:play( ); 
    -- 
    guiSetInputEnabled(true) 
    showCursor ( true ) 
end 
  
function onClickBtn ( button, state ) 
    if (source == GUIEditor_Button[1]) then 
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) 
    end 
end 
  
function onClickBtn2 ( button, state ) 
    if (source == GUIEditor_Button[2]) then 
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) 
    end 
end 
  
  
function hideLoginWindow() 
    -- 
    anims.wndLoginFadeout:play( ); 
    anims.wndLoginMoveout:play( ); 
    -- 
    guiSetInputEnabled(false) 
    showCursor ( false ) 
end 
addEvent( "hideLoginWindow", true ) 
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 
  
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) 

server :

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 
  
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  
function onRegister ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    end 
end 
  
addEvent( "onRegister", true ) 
addEventHandler( "onRegister", getRootElement(), onRegister ) 

you have to use arc_'s animation .

client :

--[[ 
 
  Client animation library by arc_
               Version 1.0.0
 
  Licence
  ----------------
 
  You are free to modify this file and redistribute it with your changes.
  However, always mention that you changed it (and eventually what changes
  you made) and keep the original author, version number and licence intact.
 
  Selling this script or a derivative of it is not allowed.
 
 
  Documentation
  ----------------
 
  Terminology
 
    - Animation: a sequence of phases that act on one or more elements
      and follow each other sequentially in time.
     
      Multiple animations can be running at the same time. All defined
      animations run in parallel.
     
      An animation is in fact one phase with several subphases (see below),
      with animation specific functions available.
     
    - Phase: a part of an animation sequence. A phase consists of a
      paramater that linearly goes from a given starting value to a
      given ending value, over the specified amount of time, and is
      applied to one certain element. While a phase is running, its
      callback function will be called onClientRender with the following
      arguments:
     
        phase.fn(element elem, float param, table phase)
     
      Specifying time and callback function is optional. If no time is
      specified but a function is, phase.fn(elem) will be called once.
      If no function is specified but a time is, the phase consists
      of simply waiting during that time, doing nothing.
     
      A phase can be run once, repeated multiple times or loop infinitely.
     
      Phases can also contain phases. In that case the parent phase consists
      of completing all child phases, in order. This allows you to f.e.
      make an element move left and right continuously: define a phase for
      moving it to the left, followed by a phase for moving it back to the
      right, and encapsulate these two phases in a parent phase that loops
      forever.
     
      Phases can be nested to arbitrary depth. The element a subphase works on
      is inherited from its parent phase (or, if the parent phase doesn't
      specify an element, from the grandparent, etc).
 
     
  Definition of a phase
 
    A phase is simply a table containing properties and (optionally) subphases.
    Available phase properties are: (the values for the properties are examples,
    not default values)
   
    phase = {
        from = 0,           -- the starting value of the parameter
        to = 1,             -- the ending value of the parameter
        [time = 1000,]      -- the time (in ms) in which to go from start to end
        [fn = callback,]    -- the function to call on each frame update
        [repeats = 5,]      -- how many times to run this phase before going on to
                            --   the next. defaults to 1
 
        [subphase1,]        -- optional subphases. if one or more of these are included,
        [subphase2,]        --   only the "repeats" property is valid for this parent phase
        ...
    }
 
  Available functions
 
    anim = Animation.create(elem, phase1, phase2, ...)
      Creates and returns a new animation. This means nothing more than
      creating a new phase, putting the specified phases in it as subphases,
      and making the functions of the Animation class available to it.
     
      Once an animation is created, it is not yet running.
     
    anim = Animation.createAndPlay(elem, phase1, phase2, ...)
      Creates a new animation and immediately starts playing it.
   
    anim = Animation.createNamed(name, elem, ...)
      If an animation with the specified name exists, returns that animation.
      Otherwise creates a new named animation. You can look the animation up
      again later with Animation.getNamed(name).
   
    anim = Animation.createNamedAndPlay(name, elem, ...)
      Self explanatory.
     
    anim = Animation.getNamed(name)
      Returns the animation with the specified name if it exists,
      false otherwise.
     
    anim:play()
      Start playing a newly created animation or resume a paused animation.
     
    anim:pause()
      Pauses the animation. Resume it later with anim:play() or delete it
      with anim:remove().
     
    anim:remove()
      Deletes the animation completely. It can not be resumed anymore.
   
    anim:isPlaying()
      Returns true if the animation is currently playing, false if not.
     
    Animation.playingAnimationsExist()
      Returns true if there is any animation that is currently playing.
     
     
    anim:addPhase(phase3), phase2:addPhase(phase3)
      Appends a new subphase to the animation or phase. Can be done while
      the animation is playing. Note that to be able to use phase2:addPhase(),
      phase2 first has to be processed (default values filled in, made part of
      the Phase class) by being passed as an argument to
      Animation.create[AndPlay] or addPhase.
     
     
  Examples
 
    Fade in a picture:
   
      local pict = guiCreateStaticImage(...)
      Animation.createAndPlay(pict, { from = 0, to = 1, time = 2000, fn = guiSetAlpha })
     
    Fade in a picture using a preset (for more presets, see the end of this file):
   
      local pict = guiCreateStaticImage(...)
      Animation.createAndPlay(pict, Animation.presets.guiFadeIn(2000))
     
    Move a label to the right while fading it in:
   
      local label = guiCreateLabel(10, 100, 150, 20, 'Test', false)
      Animation.createAndPlay(label, Animation.presets.guiMove(200, 100, 2000))
      Animation.createAndPlay(label, Animation.presets.guiFadeIn(2000))
     
    Move a label left and right forever, without presets:
   
      function guiSetX(elem, x)
          local curX, curY = guiGetPosition(elem, false)
          guiSetPosition(elem, x, curY, false)
      end
      local label = guiCreateLabel(10, 100, 150, 20, 'Test', false)
      Animation.createAndPlay(
          label,
          {
              repeats = 0,
              { from = 10, to = 200, time = 2000, fn = guiSetX },
              { from = 200, to = 10, time = 2000, fn = guiSetX }
          }
      )
     
                                                 ]]--
 
Phase = {}
Phase.__index = Phase
 
Animation = setmetatable({}, { __index = Phase })
Animation.__index = Animation
 
Animation.collection = {}
 
function Animation.create(elem, ...)
    local anim = setmetatable({ elem = elem, ... }, Animation)
    anim:_setup()
    return anim
end
 
function Animation.createAndPlay(elem, ...)
    local anim = Animation.create(elem, ...)
    anim:play()
    return anim
end
 
function Animation.createNamed(name, elem, ...)
    local anim = Animation.getNamed(name) or Animation.create(elem, ...)
    anim.name = name
    return anim
end
 
function Animation.createNamedAndPlay(name, elem, ...)
    local anim = Animation.createNamed(name, elem, ...)
    anim:play()
    return anim
end
 
function Animation.getNamed(name)
    local i, anim = table.find(Animation.collection, 'name', name)
    return i and anim
end
 
function Animation:isPlaying()
    return self.playing or false
end
 
function Animation.playingAnimationsExist()
    return table.find(Animation.collection, 'playing', true) and true
end
 
function Animation:play()
    if self.playing then
        return
    end
    if not table.find(Animation.collection, self) then
        table.insert(Animation.collection, self)
    end
    if not Animation.playingAnimationsExist() then
        addEventHandler('onClientRender', getRootElement(), updateAnim)
    end
    self.playing = true
end
 
function Animation:pause()
    self.playing = false
    if not Animation.playingAnimationsExist() then
        removeEventHandler('onClientRender', getRootElement(), updateAnim)
    end
end
 
function Animation:remove()
    table.removevalue(Animation.collection, self)
    if not Animation.playingAnimationsExist() then
        removeEventHandler('onClientRender', getRootElement(), updateAnim)
    end
    self.playing = false
end
 
function Phase:_setup(parent)
    self.parent = parent
    if self[1] then
        for i,phase in ipairs(self) do
            if type(phase) == 'function' then
                phase = { fn = phase }
                self[i] = phase
            end
            setmetatable(phase, Phase)
            phase:_setup(self)
        end
        self.curphase = 1
    elseif self.time then
        self.from = self.from or 0
        self.to = self.to or 1
        self.speed = (self.to - self.from) / self.time
    end
    self.repeats = self.repeats
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...