First Person Death (Personal modification, no reuploading)

I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.I DO NOT TAKE ANY CREDIT FOR THIS CODE.
Ok, I know I have code from an addon, but I just want this for personal use. How would I change this so that it works? again, I acknowledge that this download http://www.garrysmod.org/downloads/?a=view&id=61884 exists and i do not have any intention of reuploading. I just want it so that it works in single player. With that, here goes:

///////////////////////////////////////////////
////// Jinto gets full credit for this code /////
/////////////////////////////////////////////
/

// server
//If you’re hosting a server and have this, but don’t want to send it to joining players, comment out the lines between point1 and point2
//point1
if( SERVER ) then

 AddCSLuaFile( "autorun/fpdeath.lua" );

end
//point2

// client
if( CLIENT ) then

 local function CalcView( pl, origin, angles, fov )

     // get their ragdoll
   local ragdoll = pl:GetRagdollEntity();
   if( !ragdoll || ragdoll == NULL || !ragdoll:IsValid() ) then return; end
   
    // find the eyes
    local eyes = ragdoll:GetAttachment( ragdoll:LookupAttachment( "eyes" ) );
    
     // setup our view
     local view = {
         origin = eyes.Pos,
         angles = eyes.Ang,
		 fov = 90, 
     };
    
      //
     return view;
 
  end
  hook.Add( "CalcView", "DeathView", CalcView );
  
   //

end

Oh, and what’s the symbol/codeword you use to place that neat little text box so lua coding looks all nice and organized?

[noparse][lua][/lua][/noparse] are the tags you’re looking for.

Ok, thanks. Now: needed code modification for proper single player death views? By the way, I heard that it works on multiplayer, never really tried it out.

Here’s a modified version taken from GMDM:

[lua]local LastStrafeRoll = 0
local WalkTimer = 0
local VelSmooth = 0
local DeathSmooth = 0
function GM:CalcView( ply, origin, angle, fov )
if !ply:Alive() then
local rag = ply:GetRagdollEntity()
if !rag then return end
local att = rag:GetAttachment( rag:LookupAttachment(“eyes”) )
if att then
att.Pos = att.Pos + att.Ang:Forward() * 1

		origin = att.Pos
		angle = att.Ang
	end
	fov = 55
end

return self.BaseClass:CalcView(ply,origin,angle,fov)

end
[/lua]

For the record, saying “This was made by Jinto and I take no credit” calmly and one time is enough to put down most naysayers. Shouting it at us that many times is just annoying.

I copied the code directly. The creator himself said “This was made by Jinto”. Thanks anyway.

So you’re saying the creator, who isn’t Jinto, said Jinto is the creator?

Pretty much. The uploader on garrysmod.org is asisel.

Wait, I tried it by putting it in the lua/autorun folder, then these showed up when the game started:

LuaGetfile: Not Loading autorun/first person.lua
Couldn’t include file ‘autorun/first person.lua’ (File not found)

And obviously, I can’t get a first person view of my death.

Try putting it in your autorun/client. Also, never ever put spaces in your file names - it’s bad practice.