you forgot to include a delay.
insert a "sleep(1)" for example.
if(event_type == event_join)
{ sleep(1); //let the client get startet
players_connected += 1;
send_var(players_connected);
return;
}
Else, you cant be shure if the client is ready to get the message.
It might have just connect to the server, but needs some preparation before receiving data.
In a multiplayersystem is is a lot about timing the send data correctly,
as sending a variable / entity does not mean that it took place right after you send it.
send_var does work, just let the client have enough time to
get working properly.
Also creating entities like bullets on the server is a bad idea.
As it takes some time, until the client create the entity,
the bullet already hit the wall.
So either give a command using send_var(player_2_makebullet)
and create a local entity on the client,
or make a couple of bullets, that are hidden somewhere, and move them by time, whenever
they get shot.