IsResourceRunning
Jump to navigation
Jump to search
Syntax
- isResourceRunning' You can insert this code example in your resources.
Required Arguments
- isResourceRunning: The value to check resources
You can insert this code example in your resources.
function isResourceRunning(resName)
local res = getResourceFromName(resName)
return (res) and (getResourceState(res) == "running")
end
-- Example of inserting into system code:
--[[
if isResourceRunning("admin") then
--code
else
--alert
end
]]
addCommandHandler('pos', function (commandName)
if isResourceRunning("admin") then
local x,y,z = getElementPosition(localPlayer)
outputChatBox( x ..', '.. y ..', '.. z, 255, 255, 255 )
else
outputChatBox("The resource is not running 'admin'.", 255, 0, 0)
end
end )