Okay, please help me out here. Below is a self-contained script (no assets required), only about 40 lines long.
Code:
// multiplayer test

function startServer() {
	session_open("test");
}

function startClient() {
	session_connect("test", NULL);
}

function disconnectClient() {
	session_close();
}

function createEntity() {
	ent_createlocal(SPHERE_MDL, vector(0, random(64) - 32, random(32) - 16), NULL);
}

function main() {
	screen_size.x = 200;
	screen_size.y = 100;
	level_load(NULL);
	camera.x -= 100;
	ent_createlocal(SPHERE_MDL, nullvector, NULL);
	on_s = startServer;
	on_c = startClient;
	on_d = disconnectClient;
	on_e = createEntity;
	while (1) {
		if (connection & 1) {
			draw_text("server", 10, 10, vector(255, 255, 255));
		} else if (connection & 2) {
			draw_text("client", 10, 10, vector(255, 255, 255));
		} else {
			draw_text("offline", 10, 10, vector(255, 255, 255));
		}
		wait(1);
	}
}


Please run the script, then press "s" to start a server. Leave that running and run the script again, and press "c" to connect to a server on the same machine. Here it goes black and the entity disappears (level cleared). Press "e" to create a local entity on the client, and I get the error. If I press "e" on the server (or in offline mode), another sphere is created in front of the camera.

I'm afraid I don't know why this is going wrong, and any help would be much appreciated.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!