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

GetName

(Difference between revisions)
Return to current revision
  1.  
    Retrieves the name of an [wiki]Object[/wiki].
    [h="2"] Declaration [/h]
  2. -
    <code cpp>
    VAULTSCRIPT std::string (*GetName)(vaultmp::ID);
  3. +
    [highlight=cpp]
    VAULTSCRIPT vaultmp::String (*GetName)(vaultmp::ID);
  4.  
    native GetName(ID, name{});
  5. -
    </code>
  6. +
    [/highlight]
  7.  
    [h="2"] Parameters [/h]
    [b][wiki="ID"]vaultmp::ID[/wiki][/b] - the ID of the [wiki]Object[/wiki]
    [b]name[/b] (PAWN only) - an array large enough to hold at least [wiki]MAX_PLAYER_NAME[/wiki] characters. Note that [wiki="Object"]Objects[/wiki] which are not [wiki="Player"]Players[/wiki] can have longer names.
    [h="2"] Return value [/h]
  8. -
    The C++ version returns a std::string containing the name. The PAWN version has no return value.
  9. +
    The C++ version returns a [wiki="String"]vaultmp::String[/wiki] containing the name. The PAWN version has no return value.
  10.  
    [h="2"] Usage example (C++) [/h]
  11. -
    <code cpp>
    std::string name;
  12. +
    [highlight=cpp]
    vaultmp::String name;
  13.  
    name = GetName(object);
  14. -
    </code>
  15. +
    [/highlight]
  16.  
    [h="2"] Usage example (PAWN) [/h]
  17. -
    <code c>
  18. +
    [highlight=c]
  19.  
    new name{MAX_PLAYER_NAME};
    GetName(player, name);
  20. -
    </code>
  21. +
    [/highlight]
  22.  
    [category]VaultMP interface[/category]
    [category]Scripting functions[/category]
    [category]Object functions[/category]