Rocket Networking Docs🚀
  • About this Documentation
  • Basics of Rocket Networking
    • Room based multiplayer (Auto State Sharing)
      • Clients and clientId
      • Entities
      • Smart Entities
    • Single Message Sharing
    • Persistent Objects on the Server
    • Easy Matchmaking
    • Discord Server Integration
    • Database for your Account
    • Server Side Scripting
    • Global Multiplayer(Cross play)
  • Rocket Networking Code
    • Connecting and Disconnecting
      • ConnectToServer()
      • callback_ConnectToServer()
      • DisconnectFromServer()
      • callback_DisconnectFromServer()
    • Rooms
      • ChangeRoom( new_room_name )
      • callback_ChangeRoom()
      • LeaveRoom()
      • callback_LeaveRoom()
      • ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()
      • ShowAllRooms() and callback_ShowAllRooms()
    • Private Messaging
      • SendEventToClient
      • callback_ReceivedEvent
      • SendMessageToClient
      • callback_ReceivedMessage
    • Persistent Objects
      • CreatePersistentObject(roomId , persistentObjectStruct)
      • callback_CreatedPersistentObject()
      • EditPersistentObject(persistentObjectId , new_persistentObjectStruct)
      • DestroyPersistentObject(persistentObjectId)
      • ShowPersistentObjectsInRoom(room_name)
      • callback_ShowAllPersistentObjectsInRoom(array_of_persistent_objects)
    • Database Functions
      • SetSimpleData()
      • callback_SetSimpleData()
      • ReadSimpleData()
      • callback_ReadSimpleData()
      • AddToSimpleData()
      • callback_AddToSimpleData()
      • DeleteSimpleData()
    • Discord Integration
      • SendDiscordMessage()
      • callback_DiscordMessageReceived()
    • AI Functions
      • CallSimpleAI
      • callback_CallSimpleAI
      • CallGeneralAI
      • callback_CallGeneralAI
  • KickPlayer(client_id)
  • ViewServerActivity()
    • callback_ViewServerActivity()
  • oBrain - ping and pseudoHost
  • Admin Callbacks
  • API
    • Database
    • AI
  • Server Side Scripting
    • Basics
    • Understand the heirarchy on the server
    • Create a Persistent Object from Server
    • Important Scripts
      • "step" Script format
      • "client_sent_event" Script format
      • "game_server_created" Script format
    • Send Event to a Client from Server
    • Database Functions on Server
    • AI Functions on the Server
Powered by GitBook
On this page
  • Description
  • How do I see which clients are on this room
  • Example Implementation of function call
  • Example Implementation of callback(continued)
  • If the room does not exist?
  1. Rocket Networking Code
  2. Rooms

ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()

Description

This function tells you about all the clients in a room. Enter the room name you want to check for.

Syntax

ShowAllClientsInRoom(room_name);
Argument
Description

room_name

The name of the RNet room you want to scan. This must be a String

Returns

N/A

How do I see which clients are on this room

After a successful scan of the room name you entered, the callback function callback_ShowAllClientsInRoom() is called. So under Scripts/Rocket Networking/Callback Functions , you can edit this to do whatever you want…

❓ This function returns an array of all client id’s in a room. For example if there are 3 clients with clientId’s 3, 6 and 11 respectively in the room “public”, this function’s callback will return the array [ “3” , “6” , “11” ] . It is worth noting that these are not numbers in the array, they are strings of the numbers.

Example Implementation of function call

  • So firstly I made 2 clients join the room “public”

  • Then I wrote some basic code to try out this function

Example Implementation of callback(continued)

  • Then after I pressed okay, this callback code took place

  • Here I’ve just done a show_message so the user is shown a dialog box with that message but you get the idea

  • So what it returned in the end was

[7,9]in public

If the room does not exist?

⚠️ If the room you entered does not exist, this callback function will not return an array. Instead the “array_of_clients” variable will be the integer -1. So a good practice would be to first check if it is an array. If not then the room doesn’t exist. If yes then treat it as an array.

Previouscallback_LeaveRoom()NextShowAllRooms() and callback_ShowAllRooms()

Last updated 1 year ago