Sign in to follow this  
SkatCh

About setTimer

Recommended Posts

guys please i need some help i create a vip system and i want to keep the time working even if the player logout is that possible .

just a part from my script:

local timers = { }

function startTime ( thePlayer ) 
    if not ( timers [ thePlayer ] ) then 
        timers [ thePlayer ] = setTimer ( function () 
                if ( isElement ( thePlayer ) ) then 
                    local timeLeft = getElementData ( thePlayer, "time" ); 
                    if ( timeLeft ) then 
                        if ( timeLeft > 0 ) then 
                            if ( ( timeLeft - 1 ) > 0 ) then 
                                setElementData ( thePlayer, "time", timeLeft - 1 ); 
                            else 
                                remove ( thePlayer ); 
                            end 
                        else 
                            remove ( thePlayer ); 
                        end 
                    end 
                else 
                    return; 
                end 
            end, 1000, -1 
        );       
    end 
end 

Edited by Guest

Share this post


Link to post

Well, of course not, because 'thePlayer' will be destroyed once the player leaves the server, so setElementData will stop working.

Share this post


Link to post

i already make it with setAccountData/getAccountData . so what can i do to keep timer decreasing.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.