ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getResourceRootElement

Function

getResourceRootElement

ServerResourcesIdentical to MTA:SA

Returns the resource's root element. Everything the resource creates is its child, and events attached to this root only concern this resource. Without an argument it returns the current resource's root (the same as resourceRoot).

Syntax

element getResourceRootElement([resource theResource])

Arguments

theResourceresource, optional
The resource.

Returns

The resource root or false.

Example

local race = getResourceFromName("race")
for _, veh in ipairs(getElementsByType("vehicle", getResourceRootElement(race))) do
    setVehicleColor(veh, 255, 122, 34)
end

See also