Garry's Mod

Garry's Mod

Not enough ratings
ULX Module for Randomat 2.0
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Server content
File Size
Posted
Updated
28.882 KB
14 May, 2020 @ 6:54pm
26 May @ 7:59pm
50 Change Notes ( view )

Subscribe to download
ULX Module for Randomat 2.0

Description
Thanks to Dem for the 'Randomat 2.0 ULX Menu' mod which this is an update to.

Edits (and replaces) the original version to support custom added events with little-to-no developer interaction

Chat Commands
!rdmt EventId - Starts an event with the given "EventId".
!srdmt EventId - Safely starts an event with the given "EventId". Will cause a server-side error if the event's conditions are not met.
!clearevent EventId/!stopevent EventId - Stops an event with the given "EventId". Will cause a server-side error if no event with that ID is running.
!clearevents/!stopevents - Stops all active events.
!rdmtnr EventId - Starts an event with the given "EventId" next round.
!srdmtnr EventId - Starts an event with the given "EventId" next round. Will cause a server-side error if the event's conditions are not met.
!clearnr - Clears the event scheduled for the next round, if there is one.

For Developers
This version of the ULX menu takes advantage of the fact that the list of Randomat events is globally available and uses that to add all custom events to the menu. Unfortunately the list of Randomat events does not contain their ConVars so I had to modify the Randomat event meta API slightly to support that.

Custom Event Compatibility
All custom events that work with the Randomat 2.0 will show in the Randomat ULX menu. However, without any code changes the only things available for these custom events will be the Enabled checkbox and the Trigger Event button.

Adding ConVar Support
To add ConVar support to a custom event, the GetConVars meta method must be implemented.
The GetConVars method returns three lists of ConVar information:
1. The list of ConVars which should be configured by a slider control (e.g. number ranges)
2. The list of ConVars which should be configured by a checkbox control (e.g. booleans)
3. The list of ConVars which should be configured by a textbox control

See the README file in the code repository[github.com] for an example of the GetConVars implementation

Special Thanks

Source Code
https://github.com/Malivil/TTT-Randomat-20-ULX
12 Comments
Malivil  [author] 21 Aug, 2021 @ 6:25pm 
Yea, it would use whatever you have "ttt_randomat_event_weight" set to
EnderSlayer366 21 Aug, 2021 @ 6:09pm 
ok so -1 makes it use the default weight, if you have the default set to something other than 1, like 6 or something, would it do that instead
Malivil  [author] 21 Aug, 2021 @ 5:46pm 
A weight of -1 on an event makes it use the default weight of 1
EnderSlayer366 21 Aug, 2021 @ 4:25pm 
What exactly does a weight of -1 do for the events? Does it just make it less likely or does it never happen? Does it do some other thing?
Malivil  [author] 17 Mar, 2021 @ 4:39am 
I don't want to do that because some people (myself included) get the latest ULX and install it as a filesystem addon rather than through the workshop.
The Stig 16 Mar, 2021 @ 11:01pm 
Hey it's been a while, just a small thing this time: Could ULX be added as a required mod? It would make things a little easier when getting others to install this.
Malivil  [author] 26 Jan, 2021 @ 10:42am 
The first error is not related to this.

The second error means you don't have a Randomat 2.0 addon installed, or at least not a compatible one.
[KaP] Portres 26 Jan, 2021 @ 10:28am 
Yea its really strange but deleting this worked:
[ULib] HTTP failed - ISteamHTTP isn't available!

1. Fetch - lua/includes/modules/http.lua:42
2. fn - lua/ulib/shared/plugin.lua:186
3. unknown - lua/ulib/shared/hook.lua:109


[ULX Module for Randomat 2.0] lua/ulx/xgui/server/sv_randomat.lua:24: attempt to index global 'Randomat' (a nil value)
1. fn - lua/ulx/xgui/server/sv_randomat.lua:24
2. unknown - lua/ulib/shared/hook.lua:109
Malivil  [author] 26 Jan, 2021 @ 10:21am 
What error messages?

This is a ULX plugin so it shouldn't affect the gamemode at all.
[KaP] Portres 26 Jan, 2021 @ 9:51am 
Broken with TTT2 getting Error messages and gamemode not starting