General > Developers Corner

How to access UTime hours.

(1/4) > >>

Aharon Tager:
Hey, I'm trying to make a command to view a players hours on a server with ulx and utime installed. I don't have access to a test server, so I was wondering if anyone could look this over and see if it'll work.

--- Code: ---local CATEGORY_NAME = UTime

function ulx.viewHours (calling_ply, target_ply)
local hours = target_ply:GetUTimeTotalTime() / 3600
ULib.tsay(calling_ply, "#A's hours: " ..hours.., target_ply)
end

local seehours = ulx.command(CATEGORY_NAME, "ulx viewhours", ulx.viewHours, "!viewhours")
seehours:addParam:(type=ULib.cmds.PlayerArg)
seehours:defaultAccess( ULib.ACCESS_ADMIN )
seehours:help("View a player's hours on the server.")
--- End code ---

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version