(adsbygoogle = window.adsbygoogle || []).push({});
Callbacks seem to be a new addition to GSC with these mod tools and they can be really useful. If you're not familiar with what a callback is; a callback is something that fires when an action/event happens. You can use these to invoke functions when a specific event happens in game.
To use these, you need to include the callbacks script to your script (this is already added when you create a new mp/zm map):
#using scripts\shared\callbacks_shared;
Once you add it, you can reference it's functions by using the namespace
callback. Now we can add a callback to our script for a function to execute whenever a player spawns in:
function main(){
.... other code ....
callback:n_spawned(&on_player_spawned);
}
function on_player_spawned()
{
wait(5);
IPrintLnBold("WELCOME");
}
All the callback functions require the function names to be passed as a pointer, so just include & before the function name.
You can find all the callbacks that Treyarch provided by opening
share\raw\scripts\shared\callbacks_shared.gsc and jump down to line 113. They include comments on what each one does and how to use it.