RefreshResources: Difference between revisions
Jump to navigation
Jump to search
m (typo) |
(Note) |
||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
This function finds new resources and checks for changes to the current ones. | This function finds new resources and checks for changes to the current ones. | ||
{{Note|The resource using this function needs access to ''function.refreshResources'' in order to this function work. You can allow it by using aclrequest on the [[meta.xml]] or by setting the resource on the admin ACL group.}} | |||
==Syntax== | ==Syntax== |
Revision as of 13:48, 17 May 2021
This function finds new resources and checks for changes to the current ones.
Syntax
bool refreshResources ( [ bool refreshAll = false, resource targetResource = nil ] )
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- refreshAll: If true MTA will check for changes in all resources. If false, MTA will only check for new resources and try to reload resources with errors
Note: Checking for changes in all resources can result in lag for a short period of time. It should generally be avoided to set refreshAll to true.
Returns
Returns true if refresh was successful, false otherwise.
Example
Click to collapse [-]
ServerThis example will refresh resources when a player uses the /refreshresources command just like the hardcoded /refreshall.
function commandRefreshResources(player) refreshResources(true) outputChatBox("Resources refreshed", player, 255, 255, 0) end addCommandHandler("refreshresources", commandRefreshResources)
This example will refresh only the named resource:
refreshResources(true, getResourceFromName("admin"))
Changelog
Version | Description |
---|
1.5.5-9.11718 | Added targetResource argument |
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo