Skip to content

Game

Functions

Return Type Name Description
nil game.script_event(table params, number bitset) Triggers a script event
nil game.invite(number rid) Invites a player by RID to your session
memory_address game.net_object_from_id(number id) The pointer to the net object for the given id
nil game.add_friend(number rid) Send a friend request to a player by RID
bool game.is_rid_friend(number rid) Whether the RID is your friend
nil game.join_player(number rid, bool? spectate) Joins a player by RID
nil game.basket_transaction(number category, number action, number destination, table[number[5]] items) Triggers a transaction
bool game.is_basket_busy() Whether the transaction manager is busy
memory_address game.get_model_info(number hash) Get the pointer to the models info
bool game.update_entity_owner(number handle, player new_owner) Updates a networked entities owner
player game.get_entity_owner(number handle) Get the entities owner
memory_address game.get_entity_from_guid(number handle) Get the address for an entity handle
nil game.execute_as_script(string script, function callback) Executes a function in the given scripts context
nil game.start_script(number id) Starts a script for the session
nil game.change_session(number id) Changes session
GameState game.state() Gets the game state
vec2 game.resolution() Gets the game resolution
number game.delta() Gets the game delta time

Examples

-- Drop action figures on the session. The bitset for a target player is (1 << player.id), 0xFFFFFFFF will target everyone.
-- Player ids are not required in the param list, only the id and the event params.
for i = 0, 10 do
  game.script_event({968269233, 0, i, true, true, true}, 0xFFFFFFFF)

  -- Alternatively, you can use a static list found in the docs
  game.script_event({ScriptEvents.COLLECTIBLE_COLLECTED, 0, i, true, true, true}, 0xFFFFFFFF)
end

-- Invite rid 1 to the session
game.invite(1)

-- Add rid 1 as a friend
game.add_friend(1)

-- Check if rid 1 is a friend
print('Friend:', game.is_rid_friend(1))

-- Add $15M to the bank (2 for bank, 1 for wallet)
game.basket_transaction(joaat('CATEGORY_SERVICE_WITH_THRESHOLD'), joaat('NET_SHOP_ACTION_EARN'), 2, { { joaat('SERVICE_EARN_BEND_JOB'), 1, 15000000, 0, 1 } })

-- Add $1M looped
util.create_thread(function()
  if game.is_basket_busy() then
    return
  end

  game.basket_transaction(joaat('CATEGORY_SERVICE_WITH_THRESHOLD'), joaat('NET_SHOP_ACTION_EARN'), 2, { { joaat('SERVICE_EARN_JUGGALO_STORY_MISSION'), 1, 1000000, 0, 1 } })
end)

-- Join a new public session
game.change_session(0)