That one works, but in my project it won't work. Here is the code to mine:
Rem /////////////////////////////
Rem Project: Blasted Arena
Rem Created: 1/14/2009 5:02:37 PM
Rem /////////////////////////////
Rem ////////////////////////////
Rem ***** Main Source File *****
Rem ////////////////////////////
Rem //////////////////////
Rem ***** Setup Game *****
Rem //////////////////////
Sync On:Sync Rate 60
Set Display Mode 640,480,32,1
Hide Mouse:AutoCam Off
Color Backdrop RGB(0,0,0)
Set Global Shadow Color 0,0,0,150
Set Point Light 0,128,200,-5
Color Light 0,RGB(255,255,255):Set Light Range 0,800
Rem ////////////////////////
Rem ***** Load Engines *****
Rem ////////////////////////
`AI Start
`AI Set Radius 15.0
Phy Start 1,0,1
Rem /////////////////////////////////
Rem ***** Load Needed Materials *****
Rem /////////////////////////////////
Fluid=500
`Make Fluid
Phy Make Fluid Fluid
Phy Set Fluid Position Fluid,375,100,3
Phy Set Fluid Particle Buffer Cap Fluid,2000
Phy Set Fluid Viscosity Fluid,50
Phy Set Fluid Damping Fluid,0.5
Phy Build Fluid Fluid
`Level Parts
ML1=B3D Load Object("Maps/ML1/ML1.dbo"):SC_SetupObject ML1,0,0
Scale Object ML1,50,50,50
Set Object Light ML1,0
Set Object Ambient ML1,0
Phy Make Rigid Body Static Mesh ML1
`Load Characters
SAS_1_D2=IMG Load Image("Models/SAS_1_D2.dds")
Player1=B3D Load Object("Models/SAS.x")
YRotate Object Player1,180:Fix Object Pivot Player1
Position Object Player1,128,100,-5
Texture Object Player1,SAS_1_D2
Set Shadow Shading On Player1,-1,1500,1
Phy Make Box Character Controller Player1,128,100,-5,10,1,10,1,20,45
`Load Sounds
G18S=SND Load Sound("Models/G18/Cock.wav")
`------------
`Load Weapons
`------------
`Assault Rifle
M4CQBR=B3D Load Object("Models/M4CQBR/VWEAP.x")
Set Shadow Shading On M4CQBR,-1,1500,1
Glue Object To Limb M4CQBR,Player1,38,2
Hide Object M4CQBR
`Pistol
G18=B3D Load Object("Models/G18/VWEAP.x")
Set Shadow Shading On G18,-1,1500,1
Glue Object To Limb G18,Player1,38,2
Hide Object G18
`Sniper
LRSR=B3D Load Object("Models/LRSR/VWEAP.x")
Set Shadow Shading On LRSR,-1,1500,1
Glue Object To Limb LRSR,Player1,38,2
Hide Object LRSR
Rem ////////////////////////////
Rem ***** RayCasting Setup *****
Rem ////////////////////////////
`Make Raycast Sphere
RayCastS=B3D Make Object Sphere(20)
RayCastM=M3D Make Mesh From Object(RayCastS)
Delete Object RayCastS
`Apply RayCastM To Player1
Perform Checklist For Object Limbs Player1
L=Checklist Quantity()
Add Limb Player1,L,RayCastM
Offset Limb Player1,L,0,30,-1000
Inc L,1:Dec L,1
Delete Mesh RayCastM
Hide Limb Player1,L
Rem ////////////////////////
Rem ***** Setup Camera *****
Rem ////////////////////////
`Make Camera Sphere
CSP1=B3D Make Object Sphere(20)
CSP1M=M3D Make Mesh From Object(CSP1)
Delete Object CSP1
`Apply Camera Sphere To Player
Perform Checklist For Object Limbs Player1
CSP1L=Checklist Quantity()
Add Limb Player1,CSP1L,CSP1M
Offset Limb Player1,CSP1L,0,550,250
Inc CSP1L,1:Dec CSP1L,1
Delete Mesh CSP1M
Hide Limb Player1,CSP1L
Rem ///////////////////////////
Rem ***** Weapon Varibles *****
Rem ///////////////////////////
Type WeaponS
Name As String
CBullets As Integer
CClips As Integer
BInClip As Integer
MBullets As Integer
Damage As Integer
Holding As Boolean
Using As Boolean
EndType
Dim Weapons(3) As WeaponS
`Assault Rifle
Weapons(1).Name="Assault Rifle"
Weapons(1).CBullets=30
Weapons(1).CClips=0
Weapons(1).BInClip=30
Weapons(1).MBullets=300
Weapons(1).Damage=4
Weapons(1).Holding=1
Weapons(1).Using=1
`Pistol
Weapons(2).Name="Pistol"
Weapons(2).CBullets=12
Weapons(2).CClips=0
Weapons(2).BInClip=12
Weapons(2).MBullets=72
Weapons(2).Damage=6
Weapons(2).Holding=1
Weapons(2).Using=0
`Sniper
Weapons(3).Name="Pistol"
Weapons(3).CBullets=4
Weapons(3).CClips=0
Weapons(3).BInClip=4
Weapons(3).MBullets=12
Weapons(3).Damage=20
Weapons(3).Holding=1
Weapons(3).Using=0
WN#=1
Rem ///////////////////////////
Rem ***** Static Varibles *****
Rem ///////////////////////////
CurrentTime=Timer()
LastTime=0
Rem ///////////////////////////
Rem ***** Start Main Loop *****
Rem ///////////////////////////
`Do/Loop
Do
Rem /////////////////////////////
Rem ***** Weapon Management *****
Rem /////////////////////////////
If Weapons(1).Using=1 Then Show Object M4CQBR
If Weapons(1).Using=0 Then Hide Object M4CQBR
If Weapons(2).Using=1 Then Show Object G18
If Weapons(2).Using=0 Then Hide Object G18
If Weapons(3).Using=1 Then Show Object LRSR
If Weapons(3).Using=0 Then Hide Object LRSR
Rem ////////////////////////////
Rem ***** Dynamic Varibles *****
Rem ////////////////////////////
`Player1's Positions
Player1X#=Object Position X(Player1)
Player1Y#=Object Position Y(Player1)
Player1Z#=Object Position Z(Player1)
`Player1's Shooting Limb Positions
Player1LX#=Limb Position X(Player1,L)
Player1LY#=Limb Position Y(Player1,L)
Player1LZ#=Limb Position Z(Player1,L)
`Player1's Camera Controller
Player1CLX#=Limb Position X(Player1,CSP1L)
Player1CLY#=Limb Position Y(Player1,CSP1L)
Player1CLZ#=Limb Position Z(Player1,CSP1L)
`Game's Frame Rate
FrameRate=Screen FPS()
Rem /////////////////////////////////
Rem ***** Display OnScreen Info *****
Rem /////////////////////////////////
`Frame Rate
Text 0,0,"Frame Rate "+STR$(FrameRate)
`Player1 Position
Text 0,20,"Player1 X "+STR$(Player1X#)
Text 0,30,"Player1 Y "+STR$(Player1Y#)
Text 0,40,"Player1 Z "+STR$(Player1Z#)
Rem ////////////////////////
Rem ***** Setup Camera *****
Rem ////////////////////////
`Camera Position/Rotation
Position Camera Player1CLX#,Player1CLY#,Player1CLZ#
Set Camera to Object Orientation Player1
Camy#=Camy#+Controller Thumb Right X(0)/11000
YRotate Object Player1,Camy#
Point Camera Player1X#,Player1Y#+50,Player1Z#
Rem //////////////////////////////////////////////////////
Rem ***** Player1's Movement Controls And Animations *****
Rem //////////////////////////////////////////////////////
Key=0
`Idle Animation
If Controller Thumb Left Y(0)=0 And Controller Thumb Left Y(0)=0 Then Key=0
`Moving Up
If Controller Thumb Left Y(0)>0
Key=1
Set Object Speed Player1,75
Loop Object Player1,663,681
Phy Move Character Controller Player1,250.0
Endif
`Moving Down
If Controller Thumb Left Y(0)<0
Key=1
Set Object Speed Player1,55
Loop Object Player1,598,622
Phy Move Character Controller Player1,-180.0
Endif
`Standing Animation
If Key=0
Loop Object Player1,573,597
Phy Move Character Controller Player1,0.0
Endif
`Weapon Switching
If Controller Button Y(0)=1 And WN#=1
Weapons(1).Using=1
Weapons(2).Using=0
Endif
If Controller Button Y(0)=1 And WN#=2
Weapons(2).Using=1
Weapons(1).Using=0
Endif
If Controller Right(0)=1 Then Inc WN#
If Controller Left(0)=1 Then Dec WN#
If WN#>2 Then WN#=2
If WN#<1 Then WN#=1
Text 0,100,"Weapon Number "+STR$(WN#)
Rem ////////////////////////////
Rem ***** Update Collision *****
Rem ////////////////////////////
Rem ///////////////////////
Rem ***** Update Game *****
Rem ///////////////////////
`----------------
`Update Collision
`----------------
`----------------
`Update Engines
`----------------
Phy Update
Rem /////////////////////////
Rem ***** End Main Loop *****
Rem /////////////////////////
Sync:Loop