• cam_attacheyes
    1 replies, posted
I remember, a while back, I saw a thread called "Realistic First person" or something like that. CapsAdmin posted a lua script that attaches your camera to your playermodel's eyes. Since the search is down, I can't find the thread. So, could somebody post the lua? Thanks in advance
This? [QUOTE=CapsAdmin;15686892][lua]AddCSLuaFile("autorun/cam_eyeattachment.lua") if CLIENT then CreateClientConVar("cam_eyeattachment_fov", 90) hook.Add("CalcView", "cam_eyeattachment", function(Player, Position, Angles, FOV) if Player:GetNWInt("Cam_EyeAttachmentToggle") < 1 then return end Player:DrawModel() local Angles = Player:GetAimVector():Normalize():Angle() local Position = Player:GetAttachment(Player:LookupAttachment("eyes")).Pos FOV = GetConVar("cam_eyeattachment_fov"):GetFloat() return GAMEMODE:CalcView(Player, Position, Angles, FOV) end) end if SERVER then function CamEyeAttachment(Player) if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 1 then CamEyeAttachmentDisable(Player) else CamEyeAttachmentEnable(Player) end end concommand.Add("cam_attacheyes", CamEyeAttachment) function CamEyeAttachmentEnable(Player) if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 1 then return end local Entity = ents.Create("prop_dynamic") Entity:SetModel("models/props_lab/huladoll.mdl") Entity:Spawn() Entity:DrawShadow(false) Entity:SetMoveType(MOVETYPE_NONE) Entity:SetNotSolid(true) Entity:SetPos(Player:GetPos()) Entity:SetParent(Player) Entity:SetColor(0,0,0,0) Player:SetViewEntity(Entity) Player:SetNetworkedInt("Cam_EyeAttachmentToggle", 1) end function CamEyeAttachmentDisable(Player) if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 0 then return end local Entity = Player:GetViewEntity() Player:SetNetworkedInt("Cam_EyeAttachmentToggle", 0) Player:SetViewEntity(Player) Entity:Remove() end end[/lua] Looks like crap, but oh well. goes in autorun/cam_eyeattachment.lua [B]filename is important[/B] [img_thumb]http://errur.com/i/images/9929_wireconstruct_sounds0024.jpg[/img_thumb] [/QUOTE]
Sorry, you need to Log In to post a reply to this thread.