Difference between revisions of "AbortRemoteRequest"

From Multi Theft Auto: Wiki
(Fix syntax)
(Example)
Line 27: Line 27:
 
addCommandHandler("abortrequests", CMD_abortRequests)
 
addCommandHandler("abortrequests", CMD_abortRequests)
 
</syntaxhighlight>
 
</syntaxhighlight>
</section>
 
  
 
{{Requirements|1.5.7-9.20307|1.5.7-9.20307}}
 
{{Requirements|1.5.7-9.20307|1.5.7-9.20307}}

Revision as of 20:56, 8 October 2019

Aborts a fetchRemote or callRemote request.

Syntax

table 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()
	
    for _, request in ipairs(requests) do
        abortRemoteRequest()
    end
end

addCommandHandler("abortrequests", CMD_abortRequests)
Minimum supported server 1.5.7-9.20307
Minimum supported client 1.5.7-9.20307

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.7-9.20307" client="1.5.7-9.20307" />

See Also