• Ghosting A Player
    1 replies, posted
I was wondering if anyone would be able to help me out here. I would like to have a code that when a player dies, the screen turns a transparent red and all your weapons are stripped for 60 seconds. Your walk speed is slowed and you can chat only with team chat. I am willing to pay anyone who is able to do this. Add me for more info and payment info. [editline]5th July 2012[/editline] This is already taken by [x]Collision! [highlight](User was banned for this post ("Wrong section" - Gran PC))[/highlight]
[lua]if SERVER then AddCSLuaFile("ghosts.lua") end hook.Add("PlayerDeath", "OnRagdollController", function(ply, weapon, killer) ply:UnLock() ply:Freeze(false) ply:SetSolid(SOLID_NONE) -- ply:Spectate(OBS_MODE_ROAMING) ply:SetMoveType(MOVETYPE_FLYGRAVITY) -- ply.RealAlive = ply.Alive -- function _R.Player:Alive() -- return true -- end local timerid = ply:SteamID() .. "_dead" timer.Create(timerid,0,0,function() if( ply:Alive() ) then -- ply.Alive = ply.RealAlive timer.Destroy(timerid) return end end) end ) if CLIENT then function DeathScreen() DrawMaterialOverlay( "models/props_lab/Tank_Glass001", 0.1 ) end hook.Add("OnEntityCreated", "OnRagdollCreate", function(ent) if(!ent or !ent:IsValid()) then return end local c=ent:GetClass() if c=="class C_HL2MPRagdoll" then -- print("Death ragdoll: ", ent) local ply = nil ent:SetCollisionGroup(COLLISION_GROUP_NONE) ent:SetSolid(SOLID_NONE) -- ent:SetMoveCollide(MOVECOLLIDE_DEFAULT) for k,v in pairs(player.GetAll()) do if v:GetRagdollEntity() == ent then ply = v end end if( ply == nil ) then print("WHAT THE?! ply == nil") return end local timerid = ply:SteamID() .. "_dead" local moveparts = {} ent:SetColor(0,255,0,200) /* eyes lefteye righteye nose mouth amulet chest hips lefthand righthand pouch1 pouch2 physgun_attachment emp emp_LH Emp_Holster R_shoulderBladeAim L_shoulderBladeAim forward anim_attachment_RH anim_attachment_LH */ /* 0 = pelvis 1 = chest 2 = right upper arm 3 = left upper arm 4 = left forearm 5 = left hand 6 = right forearm 7 = right hand 8 = right thigh 9 = right calf 10 = head 11 = left thigh 12 = left calf 13 = left foot 14 = right foot */ moveparts[10] = {"eyes", false, Angle(180,0,0)} moveparts[1] = {"chest", true, Angle(-60, 0,0)} moveparts[5] = {"left hand", false, Angle(0,0,0)} moveparts[7] = {"right hand", false, Angle(0,0,0)} moveparts[13] = {"left foot", false, Angle(0,0,0)} moveparts[14] = {"right foot", false, Angle(0,0,0)} local shakeparts = {} shakeparts[13] = Vector(100,100,1) shakeparts[14] = Vector(100,100,1) shakeparts[5] = Vector(0,0,100) shakeparts[7] = Vector(0,0,100) timer.Create(timerid, 0, 0,function() if( !ent:IsValid() ) then timer.Destroy(timerid) return end local i = 0 while i < ent:GetPhysicsObjectCount() do local pobj = ent:GetPhysicsObjectNum(k) pobj:Wake() i=i+1 end for k,v in pairs(moveparts) do local attachmentid = ply:LookupAttachment(v[1]) local attachment = ply:GetAttachment(attachmentid) if( attachment != nil ) then local pobj = ent:GetPhysicsObjectNum(k) pobj:SetVelocity((attachment.Pos - pobj:GetPos()) * pobj:GetMass()) pobj:Wake() if( v[2] == true ) then local ang = pobj:GetAngle() ang.y = ply:EyeAngles().y + 180 pobj:AddAngleVelocity(-pobj:GetAngleVelocity( ) + ang) end end end for k,v in pairs(shakeparts) do local pobj = ent:GetPhysicsObjectNum(k) if( pobj ) then pobj:SetVelocity(Angle(math.sin(CurTime()) * 50, math.cos(CurTime()) * 50, math.sin(CurTime()) * 50) * v) end end ent:SetPos(ply:GetPos()) end) end end ) end[/lua] Quite old and sloppy script but does the job
Sorry, you need to Log In to post a reply to this thread.