OnGameModeInit

From SA-MP

Jump to: navigation, search


OnGameModeInit

This callback is called when a gamemode starts.
You can use this callback in filterscripts, this will call it after the OnGameModeInit() of the gamemode.
If you use it in filterscripts, you must use "return true;" at the end, else only the first filterscript loaded will execute it's OnGameModeInit().


This function does not take any parameters.


Here is examples, if you have 2 filterscripts where you want to execute things at OnGameModeInit(). In each example, notice the returned values and the results

//Example 1: What you WILL NOT do:
 
//In FS1
public OnGameModeInit()
{
    print("OnGameModeInit from FS1");
    return false;
}
 
//In FS2
public OnGameModeInit()
{
    print("OnGameModeInit from FS2");
    return false;
}
 
//Results:
OnGameModeInit from FS1
//Example 2: What you WILL do:
 
//In FS1
public OnGameModeInit()
{
    print("OnGameModeInit from FS1");
    return true;
}
 
//In FS2
public OnGameModeInit()
{
    print("OnGameModeInit from FS2");
    return true;
}
 
//Results:
OnGameModeInit from FS1
OnGameModeInit from FS2
Personal tools