DeleteResource: Difference between revisions
Jump to navigation
Jump to search
-ffs-Sniper (talk | contribs) No edit summary |
-ffs-Sniper (talk | contribs) m (Wrong revision number, updated) |
||
Line 4: | Line 4: | ||
This function deletes a resource from the MTA memory and moves it to the "/resources-cache/trash/" directory. | This function deletes a resource from the MTA memory and moves it to the "/resources-cache/trash/" directory. | ||
'''Note:''' This function only works properly from 1.3.0- | '''Note:''' This function only works properly from 1.3.0-3912 (r3912). In case you are below r3912 you need to create a directory called "trash" inside of the "resources-cache" folder. | ||
==Syntax== | ==Syntax== |
Revision as of 21:59, 15 March 2012
This function deletes a resource from the MTA memory and moves it to the "/resources-cache/trash/" directory.
Note: This function only works properly from 1.3.0-3912 (r3912). In case you are below r3912 you need to create a directory called "trash" inside of the "resources-cache" folder.
Syntax
bool deleteResource ( string resourceName )
Required Arguments
- resourceName: The name of resource to delete.
Returns
Returns true if the resource has been deleted successfully, false otherwise.
Example
This example checks to see if there's 2 resources.
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() resources = getResources() --Get all resources if (getResourceState(resources) == "loaded" and "running" or "loaded" and "starting") then --Checks to see if there's to resources that's loaded and running or loaded and starting up stopResource(resources) deleteResource(resources) end end)
Requirements
This template will be deleted.
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo