M MY Multiplayer: Wiki
Side
Kind

onResourcePreStart

ServerEventCancellable

Fired when a resource is starting, before its scripts run. Cancelling the event keeps the resource from starting.

addEventHandler("onResourcePreStart", root, function(resource resource) … end)

Handler parameters

NameTypeDescription
resourceresourceThe resource that is starting.

Source

The element of the resource that is starting.

The resource's own scripts have not run yet, so only other resources get this event, with a handler on root.

Example

addEventHandler("onResourcePreStart", root, function(resource)
    if getResourceName(resource) == "freeroam" and getResourceFromName("race") then
        cancelEvent()
    end
end)

See also