Jump to content

Vip system


Estevam2d

Recommended Posts

It could work

  
VIPs = {} 
  
setTimer( 
    function () 
        for account, data in pairs (VIPs) do 
            time = data.time 
            if ( time-10000 > 0 ) then 
                VIPs[account].data = time-10000 
            else 
                VIPs[account] = nil 
            end 
        end 
    end, 15000, 0) 
  
  
addCommandHandler("getremainingviptime",  
    function (player) 
        local accName = getAccountName ( getPlayerAccount(player) ) 
        outputChatBox( VIPs[accName] and ( VIPs[accName].data.time/1000.. " seconds") or "You aren't VIP", player) 
    end 
) 
  
addCommandHandler("givevipto", 
    function (player, cmd, accName, secs) 
        if ( getAccount(accName) ) then 
            if ( VIPs[accName] ) then 
                VIPs[accName].data.time = VIPs[accName].data.time + secs*1000 
            else 
                VIPs[accName] = {} 
                VIPs[accName].data = {} 
                VIPs[accName].data.time = {} 
                VIPs[accName].data.time = secs*1000 
            end 
        end 
    end 
) 
  
  

Link to comment

Everything is working, but time does not count

My vip does not end

VIPs = {} 
  
setTimer( 
    function () 
        for account, data in pairs (VIPs) do 
            time = data.time 
            if ( time-10000 > 0 ) then 
                VIPs[account].data = time-10000 
            else 
                VIPs[account] = nil 
            end 
        end 
    end,15000,0) 

Link to comment

have some way the save time ?

i don't know use mysql and i need very save time.

i managed this script and now it is working :D

setTimer( 
    function () 
        for account, data in pairs (VIPs) do 
         if ( VIPs[account].data.time-10000 > 0 ) then 
         VIPs[account].data.time = VIPs[account].data.time-1000 
          else 
                VIPs[account] = nil 
        end 
    end 
end,1000,0) 
     
     
  
  
addCommandHandler("tv", 
    function (player) 
        local accName = getAccountName ( getPlayerAccount(player) ) 
        outputChatBox( VIPs[accName] and ( VIPs[accName].data.time/1000 .. " Segundos") or "Voce não é vip", player) 
    end 
) 
  
addCommandHandler("addvip", 
    function (player, cmd, accName, secs) 
        if ( getAccount(accName) ) then 
            if ( VIPs[accName] ) then 
                VIPs[accName].data.time = VIPs[accName].data.time + secs*1000 
            else 
                VIPs[accName] = {} 
                VIPs[accName].data = {} 
                VIPs[accName].data.time = {} 
                VIPs[accName].data.time = secs*1000 
                outputChatBox( "Voce add "..secs.. " Segundos", player) 
            end 
        end 
    end 
) 
  

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