"game_server_created" Script format

This script runs when your game server is created. The start of the server.

You can use this script as sort of a "Create Event" for your server. You can store initial variables, create methods etc etc.

Example Implementation

game.leaderboard = []

game.updateLeaderboard = () => {
    //scout all clients in room "public"
    for(let clientId in game.rooms["public"].clients){
        var client = game.rooms["public"].clients[clientId]
        //add this clients name and kills to the list
        game.leaderboard.push([ client.name , client.kills  ])
    //now sort game.leaderboard somehow

Last updated