I'm having a problem with multiple enemys. It won't display any enemies when somebody joins.
AppTitle "Internet Game" SetBuffer BackBuffer() Type EnemyType Field Name$ Field mesh Field Id End Type SeedRnd MilliSecs() Global Game = StartNetGame() If Game = 0 Then End EndIf Graphics3D 1024,768,32,1 Global Name$ = Input$("Enter Your Name: ") FlushKeys() FlushMouse() FlushJoy() id = CreateNetPlayer(Name$) If Game = 1 Then SendNetMsg 1,Name$,id,0,False EndIf Cls Dim sight(2) sight(0) = LoadImage("Sight.bmp") sight(1) = 0 Building = LoadMesh("Building2-5.b3d") ;RotateEntity Building,Rand(0,360),Rand(0,360),Rand(0,360) Dim bullet(5) enemy = LoadMesh("Person.3ds") bullet(0) = LoadMesh("Bullet.3ds") HideEntity enemy EntityType enemy,3 EntityType bullet(0),4 HideEntity bullet(0) players = 0 If Building = 0 Then RuntimeError "File: 'Building.b3d' Not Found" EndIf Collisions 1,2,2,2 Global player = CreatePivot() PositionEntity player,0,1,0 EntityRadius player,.3 EntityType player,1 Global box = CreateCube() ResizeMesh(box,1,1,1) Randomize() Global camera = CreateCamera(player) CameraRange camera,.1,200 Global light = CreateLight() LightColor light,32,32,32 TurnEntity light,45,-45,0 EntityFX Building,1 EntityType Building,2 sp#=.05 ey#=EntityY(player) While Not KeyHit(1) yv#=EntityY(player)-ey ey=EntityY(player) If KeyHit(57) yv=.1 MoveEntity player,0,yv-.005,0 If KeyHit(31) sight(1) = Not sight(1) If MouseHit(1) ShowEntity bullet(0) bullet(1) = EntityX(player) bullet(2) = EntityY(player) bullet(3) = EntityZ(player) bullet(5) = 1 PointEntity bullet(0),sight(0) PositionEntity bullet(0),bullet(1),bullet(2),bullet(3) EndIf If KeyDown(30) TurnEntity camera,-2,0,0 If KeyDown(44) TurnEntity camera,+2,0,0 If KeyDown(203) TurnEntity player,0,2,0 If KeyDown(205) TurnEntity player,0,-2,0 If KeyDown(200) MoveEntity player,0,0,sp If KeyDown(208) MoveEntity player,0,0,-sp Distance = EntityDistance(player,box) If frame = 25 Then SendNetMsg 2,EntityX(player) + "," + EntityY(player) + "|" + EntityZ(player),id frame = 0 EndIf frame = frame + 1 RecvNetMsg() If NetMsgType() = 2 Then start = Instr(NetMsgData(),",") x = Left(NetMsgData(),start - 1) start2 = Instr(NetMsgData(),"|") y = Mid(NetMsgData(),start + 1,start2 - 1) z = Right(NetMsgData(),Len(NetMsgData()) - start2) For thisEnemy.EnemyType = Each EnemyType If thisEnemy\Id = NetMsgFrom() Then PositionEntity thisEnemy\mesh,x,y,z EndIf Next EndIf CheckMail() Locate 0,0 Print EntityDistance(player,box) RecvNetMsg() If Game = 2 And NetMsgType() = 4 And NetMsgData$() = "Get" Then SendNetMsg(4,"Send: " + Players,NetMsgFrom()) EndIf If NetMsgType() = 99 Then Cls Locate 0,0 Print "You lost. " + NetMsgData() + " Won!" EndGame() EndIf If EntityDistance(player,box) < 1 Then Cls Locate 0,0 Print "You Won!!!" SendNetMsg 99,Name$,id Delay 500 EndGame() EndIf If EntityDistance(player,enemy) =< 0.5 And 1 = 2 Then SendNetMsg( 99,Input$("Who was that?"),id) EndIf UpdateWorld RenderWorld Print "Frame: " + frame If sight(1) = 1 Then DrawImage sight(0),MouseX(),MouseY(),0 EndIf Flip Wend SendNetMsg 98,Name$,id EndGame() End Function ResizeMesh(mesh,width#,height#,depth#) ScaleMesh mesh,1/MeshWidth#(mesh)*width#,1/MeshHeight#(mesh)*height#,(1/MeshDepth#(mesh))*depth# End Function Function EndGame() FreeEntity Building FreeEntity box FreeImage sight(0) EndGraphics End End Function Function CheckMail() RecvNetMsg() If NetMsgType() = 1 Locate 0,0 Print NetMsgData() + " has joined" players = players + 1 Print "Increase player amount" thisEnemy.EnemyType = New EnemyType Print "Created new player type" thisEnemy\mesh = CopyMesh(enemy) thisEnemy\Name$ = NetMsgData() thisEnemy\Id = NetMsgFrom() Delay 1000 EndIf If NetMsgType() = 97 Then If NetMsgData = Name$ Then PositionEntity player,0,1,0 EndIf EndIf End Function Function Randomize() Select Rand(0,6) + 1 Case 1 PositionEntity box,-7,0,-7 Case 2 PositionEntity box,19,0,-18 Case 3 PositionEntity box,18,4,-18 Case 4 PositionEntity box,25,-3,-10 Case 5 PositionEntity box,5,-2,22 Case 6 PositionEntity box,Rand(-8,30),0,Rand(-22,26) Case 7 PositionEntity box,27,6,3 End Select End Function ;Msg Types ;1 = Join ;2 = Position ;3 = Mail (Send a msg) ;4 = Request Player amount ;97 = Reset Player ;98 = Quit ;99 = Win/Lose