Schedule Dedicated Servers Documentation
  • SDS Documentation
  • Schedule In Unity
    • Extracting the game to unity
    • Creating an assetbundle
  • Creating plugins
    • How to create a plugin
    • The ClientAPI (custom content)
  • Custom Assets
  • Plugin Events
  • Texture/Material Replacement
  • Chat Messages
  • Chat Commands
  • Console Commands
  • HAPI Methods
Powered by GitBook
On this page
  • Finding an object by name near a position
  • Finding an object by its hierarchy path
  • Saving the game
  • Teleporting a player somewhere
  • Kicking a player
  • Banning a player

HAPI Methods

The HAPI class has multiple methods to save you time and enhance your workflow.

Finding an object by name near a position

Sometimes there's multiple objects with the same name so if you have your object position you can use this method to find it more accurately.

GameObject FindGameObjectNearPos(string name, Vector3 position)
// This allows you to get the nearest object from this position that matches the name.
GameObject overpassRoadpart = HAPI.FindGameObjectNearPos("30 Wedge", new Vector3(-8.20f, 0, -45.58f));

Finding an object by its hierarchy path

This is probably the most accurate way of finding buildings or static objects if you want to interact with them.

GameObject FindGameObjectByPath(string path)
// This allows you to get an object by its hierarchy path
GameObject overpass = HAPI.FindGameObjectByPath("Map/Container/Overpass");

Saving the game

This one is pretty simple as you just call it to save the game.

HAPI.SaveGame();

Teleporting a player somewhere

HAPI gives you an extension method for the Player class so you can teleport an user wherever you want.

player.Teleport(new Vector3(0,0,0));

Kicking a player

Kicking a player can be done through the Kick extension method.

void Kick(this Player player, string reason = "You have been kicked from the server !")
thePlayer.Kick("Get out of here.");

Banning a player

Banning a player can also be done using HAPI with the Ban extension method.

void Ban(this Player player, string reason = "You have been banned from the server !")
thePlayer.Ban("You'll never come back again.");

PreviousConsole Commands

Last updated 1 month ago