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

Function

getResourceFromName

ServerResourcesIdentical to MTA:SA

Returns the handle of the resource with the given name (the folder name in resources/), also when the resource is not running. Pass the handle to startResource, getResourceState, call and other resource functions.

Syntax

resource getResourceFromName(string resourceName)

Arguments

resourceNamestring
Resource name.

Returns

The resource handle or false if there is none.

Example

local race = getResourceFromName("race")
if race and getResourceState(race) ~= "running" then
    startResource(race)
end

See also