RemoveResourceFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 17: Line 17:


==Example==
==Example==
<section name="Server" class="server" show="true">
This example removes a .txt file from the resource sx_remanager(in-game script editor) when started.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">addEventHandler("onResourceStart",resourceRoot,function()
-- Add example
resource = getResourceFromName("sx_resmanager")
removeResourceFile(resource,"description.txt")
end)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Resource_functions}}
{{Resource_functions}}
[[Category:Needs Example]]
[[Category:Needs Example]]

Revision as of 22:01, 27 April 2012

This function removes a file from the resource.

Syntax

bool removeResourceFile ( resource theResource, string fileName )

Required Arguments

  • theResource: The resource element.
  • fileName: The filename what you wan't to delete.

Returns

Returns true if file was deleted, otherwise false if the resource is in use or the file doesn't exist.

Example

This example removes a .txt file from the resource sx_remanager(in-game script editor) when started.

addEventHandler("onResourceStart",resourceRoot,function()
	resource = getResourceFromName("sx_resmanager")
	removeResourceFile(resource,"description.txt")
end)

See Also