Skip to content

Extend functionality

Michel Fedde edited this page May 1, 2025 · 4 revisions

Adding a Random Method

The random method defines, how a map is chosen. So this offers you to change the result dramatically.

For this, you simply need to create a lua-file under garrysmod/lua/server/srms/random_methods/<YOUR_METHOD_NAME>.lua or in your add-on under lua/server/srms/random_methods/<YOUR_METHOD_NAME>.lua. The file needs to have a global object called SRMS_RandomMethod with the function SRMS_RandomMethod.getRandomMap().

To get started, you can copy the following file:

SRMS_RandomMethod = {}

function SRMS_RandomMethod.getRandomMap()
	print("Example function. Returning gm_construct")

        return "gm_construct"
end

After you have created your function, you can just add your method name to your server configuration or gamemode configuration.

See the API Reference for more information.

Clone this wiki locally