Skip to content

Hooks.user

Christopher Day edited this page Apr 17, 2020 · 1 revision

newUser Called when a user signs up

new Hook("newUser", function ($userID) {
  $user = new User($userID);
  $user->newNotification("Welcome to the game!");
});

userInformation This is run as user items are bound to the template

new Hook("userInformation", function ($user) {
  global $page;
  $page->addToTemplate("will", $user->info->US_will);
});

rankUp The user has just ranked up

new Hook("rankUp", function ($info) {
  debug($info["user"]); // User ID
  debug($info["rank"]); // Rank ID
});

userTimerUpdated A timer has just been updated for this user

new Hook("userTimerUpdated", function ($info) {
  debug($info["timer"]); // The timer that was updated
  debug($info["time"]); // The new time
  debug($info["user"]); // The user ID
});

joinGang The user has just joined a gang

new Hook("joinGang", function ($user) {
  $user->newNotification("You just joined a gang");
});

userKilled This is run when a user has killed another user

new Hook("userKilled", function ($info) {
  $info["shooter"]->newNotification("You just shot someone!");
  $info["killed"]->newNotification("You just got shot by someone!");
});
Clone this wiki locally