RestartResource
From Multi Theft Auto: Wiki
This function restarts a running resource. Restarting will destroy all the elements that the resource has created (as stopping the resource does).
Note:
|
Syntax
bool restartResource ( resource theResource [, bool persistent = false, bool configs = true, bool maps = true, bool scripts = true, bool html = true, bool clientConfigs = true, bool clientScripts = true, bool clientFiles = true ] )
OOP Syntax Help! I don't understand this!
- Method: resource:restart(...)
Required Arguments
- theResource: the resource you want to restart.
Optional Arguments
- persistent: Unused
- configs: Reload configs?
- maps: Reload maps?
- scripts: Reload (server) scripts?
- html: Reload html files (for resource web access)?
- clientConfigs: Reload client configs?
- clientScripts: Reload client scripts?
- clientFiles: Reload files?
Returns
Returns true if the resource was restarted, false if the resource wasn't running, or an invalid resource was passed.
Example
Example 1: This function restarts all running resources.
function restartAllResources() -- we store a table of resources local allResources = getResources() -- for each one of them, for index, res in ipairs(allResources) do -- if it's running, if getResourceState(res) == "running" then -- then restart it restartResource(res) end end end
Example 2: This example will restart the specify resource every 3600000 milliseconds (hour).
setTimer( function() --restarting this resource every hour restartResource(getThisResource()) end, 3600000, 0)
See Also
- addResourceConfig
- addResourceMap
- call
- callRemote
- copyResource
- createResource
- deleteResource
- fetchRemote
- getResourceACLRequests
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceInfo
- getResourceLastStartTime
- getResourceLoadFailureReason
- getResourceLoadTime
- getResourceMapRootElement
- getResourceName
- getResourceOrganizationalPath
- getResourceRootElement
- getResourceState
- getResources
- getThisResource
- isResourceArchived
- refreshResources
- removeResourceFile
- renameResource
- restartResource
- setResourceInfo
- startResource
- stopResource
- updateResourceACLRequest
- getRemoteRequests
- getRemoteRequestInfo
- abortRemoteRequest