Created
July 29, 2009 01:16
-
-
Save severedskullz/157798 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AddCSLuaFile( "cl_init.lua" ) | |
| AddCSLuaFile( "shared.lua" ) | |
| include( 'shared.lua' ) | |
| local models = { | |
| "models/player/Group03/female_01.mdl", | |
| "models/player/Group03/female_02.mdl", | |
| "models/player/Group03/female_03.mdl", | |
| "models/player/Group03/female_04.mdl", | |
| "models/player/Group03/male_01.mdl", | |
| "models/player/Group03/male_02.mdl", | |
| "models/player/Group03/male_03.mdl", | |
| "models/player/Group03/male_04.mdl", | |
| "models/player/Group03/male_05.mdl", | |
| "models/player/Group03/male_06.mdl", | |
| "models/player/Group03/male_07.mdl", | |
| "models/player/Group03/male_08.mdl", | |
| "models/player/Group03/male_09.mdl", | |
| } | |
| // Serverside only stuff goes here | |
| /*--------------------------------------------------------- | |
| Name: gamemode:PlayerLoadout( ) | |
| Desc: Give the player the default spawning weapons/ammo | |
| ---------------------------------------------------------*/ | |
| function GM:PlayerLoadout( pl ) | |
| pl:GiveAmmo( 255, "Pistol", true ) | |
| pl:Give( "empty_weapon" ) | |
| end | |
| function GM:PlayerInitialSpawn(pl) | |
| pl:SetPos(self:PlayerSelectSpawn(pl):GetPos()) | |
| //hook.Call("PlayerSetModel",GAMEMODE,pl) | |
| pl:SetModel(Model(models[math.random(#models)])) | |
| pl.HasChute = true | |
| end | |
| function GM:PlayerSpawn(pl) | |
| pl:SetPos(self:PlayerSelectSpawn(pl):GetPos()) | |
| //hook.Call("PlayerSetModel",GAMEMODE,pl) | |
| pl:SetModel(Model(models[math.random(#models)])) | |
| if pl.HasChute then | |
| ChuteSpawn(pl) | |
| ChuteSpawn(pl) | |
| end | |
| end | |
| hook.Add("KeyPress","Openandreleasechute", | |
| function(ply,key) | |
| if (key==131072 and ply.ChuteOpen) then | |
| --cut the line | |
| chute_make_Normal(ply) | |
| return | |
| end | |
| end) | |
| local function ChuteSpawn(ply) | |
| if not ply.HasChute then return end | |
| if not ply.ChuteThink then ply.ChuteThink=CurTime() end | |
| //if not (ply.ChuteThink<CurTime()) then return end | |
| //ply.ChuteThink=CurTime()+1 | |
| if not ply.chuteragdoll then | |
| --Make Ragdoll | |
| local phys=ply:GetPhysicsObject() | |
| local cvel=phys:GetVelocity() | |
| local ragdoll = ents.Create( "prop_ragdoll" ) --Thanks Ulyssus for showing me how to mimic the ulx ragdoll command. | |
| ragdoll:SetPos( ply:GetPos() ) | |
| ragdoll:SetModel( ply:GetModel() ) | |
| ragdoll:SetAngles(Angle(90,ply:GetAngles().y,0)) | |
| ragdoll:Spawn() | |
| ragdoll:Activate() | |
| ragdoll.IsChuteDoll=true | |
| --local curweps={} | |
| --for k, v in pairs(ply:GetWeapons()) do | |
| -- table.insert(curweps,v:GetClass()) | |
| --end | |
| --ply.CurWeaponsP=curweps | |
| ply:SetParent( ragdoll ) | |
| ply:StripWeapons() | |
| ply:Spectate( OBS_MODE_CHASE ) | |
| ply:SpectateEntity( ragdoll ) | |
| ply.chuteragdoll = ragdoll | |
| ragdoll:GetPhysicsObject():ApplyForceCenter(cvel*500000) | |
| else | |
| local chute=ents.Create("prop_physics") | |
| chute:SetPos(ply:GetPos()+Vector(0,0,100)) | |
| chute:SetAngles(Angle(0,ply:GetAngles().y,0)) | |
| chute:SetModel("models/parachute/chute.mdl") | |
| chute.IsChute=true | |
| chute:Spawn() | |
| ply.ChuteOpen=true | |
| ply.Chute=chute | |
| ply.chuteragdoll:EmitSound(Sound("ambient/fire/mtov_flame2.wav"),100,100) | |
| local chutelocal, chutelocal2 = chute:GetRight()*40+chute:GetLocalPos(), chute:GetRight()*-40+chute:GetLocalPos() | |
| constraint.Rope( ply.chuteragdoll, chute, 7, 0, Vector(0,0,0), Vector(100,0,-20), 200, 0, 0, 2, "cable/rope", 0 ) | |
| constraint.Rope( ply.chuteragdoll, chute, 5, 0, Vector(0,0,0), Vector(-100,0, -20), 200, 0, 0, 2, "cable/rope", 0 ) | |
| end | |
| end | |
| hook.Add("Think","Addforcetoragdoll", | |
| function() | |
| for k, v in pairs(player.GetAll()) do | |
| if v.chuteragdoll then | |
| if v:KeyDown( 8 ) then | |
| local angle=v:EyeAngles():Forward( ) | |
| local phys=v.chuteragdoll:GetPhysicsObject() | |
| phys:ApplyForceCenter(Vector(angle.x,angle.y,0)*800) | |
| end | |
| if v:KeyDown( 16 ) then | |
| local angle=v:EyeAngles():Forward( ) | |
| local phys=v.chuteragdoll:GetPhysicsObject() | |
| phys:ApplyForceCenter(Vector(angle.x,angle.y,0)*-800) | |
| end | |
| end | |
| end | |
| end) | |
| function chute_make_Normal(ply) | |
| --Make Player normal | |
| if ply.chuteragdoll then | |
| local pos = ply.chuteragdoll:GetPos() | |
| pos.z = pos.z + 10 | |
| ply:SetParent() | |
| ply.chuteragdoll:Remove() | |
| ply.chuteragdoll = nil | |
| ply:Spawn() | |
| timer.Simple(.05,function() ply:SetPos( pos ) end) | |
| ply.HasChute=false | |
| ply.ChuteOpen=false | |
| if ply.Chute then | |
| ply.Chute:Remove() | |
| end | |
| ply.Chute=nil | |
| timer.Simple(.5,function() ply:EmitSound(Sound("npc/combine_soldier/zipline_clip1.wav"),100,100) end) | |
| ply:StripWeapons() | |
| --local weptbl=ply.CurWeaponsP | |
| --for i=1, #weptbl, 1 do | |
| -- ply:Give(weptbl[i]) | |
| --end | |
| end | |
| end | |
| hook.Add("PlayerDeath","PreventGlitches", | |
| function(ply,wep,killer) | |
| if ply.HasChute then | |
| if ply.chuteragdoll then | |
| ply.chuteragdoll:Remove() | |
| ply.chuteragdoll = nil | |
| end | |
| ply.HasChute=false | |
| ply.ChuteOpen=false | |
| if ply.Chute then | |
| ply.Chute:Remove() | |
| end | |
| ply.Chute=false | |
| end | |
| end) | |
| hook.Add("CanTool","PreventToolingOfRagdoll", | |
| function(ply,tr,tool) | |
| local ent=tr.Entity | |
| if ent.IsChuteDoll then | |
| return false | |
| end | |
| end) | |
| hook.Add("PhysgunPickup","DontLetThemPhysgunPeople", | |
| function(ply,ent) | |
| if ent.IsChuteDoll then | |
| return false | |
| end | |
| end) | |
| hook.Add("PlayerDisconnected","DontLeaveShitBehind", | |
| function(ply) | |
| if ply.Chute then | |
| ply.Chute:Remove() | |
| end | |
| if ply.chuteragdoll then | |
| ply.chuteragdoll:Remove() | |
| end | |
| end) | |
| Error is: | |
| ERROR: GAMEMODE:'PlayerSpawn' Failed: DeathSentence/gamemode/init.lua:53: Attempt to call global 'ChuteSpawn' (a nil value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment