How would I fetch a player's time left until they're unarrested?
[url]https://github.com/FPtje/DarkRP[/url]
Look in there.
[QUOTE=Nookyava;44495016][url]https://github.com/FPtje/DarkRP[/url]
Look in there.[/QUOTE]
I tried... I found something that used GetConVarNumber("jailtimer") or something, but it didn't work. It just said 0 for the time left.
Serverside
[url]https://github.com/FPtje/DarkRP/blob/0193c46f2e8e4b4b5efa8300a618ac54093e7d3a/gamemode/modules/police/sv_init.lua#L293[/url]
So in a Lua file (separate from the gamemode)
[url]https://github.com/FPtje/DarkRP/blob/e56639aada64c93064e7e3a0d1c013c5ef59ea50/gamemode/modules/police/sv_interface.lua#L185[/url]
Use that hook. It returns the time.
Ok so I tried to figure this out and I still can't..
Can you please write out the code I'd use to define the time left?
I need to fetch the time left until the player is unarrested for the following:
[lua]ArrestFee = *NEED TIME HERE* * CONFIG.DollarsPerSecond[/lua]
and
[lua]draw.SimpleText( "Time Remaining: "..*NEED TIME HERE*.." seconds", "BailJobFont", w - 140, 14, Color( 0, 0, 0, 255 ), TEXT_ALIGN_RIGHT )[/lua]
Look into hud/cl_hud.lua on line 183 if you are using the default hud - it is sent to the player via usermessage. You could simply set a variable of your choice in the same function and reference that.
[QUOTE=Kogitsune;44503518]Look into hud/cl_hud.lua on line 183 if you are using the default hud - it is sent to the player via usermessage. You could simply set a variable of your choice in the same function and reference that.[/QUOTE]
I saw that, and tried using it as well, to no avail. :L
It isn't too complicated.
[code]
local StartArrested = CurTime()
local ArrestedUntil = msg:ReadFloat()
MyStartArrest = StartArrested
MyEndArrest = ArrestedUntil
[/code]
And then to display it nicely:
[code]
local s = string.ToMinutesSeconds( math.Round( ( MyEndArrest or 0 ) - ( CurTime( ) - ( MyStartArrest or 0 ) ) ) )
draw.DrawSimpleText( "Time remaining: " .. s, other, stuff, here )
[/code]
Which would give you text like:
Time remaining: 0:43
Time remaining: 15:33
And so on
Sorry, you need to Log In to post a reply to this thread.