StopResource

From Multi Theft Auto: Wiki
Revision as of 11:41, 22 April 2007 by Jbeta (talk | contribs)
Jump to navigation Jump to search

This function stops a running resource.

Syntax

bool stopResource ( resource theResource )

Required Arguments

  • theResource: the resource we want to stop.

Returns

Returns true if the resource was stopped, false if the stopping failed, or an invalid resource was passed.

Example

This function stops all running resources.

function stopAllResources()
	--we store a table of resources
	local allResources = getResources()
	--for each one of them,
	for index, resource in allResources do
		--if it's running,
		if getResourceState(resource) == "running" then
			--then stop it
			stopResource(resource)
		end
	end
end

See Also