IsResourceArchived: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (return nil if error)
(Fixed build number and added example.)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server function}}
{{New feature/item|3.0155|1.5.5|11533|
{{New feature/item|3.0155|1.5.5|11550|
Checks whether a resource is currently archived (running from within a ZIP file).
Checks whether a resource is currently archived (running from within a ZIP file).
}}
}}
Line 16: Line 16:
==Example==
==Example==


{{Example}}
This example stops the resource from loading if it's archived
<syntaxhighlight lang="lua">
function resourceLoading( res )
    if res.archived then
        cancelEvent()
    end


end
addEventHandler('onResourcePreStart',root,resourceLoading,true,'high+10')
</syntaxhighlight>
==See Also==
==See Also==
{{Resource functions}}
{{Resource functions}}

Revision as of 19:12, 5 July 2017

Checks whether a resource is currently archived (running from within a ZIP file).

Syntax

bool isResourceArchived ( resource resourceElement )

OOP Syntax Help! I don't understand this!

Method: resource:isArchived(...)
Variable: .archived


Required Arguments

  • resource: the resource to check

Returns

Returns true if a resource is archived, false if it is not archived, or nil if there is problem with resource.

Example

This example stops the resource from loading if it's archived

function resourceLoading( res )
    if res.archived then
        cancelEvent()
    end

end
addEventHandler('onResourcePreStart',root,resourceLoading,true,'high+10')

See Also