getResourceRootElement
Shared
Returns a resource's root element, the same as that resource's resourceRoot global.
element|false getResourceRootElement([resource|string resource = getThisResource()])
Parameters
| Name | Type | Description |
|---|---|---|
| resource | resource|string | The resource, or its name. Without it, the calling resource.default getThisResource() |
Returns
The element, or false if the resource is not running.
Example
local mapRoot = getResourceRootElement("race-map")
if mapRoot then
addEventHandler("onResourceStop", mapRoot, function()
outputServerLog("the map stopped")
end)
endComing from MTAThe root element is the resource's own element: it is the same one
getThisResource returns.