getRemoteRequests | Multi Theft Auto: Wiki Skip to content

getRemoteRequests

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


Gets all fetchRemote and callRemote requests currently running.

Syntax

table getRemoteRequests ( [ resource theResource = nil ] )
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • theResource (default: nil): the resource to get all requests from

Returns

  • table: value

Returns a table with all requests, false if an invalid resource was provided

Code Examples

shared

This example prints how many request are currently pending.

function CMD_requestInfo(player, _, resourceName)
local res = resourceName and getResourceFromName(resourceName) or not resourceName and nil
if(res == false) then
outputChatBox("There is no resource named '" .. resourceName .. "'", player)
return
elseif(res and getResourceState(res) ~= "running") then
outputChatBox("The provided resource '" .. resourceName .. "' is not running", player)
return
end
local requests = getRemoteRequests(res)
outputChatBox(("There are %d request%s running"):format(#requests, #requests == 1 and '' or 's'), player)
end
addCommandHandler("requestinfo", CMD_requestInfo)