- Documentation
- Server functions
- startResource
Function
startResource
Starts a stopped resource. It loads its scripts, maps and files, and players download it.
Syntax
bool startResource(resource theResource)Arguments
theResourceresource- The resource (a handle or a name).
Differences from MTA:SA
- These MTA:SA arguments are not here:
bool persistent = false,bool startIncludedResources = true,bool loadServerConfigs = true,bool loadMaps = true,bool loadServerScripts = true,bool loadHTML = true,bool loadClientConfigs = true,bool loadClientScripts = true,bool loadFiles = true
In MTA:SA
startResource(resource resourceToStart, bool persistent = false, bool startIncludedResources = true, bool loadServerConfigs = true, bool loadMaps = true, bool loadServerScripts = true, bool loadHTML = true, bool loadClientConfigs = true, bool loadClientScripts = true, bool loadFiles = true)Returns
true if the resource started.
Example
addCommandHandler("start", function(player, _, name)
if hasObjectPermissionTo(player, "command.start") then
startResource(getResourceFromName(name or ""))
end
end)
See also
stopResourceStops a running resource. Its elements, timers, commands and key binds go away.restartResourceStops and immediately starts a resource, e.g. after its files changed.getResourceStateReturns the resource state:"running"when it runs or"loaded"when it is on disk but stopped. It also works on the client: there it only knows the resources running for the player, so it returns"running"orfalse.