This site has been archived and made available for preservation purposes. No edits can be made.

OnPlayerRequestGame

(Difference between revisions)
Return to current revision
  1. -
    Gets called when a [wiki]Player[/wiki] requests to play on this server (before [wiki]OnSpawn[/wiki] and after [wiki]OnClientAuthenticate[/wiki]). It is recommended to make sure that every [wiki]Player[/wiki] gets a unique [wiki="Base"]vaultmp::Base[/wiki].
  2. +
    Gets called when a [wiki]Player[/wiki] requests to play on this server (before [wiki]OnSpawn[/wiki] and after [wiki]OnClientAuthenticate[/wiki]). It is recommended to make sure that every [wiki]Player[/wiki] gets a unique [wiki="Base"]Base[/wiki].
  3.  
    [h="2"] Declaration [/h]
  4. -
    <code cpp>
    VAULTSCRIPT vaultmp::Base OnPlayerRequestGame(vaultmp::ID);
  5. +
    [highlight=cpp]
    VAULTSCRIPT VAULTSPACE Base OnPlayerRequestGame(VAULTSPACE ID) _CPP(noexcept);
    [/highlight]
    [highlight=c]
  6.  
    forward OnPlayerRequestGame(ID);
  7. -
    </code>
  8. +
    [/highlight]
  9.  
    [h="2"] Parameters [/h]
  10. -
    [b][wiki="ID"]vaultmp::ID[/wiki][/b] - the ID of the [wiki]Player[/wiki]
  11. +
    [b][wiki="ID"]ID[/wiki][/b] - the ID of the [wiki]Player[/wiki]
  12.  
    [h="2"] Return value [/h]
  13. -
    You have to return a [wiki="Base"]vaultmp::Base[/wiki]. This is the model which will represent the [wiki]Player[/wiki] in-game.
  14. +
    You have to return a [wiki="Base"]Base[/wiki]. This is the model which will represent the [wiki]Player[/wiki] in-game.
  15.  
    [h="2"] Usage example (C++) [/h]
  16. -
    <code cpp>
    vaultmp::Base VAULTSCRIPT OnPlayerRequestGame(vaultmp::ID player)
  17. +
    [highlight=cpp]
    Base VAULTSCRIPT OnPlayerRequestGame(ID player)
  18.  
    {
  19. -
    vaultmp::Base base = 0x00000000;
    base = 0x00030D82; // Carter from Fallout 3
  20. +
    Base base = static_cast<Base>(0x00030D82); // Carter from Fallout 3
  21.  
    return base;
    }
  22. -
    </code>
  23. +
    [/highlight]
  24.  
    [category]VaultMP interface[/category]
    [category]Scripting callbacks[/category]