call | Multi Theft Auto: Wiki Skip to content

call

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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


This function is used to call a function from another resource (which must be running).

Important

Calls (exports) may incur a performance overhead - they are not equivalent in performance to calling functions in the same resource. Do not use exports in render events (like onClientRender ), or in fast processing logic, unless you want to kill performance. The sourceResource and sourceResourceRoot "hidden" variables are available even if you use exports.: Using this function straight away on resource start might cause elements to not be passed properly, use setTimer in order to delay function execution and to avoid this issue.

Syntax

call ( )

Code Examples

server

This extract shows adding of a "kills" column to the scoreboard resource. This then sets thegameShowKillsvariable to true(or false), telling the rest of the script to start outputting kills.

function showKills ( option )
if not option then
-- Remove the "kills" column
exports.scoreboard:removeScoreboardColumn("kills")
else
-- Add the "kills" column
exports["scoreboard"]:addScoreboardColumn("kills")
outputDebugString ( "Showing kills now..." )
end
gameShowKills = option
end