ULX

Author Topic: help script  (Read 262 times)

0 Members and 1 Guest are viewing this topic.

Offline $VDFOREVER

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
help script
« on: June 11, 2020, 02:52:12 PM »
Hello, I have a script for showing time in jail, but I have a mistake. Help fix it.

Code: Lua
  1. hook.Add("HUDPaint", "JailTime", function()
  2.         if LocalPlayer():isArrested() then
  3.                 draw.RoundedBox(8, 8, 10, 570, 35, Color(30, 30, 30))
  4.                 draw.SimpleText("Before leaving prison "..math.floor(LocalPlayer():GetArrestInfo().Release - CurTime()).." seconds.","HudFontBold", 10, 10, Color(80, 80, 80))
  5.         end
  6. end)
  7.  

[ERROR] lua/autorun/client/cl_jail.lua:5: attempt to call method 'GetArrestInfo' (a nil value)
  1. fn - lua/autorun/client/cl_jail.lua:5
   2. unknown - addons/ulx_ulib/lua/ulib/shared/hook.lua:109

« Last Edit: June 11, 2020, 03:14:05 PM by $VDFOREVER »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8082
  • Karma: 389
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: help script
« Reply #1 on: June 11, 2020, 06:16:55 PM »
method 'GetArrestInfo' (a nil value)

Method is nil. Empty.
Hud is client side.
Is that funtion server side?

Also, moving to developer corner, you posted in section for team Ulysses project support.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 796
  • Karma: 57
Re: help script
« Reply #2 on: June 12, 2020, 01:38:26 PM »
Looking at the DarkRP wiki (which I assume this is for), that function doesn't exist anywhere. You could define the function, and use other functions to populate the data it would return, for example, use the SERVERSIDE playerArrested hook to populate a shared table on the player object containing said information.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube