--pavetr.top/ds CreateClientConVar("mw3spawneffect_customrank","PVT",true,false,"Custom Rank you can set") CreateClientConVar("mw3spawneffect_enabled",1,true,false,"Enabled") local spawneffect = false local lastpos local playerview local playerangle local uptrace local limitrun = false local limitsaveview = false local lerpup = 0 local lerpdown = 0 local lerpangledown = 0 local lerpanglenormal = 0 local wait = true local waitime = CurTime() hook.Add("CalcView","playerspawningvieweffect",function(ply,origin,angles,fov,znear,zfar) if GetConVar("mw3spawneffect_enabled"):GetInt() == 0 then return end if !ply:Alive() then if !limitsaveview then limitsaveview = true lastpos = origin end spawneffect = true local view = { origin = lastpos, angles = angle, fov = fov , znear = znear, zfar = zfar, drawviewer = true } return view end if ply:Alive() and spawneffect then if !limitrun then limitrun = true limitsaveview = false uptrace = util.TraceLine({start = ply:EyePos(),endpos = ply:EyePos()+Vector(0,0,500000),filter = self, collisiongroup = COLLISION_GROUP_DEBRIS}) lerpdown = 0 lerpup = 0 lerpanglenormal = 0 wait = true end playerangle = angles playerview = LerpVector(lerpup,lastpos,uptrace.HitPos) playerangle = LerpAngle(lerpup,angles,Angle(90,0,0)) if lerpup >= 1 then uptrace = util.TraceLine({start = ply:EyePos(),endpos = ply:EyePos()+Vector(0,0,500000),filter = self,collisiongroup = COLLISION_GROUP_DEBRIS}) playerview = LerpVector(lerpdown,uptrace.HitPos,origin) playerangle = LerpAngle(lerpanglenormal,Angle(90,0,0),angles) if wait then wait = false waitime = CurTime()+0.6 timer.Simple(0.1,function() ply:EmitSound("mw3_spawneffect/viewin"..math.random(1,2)..".wav") end) end if CurTime() > waitime then if lerpdown >= 0.5 then lerpanglenormal = lerpanglenormal + 0.04 end if lerpdown >= 1 then limitrun = false spawneffect = false LocalPlayer():ViewPunch( Angle(10,0,0) ) DisplayOperationInfo() end lerpdown = lerpdown + 0.02 else playerview = uptrace.HitPos end end lerpup = lerpup + 0.02 local view = { origin = playerview, angles = playerangle, fov = fov , znear = znear, zfar = zfar, drawviewer = true } return view end end) -- HOOK END function TypeInOperation(text, font, x, y, color, xAlign, time, typeintime,index) local finaltext = "" local endtime = CurTime()+time local characters = text local line = 1 local typetime = 0.1 if typeintime then typetime = typeintime end local num = index timer.Create("mw3_typeinnumbers"..num,typetime,#characters,function() finaltext = finaltext..characters[line] LocalPlayer():EmitSound("mw3_spawneffect/texttype.wav",80,100,0.03) line = line + 1 end) -- hook.Add('HUDPaint','mw3_typeindraw'..num,function() if CurTime() > endtime then if !timer.Exists("mw3_untype"..num) then local a = 1 timer.Create("mw3_untype"..num,typetime,#characters,function() finaltext = string.Trim(finaltext,characters[line]) line = line - 1 a = a + 1 LocalPlayer():EmitSound("buttons/button16.wav",80,100,0.01) if a == #characters then hook.Remove('HUDPaint','mw3_typeindraw'..num) end end) end end draw.DrawText(finaltext,font,x,y,color,xAlign) end) end function spawnDrawDate(font, x, y, color, xAlign, time, typeintime,index) local finaltext = "" local endtime = CurTime()+time local characters = "Day " local line = 1 local typetime = 0.1 if typeintime then typetime = typeintime end local num = index timer.Create("mw3_typeinnumbers"..num,typetime,#characters,function() finaltext = finaltext..characters[line] LocalPlayer():EmitSound("mw3_spawneffect/texttype.wav",80,100,0.03) line = line + 1 end) hook.Add('HUDPaint','mw3_typeindraw'..num,function() if CurTime() > endtime then if !timer.Exists("mw3_untype"..num) then local a = 1 timer.Create("mw3_untype"..num,typetime,#characters,function() finaltext = string.Trim(finaltext,characters[line]) line = line - 1 a = a + 1 LocalPlayer():EmitSound("buttons/button16.wav",80,100,0.01) if a == #characters then hook.Remove('HUDPaint','mw3_typeindraw'..num) end end) end end local date = os.date( "%d - %X") draw.DrawText(finaltext..date,font,x,y,color,xAlign) end) end function GetLargestString(tbl) local strings = {} local largestsofar for k,v in ipairs(tbl) do if !largestsofar then largestsofar = #v else if #v > largestsofar then largestsofar = #v end end end for k,v in ipairs(tbl) do if #v == largestsofar then table.insert(strings,v) end end return strings end function DisplayOperationInfo() spawnDrawDate("Trebuchet24", ScrW()/60, ScrH()/1.4, Color(150,255,150), TEXT_ALIGN_LEFT, 6, 0.1,3) TypeInOperation(GetConVar("mw3spawneffect_customrank"):GetString().." "..LocalPlayer():GetName(), "Trebuchet24", ScrW()/60, ScrH()/1.35, Color(150,255,150), TEXT_ALIGN_LEFT, 6, 0.1,1) local mapname = game.GetMap() local short = string.Explode("_",mapname) local operation = GetLargestString(short) local operationname = operation[math.random(#operation)] local firstletter = string.Left( operationname, 1) local trimmed = string.TrimLeft(operationname, firstletter) local upper = string.upper(firstletter) local finaloperation = upper..trimmed TypeInOperation("Operation: "..finaloperation, "Trebuchet24", ScrW()/60, ScrH()/1.3, Color(150,255,150), TEXT_ALIGN_LEFT, 6, 0.1,2) end