The method player.tip() is used to tip another player with a specified amount of gold bars. It requires two parameters: the user ID of the player to tip, and the amount of gold bars to tip.

Note: The bot cannot tip itself. We have included some predefined gold bar amounts that can be accessed by importing the class "GoldBars" from the package. For example:

const { GoldBars } = require("highrise.sdk");

// Assuming you have defined the Highrise instance as "bot".
bot.on("chatCreate", (user, message) => {
  if (message === "tip") {
    bot.player.tip(user.id, GoldBars.BAR_5k).then(() => {
      console.log(`[TIP]: ${user.username}:${user.id} - 5000 gold bars`);
    }).catch(e => { console.error(e) });
  }
});

The Highrise.sdk package handles errors directly within the methods themselves. Each method returns a promise, so when using .catch(), it will log any errors that occur. This feature is useful in scenarios such as when a player leaves the room. Here's an example demonstrating this:

// Assuming you have defined the Highrise instance as "bot".
bot.on("chatCreate", (user, message) => {
  if (message === "tip") {
    bot.player.tip(user.id, "invalid").catch(e => console.error(e));
  }
});

In this example, we use an invalid gold bar amount. It should log an error and refrain from executing the method.


Go Back: Perform Actions On Player