Discord
Login
Community
DARK THEME

anyone know why my server isn't working

i'm making an ikea based multiplayer survival game (yes it's as weird as it sounds) and my server suddenly just broke and i have no idea what's wrong

code:

serverInit = function()

print("server start")

server = new Server()

print("server connection created")

map = []

player = []

locations = []

department = []

stuff = []

rsize = 10 //room size

wsize = 10 //world size

print("world size initialized")

generation()

locations[0][0] = 1

tick = 0

print("setup complete!")

end

serverUpdate = function()

print("update started")

//print new connections

for connection in server.new_connections

print(connection)

sleep 1 seconds

for client in server.active_connections

  client.send(["request","location"])

  for w=0 to wsize-1

    for z=0 to wsize-1

      if location[w][z] == 1 then

        for y=0 to rsize-1

          for x=0 to rsize-1

            client.send(["room",w,z,y,x,map[w][z][y][x]])

            client.send(["stuff",w,z,y,x,stuff[w][z][y][x]])

            client.send(["player",w,z,y,x,player[w][z][y][x]])

          end

        end

      end

    end

  end

end

end

//check for new messages and adjust map accoringly

for message in server.messages

print("received message:")

print(message.data)

print("from:")

print(message.connection)

if message.data[0] == "room" then

  map[message.data[1]][message.data[2]][message.data[3]][message.data[4]] = message.data[5]

  for client in server.active_connections

    client.send(["room",message.data[1],message.data[2],message.data[3],message.data[4],message.data[5])

  end

end

if message.data[0] == "player" then

  player[message.data[1]][message.data[2]][message.data[3]][message.data[4]] = message.data[5]

  for client in server.active_connections

    client.send(["room",message.data[1],message.data[2],message.data[3],message.data[4],message.data[5])

  end

end

if message.data[0] == "stuff" then

  stuff[message.data[1]][message.data[2]][message.data[3]][message.data[4]] = message.data[5]

  for client in server.active_connections

    client.send(["room",message.data[1],message.data[2],message.data[3],message.data[4],message.data[5])

  end

end

if message.data[0] == "location" then

  location[message.data[1]][message.data[2]] = message.data[3]

end

end

tick += 1

end

Do you have the sever thing of microstudio on?

yes, and it has worked in the past, i cant figure out why it broke

from my testing the server init function isn't running

https://microstudio.dev/i/thecodegangster/survikea/ heres the full code

NEVERMIND I FIXED IT

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community