Here is the money with comments.
[edit] I put all of my changes inside:
`****************
`****************
`****************
`****************
`Setup Client Options
SYNC ON:SYNC RATE 0:HIDE MOUSE: AUTOCAM OFF
`Define the main variables needed
EnemyHP#=2000` Enemy's Health
Ammo#=1000` Starting Ammo
MaxAmmo#=1000` Maximum amount of Ammo
Clips#=3` Starting Clips
MaxClips#=3` Maximum amount of Clips
posx#=250` Player position
posz#=250` Player position
eposx#=500` Enemy position
eposz#=453` Enemy position
`*****************************************************************************
`*****************************************************************************
play_out = 0 :` Tells when player has gone off matrix
`*****************************************************************************
`*****************************************************************************
`Create Main Player
MAKE OBJECT SPHERE 1,50:COLOR OBJECT 1,RGB(123,212,155):POSITION OBJECT 1,posx#,Ground#,posz#
`Create Enemy Player
MAKE OBJECT SPHERE 2,50:COLOR OBJECT 2,RGB(155,212,123):POSITION OBJECT 2,eposx#,Ground#,eposz#
`create ammo crate
`LOAD OBJECT "crate2.x", 4
make object cube 4, 100
POSITION OBJECT 4,199,Ground#,199: SCALE OBJECT 4,19,19,19
`create playing field
MAKE MATRIX 1,1000,1000,50,50
`add texture to matrix
LOAD IMAGE "grass2.bmp",1
PREPARE MATRIX TEXTURE 1,1,1,1
`Add limb for intersection checks
MAKE OBJECT SPHERE 9999,10
MAKE MESH FROM OBJECT 1,9999
DELETE OBJECT 9999
ADD LIMB 1,1,1
OFFSET LIMB 1,1,0,0,500
HIDE LIMB 1,1
`Add a second limb for ground checks
ADD LIMB 1,2,1
OFFSET LIMB 1,2,0,-50,0
DELETE MESH 1
HIDE LIMB 1,2
`Start main DO/LOOP
DO
`*****************************************************************************
`*****************************************************************************
`stop player from flying
xrotate object 1, 0
`*****************************************************************************
`*****************************************************************************
`Movement Controls
IF KEYSTATE(17)=1 THEN MOVE OBJECT 1,.9
IF KEYSTATE(31)=1 THEN MOVE OBJECT 1,-.9
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,.3
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,.3
`*****************************************************************************
`*****************************************************************************
`Put player direction back to mouselook angle
xrotate object 1, CAMX#
`*****************************************************************************
`*****************************************************************************
`*****************************************************************************
`*****************************************************************************
`Use variables to make code easier to read (shorter lines)
Play_x# = object position x(1)
Play_y# = object position y(1)
Play_z# = object position z(1)
`prevent player from moving off matrix
if Play_x# < 0 then Play_x# = 0 : play_out = 1
if Play_x# > 1000 then Play_x# = 1000 : play_out = 1
if Play_z# < 0 then Play_z# = 0 : play_out = 1
if Play_z# > 1000 then Play_z# = 1000 : play_out = 1
if play_out = 1
position object 1, Play_x#, Play_y# , Play_z#
play_out = 0
endif
`*****************************************************************************
`*****************************************************************************
`Space key Controls
IF SPACEKEY()=1 AND JUMPING#=0 THEN JUMP#=1
`JUMP Variable Definition
IF JUMP#=1
JUMP_SPEED#=1
JUMPING#=1
JUMP#=0
ENDIF
`Jumping
IF JUMPING#=1
DEC JUMP_SPEED#,.005
Play_y# = Play_y#+JUMP_SPEED#
POSITION OBJECT 1, Play_x#, Play_y#, Play_z#
IF Play_y# <= GROUND# THEN JUMPING#=0
ENDIF
`Mouse Camera Movement
CAMY#=CAMY#+MOUSEMOVEX()*.1
CAMX#=CAMX#+MOUSEMOVEY()*.1
IF CAMX#>90 AND CAMX#<135 THEN CAMX#=90
IF CAMX#>270 AND CAMX#<225 THEN CAMX#=90
YROTATE CAMERA CAMY#
XROTATE CAMERA CAMX#
YROTATE OBJECT 1,CAMY#
XROTATE OBJECT 1,CAMX#
`Mouseclick Shooting
IF KEYSTATE(19)=0 AND MOUSECLICK()=1
IF Ammo#>0 THEN DEC Ammo#,1
IF OBJECT EXIST(2)=1
IF Ammo#>0 AND INTERSECT OBJECT (2, LIMB POSITION X(1,1), LIMB POSITION Y(1,1), LIMB POSITION Z(1,1), OBJECT POSITION X(1),OBJECT POSITION Y(1), OBJECT POSITION Z(1))>0 THEN DEC EnemyHP#,1
ENDIF
ENDIF
`Check if the enemy should die, if so delete it
IF EnemyHP#=0 AND OBJECT EXIST(2)=1 THEN DELETE OBJECT 2
`Reloading (press R)
IF MOUSECLICK()=0 AND KEYSTATE(19)=1 AND Ammo#<MaxAmmo# AND Clips#>0
Reload#=1
ENDIF
`Reloading Part 2 (delay)
IF Reload#=1 THEN INC Time#,.005
IF Time#>=1 THEN Ammo#=MaxAmmo#:DEC Clips#,1:Time#=0:Reload#=0
`Ammo Crate code (obtain ammo from ground)
IF OBJECT EXIST(4)=1
IF Ammo#<MaxAmmo# AND INTERSECT OBJECT (4, LIMB POSITION X(1,2), LIMB POSITION Y(1,2), LIMB POSITION Z(1,2), OBJECT POSITION X(1),OBJECT POSITION Y(1), OBJECT POSITION Z(1))>0
INC Clips#,(MaxClips#-Clips#)
INC Ammo#,(MaxAmmo#-Ammo#)
DELETE OBJECT 4
ENDIF
ENDIF
`*****************************************************************************
`*****************************************************************************
`Object in screen prevents it from printing when object is not in view
`Display text above enemy and crate object
IF OBJECT EXIST(2)=1
IF OBJECT IN SCREEN(2)=1
CENTER TEXT OBJECT SCREEN X(2),OBJECT SCREEN Y(2)-70,"Enemy Health: "+str$(EnemyHP#)
ENDIF
ENDIF
IF OBJECT EXIST(4)=1
IF OBJECT IN SCREEN(4)=1
CENTER TEXT OBJECT SCREEN X(4),OBJECT SCREEN Y(4)-20,"Ammo Crate"
ENDIF
ENDIF
`*****************************************************************************
`*****************************************************************************
`Display our Ammo and Clips on-screen
TEXT 0,SCREEN HEIGHT()-50,"Ammo: "+str$(Ammo#)
TEXT 0,SCREEN HEIGHT()-40,"Clips: "+str$(Clips#)
`Show that we're reloading
IF Reload#=1 THEN CENTER TEXT SCREEN WIDTH()/2,SCREEN HEIGHT()/2,"Reloading..."
`Add a target reticule to the screen
CIRCLE SCREEN WIDTH()/2,SCREEN HEIGHT()/2,5
`*****************************************************************************
`*****************************************************************************
`Fix player moving through the matrix
`make matrix the ground
GROUND#=GET GROUND HEIGHT(1,posx#,posz#)+10
if Play_y# < GROUND#
Play_y# = GROUND#
position object 1, Play_x#, Play_y#, Play_z#
endif
`*****************************************************************************
`*****************************************************************************
`Camera Positioning
POSITION CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1)
`Refresh the screen(SYNC) and call the LOOP function
SYNC
LOOP