GetResourceState
Jump to navigation
Jump to search
This function returns the state of a given reesource
Syntax
string getResourceState ( resource res )
Required Arguments
- res: The resource you wish to get the name of.
Returns
Returns a string with the resource state in it.
- false on fail
Example
Click to collapse [-]
ServerThis example returns the state of a given resource. Syntax: /state <Resource Name>
function getState( player, command, sz ) if sz then local bFound = false local resourceTable = getResources() -- get a table of resources for resourceKey, resourceValue in ipairs( resourceTable ) do -- iterate through the table and output each resource's name local name = getResourceName( resourceValue ) if string.lower( name ) == string.lower( sz ) then outputChatBox( "Resource State: " .. name .. " is currently " .. getResourceState( resourceValue ), player, 0, 0, 255 ) bFound = true break end end if bFound ~= true then outputChatBox( "Error: No resource found named: " .. sz, player, 255, 0, 0 ) end else outputChatBox( "Error: You did not specify a resource to check", player, 255, 0, 0 ) end end addCommandHandler( "state", getState )
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo
--