Turbesz Posted July 6, 2021 Posted July 6, 2021 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? What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
Moderators IIYAMA Posted July 8, 2021 Moderators Posted July 8, 2021 On 06/07/2021 at 12:13, Turbesz said: What wrong? outputChatBox outputs by default to all players. You need to specify the receiver. https://wiki.multitheftauto.com/wiki/OutputChatBox Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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