Jump to content

[Help] How to fix this getTimerDetails bug?


Turbesz

Recommended Posts

I created a jail system. And i added a command which prints out how much time is left out of jail. If I'll put myself in jail the command prints good value, but if i'll put another player in jail, the command prints the other player's time to me as well... 

My code parts:

-- This is the jail part with the setTimer:

local bortonzottek = { } 

local timer = {}

timer[getPlayerSerial ( target )] = setTimer ( unJailoz, milliseconds, 1, target ) 
bortonzottek [ getPlayerSerial ( target ) ] = { milliseconds, timer[getPlayerSerial(target)] } 

--And this is the command:

function teszt(thePlayer)
local serial = getPlayerSerial ( thePlayer ) 
local jailed = bortonzottek [ serial ] 

local hatra = getTimerDetails(jailed [ 2 ]) or 0
local string = string.format("%02d ", hatra/60) 

outputChatBox((math.floor ( hatra/60000 ) + 1))

end

addCommandHandler("bido",teszt)

The timer works fine, so let me out from the jail when my time is up and the other player when her timer expires, but the getTimerDetails does not work well...

What wrong? How to fix this?

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