AbortRemoteRequest: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Actually make the example work.. abortRemoteRequest didnt have arguments passed to it lol...)
(Fix the example - make the description match what the code actually does..)
Line 19: Line 19:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function CMD_abortRequests()
function CMD_abortRequests()
     local requests = getRemoteRequests()
     local requests = getRemoteRequests(getThisResource())
     for _, request in ipairs(requests) do
     for _, request in ipairs(requests) do

Revision as of 21:23, 16 October 2020

Aborts a fetchRemote or callRemote request.

Syntax

bool abortRemoteRequest( request theRequest )

Required Arguments

Returns

Returns true on success, false when invalid request was provided

Example

this example aborts all pending requests of currently running resource.

function CMD_abortRequests()
    local requests = getRemoteRequests(getThisResource())
	
    for _, request in ipairs(requests) do
        abortRemoteRequest(request)
    end
end

addCommandHandler("abortrequests", CMD_abortRequests)


This template will be deleted.

See Also