Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Callbacks

Daranix edited this page Aug 26, 2015 · 5 revisions

gm.events.onPlayerLogin(player)

Event called when a player login's

gm.events.onPlayerUpdate(player, callback, showInfo)

Event called when info of a player is updated

Params:

  • player
  • callback: See the example for more information
  • showInfo (Default: true)

Here's a example of use

commands.set("getAdmin", (player, args) => {
  
  PlayerInfo[player.name].adminlvl = 4;

  gm.events.onPlayerUpdate(player, function(result) {
    if(result) {
      player.SendChatMessage("[ADMIN] You was promoted to admin level 4");
    } else {
     player.SendChatMessage("[ERROR] An error ocurred when trying to upload your player info"); 
    }
  });

});

gm.events.updateAllPlayers()

Called when the server updates the info of all players

You can change server update players interval on main.js

Clone this wiki locally