SetResourceDefaultSetting: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Zangomangu (talk | contribs) (Remove issue from disabled function) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
{{Disabled|This function doesn't work actually. See [[#Issues|issues]] for more information.}} | |||
This function is used to set a default setting for a specified [[resource]]. | This function is used to set a default setting for a specified [[resource]]. | ||
<!-- What are default settings? --> | <!-- What are default settings? --> | ||
==Syntax== | ==Syntax== | ||
Line 21: | Line 19: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | This example checks to see if the server has the freeroam server then sets "spawnmaponstart" to "false". | ||
<syntaxhighlight lang="lua">addEventHandler("onResourceStart",resourceRoot,function() | |||
local freeroamRes = getResourceFromName("Freeroam") | |||
if(freeroamRes)then | |||
setResourceDefaultSetting(freeroamRes,"spawnmaponstart","false") | |||
end | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Resource_functions}} | {{Resource_functions}} |
Latest revision as of 19:01, 30 January 2022
Function has been disabled. | |
Reason/Note: This function doesn't work actually. See issues for more information. |
This function is used to set a default setting for a specified resource.
Syntax
bool setResourceDefaultSetting ( resource theResource, string settingName, string/int/float settingValue )
Required Arguments
- theResource: the resource where the setting is located
- settingName: the name of the default setting
- settingValue: the new value of the setting
Returns
Returns true if the default setting was successfully set, false otherwise.
Example
This example checks to see if the server has the freeroam server then sets "spawnmaponstart" to "false".
addEventHandler("onResourceStart",resourceRoot,function() local freeroamRes = getResourceFromName("Freeroam") if(freeroamRes)then setResourceDefaultSetting(freeroamRes,"spawnmaponstart","false") end end)
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo