OK guys i have this multiplayer code but it doesn't work, it can only host not join...please fix it or tell me what I'm doing wrong. If you wanna test it or ask me something then me email is
[email protected]
pname$="temp"
rem Start net game
PlayerNumber=default net game("gamename",pname$,4,1)
if net game exists()=1
rem Show name of player as Window Title
if PlayerNumber=1
set window title "HOST Player "+pname$
else
set window title "CLIENT Player "+pname$
endif
make object cube PlayerNumber,20
position object PlayerNumber,PlayerNumber*(10),6,20
make matrix 1,500,500,10,10
make memblock 1,8
make memblock 2,8
rem Main Loop
do
rem CAMERA
position camera newxvalue(object position x(PlayerNumber),object angle y(PlayerNumber),-40),30,newzvalue(object position z(PlayerNumber),object angle y(PlayerNumber),-40)
rotate camera 0,object angle y(PlayerNumber),0
`CONTROLS
if leftkey()=1 then yrotate object PlayerNumber,wrapvalue(object angle y(PlayerNumber)-3)
if rightkey()=1 then yrotate object PlayerNumber,wrapvalue(object angle y(PlayerNumber)+3)
if upkey()=1 then move object PlayerNumber,3
if downkey()=1 then move object PlayerNumber,-3
write memblock word 1,0,object position x(PlayerNumber)
write memblock word 1,2,object position z(PlayerNumber)
send net message memblock 0,1
rem Draw Others
net message memblock 2
while net message exists()=1
OtherNumber=net message player from()
OtherX#=memblock word(2,0)
OtherZ#=memblock word(2,2)
if object exist(OtherNumber)=0 then make object cube OtherNumber,20
position object OtherNumber,OtherX#,6,OtherZ#
endwhile
rem Update and/or Quit key
sync : if escapekey()=1 then exit
loop
rem End net game
free net game
else
do : cls 0 : center text 160,113,"COULD NOT CREATE NET GAME" : sync : loop
endif