Ulysses

General => Developers Corner => Topic started by: that1nub on November 24, 2017, 01:13:09 AM

Title: Help with UTime
Post by: that1nub on November 24, 2017, 01:13:09 AM
So I am fairly new to lua, and I tried to create a custom command for setting UTime, and it seemed to break my whole server. Here is my code:
Code: [Select]
function ulx.settime( calling_ply, target_ply, ammount )
target_ply:SetUTimeStart( ammount )
target_ply:SetUTime( ammount )
end
local settime = ulx.command( CATEGORY_NAME, "ulx settime", ulx.settime, "!settime" )
settime:addParam{ type=ULib.cmds.PlayerArg }
settime:AddParam{ type=ULib.cmds.NumArg min=0 max=2.628e+6 default=0, hint="Set the UTime of a player" }
What have I done that will break the server? The server is DarkRP, and this is what broke:
AtlasChat (displayed default chatbox instead)
Custom scoreboard and F4 menu didn't load
Removing this code seemed to fix it when I restarted the server.
Title: Re: Help with UTime
Post by: JamminR on November 24, 2017, 08:13:01 AM
If it's breaking something, you're likely getting lua errors in server or game console.
We'd need to know what those are.

Random guess - "max=2.628e+6"
Did you actually set that? It might be confusing gmod lua, or even ULib numarg.

Also, check the Releases section of the forum - there are a few different releases that adjust UTime.
Even if they don't work anymore (I don't know if they do or don't), the commands in them will likely help you learn.