• PointShop Thirdperson script doesn't work
    21 replies, posted
[CODE]ITEM.Name = "Third Person" ITEM.Enabled = true ITEM.Description = "Allows you to use Third person Camera." ITEM.Cost = 200 ITEM.Model = "models/weapons/w_toolgun.mdl" ITEM.Functions = { OnGive = function(ply, item) item.Hooks.PlayerSpawn(ply, item) end, OnTake = function(ply, item) ply:SetArmor(ply:Armor() - 100) end } ITEM.Hooks = { PlayerSpawn = function(ply, item) ply:ConCommand("ThirdPersonshop") end } local bBool = false hook.Add("ShouldDrawLocalPlayer", "3rdPersonDraw", function() return bBool end) concommand.Add( "ThirdPersonshop", function() bBool = !bBool if bBool then hook.Add("CalcView", "ThirdPerson", function( pl, origin, angles, fov ) local view = {} view.angles = angles view.fov = fov view.origin = origin + Vector(0, 0, 20) + (angles:Forward() * -90) return view end) else hook.Remove("CalcView", "ThirdPerson") end end)[/CODE] I have no idea why it doesn't work. It doesn't give an error or anything. Some help , please?
This code is for the old PS and not the new one.
Is there a way to make it work in the newer one? I managed to get it work somehow but then it broke again.
I've been messing with my own version of that script for a few hours every day but no luck.. I'll post it here if I get it working.. Gl.
[QUOTE=_Undefined;43182955]This code is for the old PS and not the new one.[/QUOTE] What version is it for? I myself have been struggling to get a thirdperson script working.
[QUOTE=Namdalaz;43183463]What version is it for? I myself have been struggling to get a thirdperson script working.[/QUOTE] gmod 12 pointshop I belib
Isn't the third person con command blocked?
[QUOTE=BFG9000;43184010]Isn't the third person con command blocked?[/QUOTE] Yes. And that's why we make scripts to go thirdperson.
Have this laying around... [code] if ( SERVER ) then function ThirdPersonPlayerSay( Player, Text, Public ) if ( Player:IsValid() ) then if ( string.lower( Text ) == "/thirdperson" ) then Player:ConCommand( "ls_thirdperson 1" ) return "" elseif ( string.lower( Text ) == "/firstperson" ) then Player:ConCommand( "ls_thirdperson 0" ) return "" end end end hook.Add( "PlayerSay", "ThirdPersonPlayerSay", ThirdPersonPlayerSay ) end LsThirdPerson = CreateConVar( "ls_thirdperson", "0", { FCVAR_ARCHIVE } ) if ( CLIENT ) then -- You should only modify the following table values, unless you know what you're doing. local CameraOffset = { -- Allows you to offset the camera however you like. UD = 0, -- Up / Down. Use a positive number for up, negative for right. Default = 0 RL = 0, -- Right / Left. Use a positive number for right, negative for left. Default = 0 FB = -70 -- Forward / Backward. Use a positive number for forward ( Not sure why you would do it ), negative for backward. Default = -88 } function ThirdPersonDrawPlayer() return LsThirdPerson:GetBool() and not ( LocalPlayer():InVehicle() ) or LocalPlayer():IsPlayingTaunt() end hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", ThirdPersonDrawPlayer ) function ThirdPersonCalcView( Player, Origin, Ang, Fov ) if ( LsThirdPerson:GetBool() and not ( Player:InVehicle() ) ) then local TraceData = { } TraceData.start = Player:EyePos() TraceData.endpos = Player:EyePos() + ( Player:GetUp() * CameraOffset.UD ) + ( Player:GetRight() * CameraOffset.RL ) + ( Player:GetForward() * CameraOffset.FB ) TraceData.filter = Player TraceData.mask = MASK_SOLID_BRUSHONLY local Trace = util.TraceLine( TraceData ) local View = { } View.origin = Trace.HitPos + Player:GetForward() * 8 View.angles = Player:GetAngles() View.fov = Fov return View end end hook.Add( "CalcView", "ThirdPersonCalcView", ThirdPersonCalcView ) end [/code] Hope that worked ^ make a lua file with that in named ls_thirdperson and put it in lua/autorun/server Basically, type /firstperson and /thirdperson both self explanatory! <3
[QUOTE=UnknownSir;43184402]Have this laying around... [code] if ( SERVER ) then function ThirdPersonPlayerSay( Player, Text, Public ) if ( Player:IsValid() ) then if ( string.lower( Text ) == "/thirdperson" ) then Player:ConCommand( "ls_thirdperson 1" ) return "" elseif ( string.lower( Text ) == "/firstperson" ) then Player:ConCommand( "ls_thirdperson 0" ) return "" end end end hook.Add( "PlayerSay", "ThirdPersonPlayerSay", ThirdPersonPlayerSay ) end LsThirdPerson = CreateConVar( "ls_thirdperson", "0", { FCVAR_ARCHIVE } ) if ( CLIENT ) then -- You should only modify the following table values, unless you know what you're doing. local CameraOffset = { -- Allows you to offset the camera however you like. UD = 0, -- Up / Down. Use a positive number for up, negative for right. Default = 0 RL = 0, -- Right / Left. Use a positive number for right, negative for left. Default = 0 FB = -70 -- Forward / Backward. Use a positive number for forward ( Not sure why you would do it ), negative for backward. Default = -88 } function ThirdPersonDrawPlayer() return LsThirdPerson:GetBool() and not ( LocalPlayer():InVehicle() ) or LocalPlayer():IsPlayingTaunt() end hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", ThirdPersonDrawPlayer ) function ThirdPersonCalcView( Player, Origin, Ang, Fov ) if ( LsThirdPerson:GetBool() and not ( Player:InVehicle() ) ) then local TraceData = { } TraceData.start = Player:EyePos() TraceData.endpos = Player:EyePos() + ( Player:GetUp() * CameraOffset.UD ) + ( Player:GetRight() * CameraOffset.RL ) + ( Player:GetForward() * CameraOffset.FB ) TraceData.filter = Player TraceData.mask = MASK_SOLID_BRUSHONLY local Trace = util.TraceLine( TraceData ) local View = { } View.origin = Trace.HitPos + Player:GetForward() * 8 View.angles = Player:GetAngles() View.fov = Fov return View end end hook.Add( "CalcView", "ThirdPersonCalcView", ThirdPersonCalcView ) end [/code] Hope that worked ^ make a lua file with that in named ls_thirdperson and put it in lua/autorun/server Basically, type /firstperson and /thirdperson both self explanatory! <3[/QUOTE] This didn't work for me. Whenever I try to do the command in chat it says: "Unknown command: ls_thirdperson"
what is ls_thirdperson? AFAIK the command is simply "thirdperson"
[QUOTE=BFG9000;43188108]what is ls_thirdperson? AFAIK the command is simply "thirdperson"[/QUOTE] I think he was making a separate command so that sv_cheats doesn't have to be set to 1 for players to use it.
ah
Works here for me, thanks UnknownSir Type /thirdperson and /firstperson
You're welcome, are you sure you put it in the correct directory?
[QUOTE=UnknownSir;43184402]Have this laying around... [code] if ( SERVER ) then function ThirdPersonPlayerSay( Player, Text, Public ) if ( Player:IsValid() ) then if ( string.lower( Text ) == "/thirdperson" ) then Player:ConCommand( "ls_thirdperson 1" ) return "" elseif ( string.lower( Text ) == "/firstperson" ) then Player:ConCommand( "ls_thirdperson 0" ) return "" end end end hook.Add( "PlayerSay", "ThirdPersonPlayerSay", ThirdPersonPlayerSay ) end LsThirdPerson = CreateConVar( "ls_thirdperson", "0", { FCVAR_ARCHIVE } ) if ( CLIENT ) then -- You should only modify the following table values, unless you know what you're doing. local CameraOffset = { -- Allows you to offset the camera however you like. UD = 0, -- Up / Down. Use a positive number for up, negative for right. Default = 0 RL = 0, -- Right / Left. Use a positive number for right, negative for left. Default = 0 FB = -70 -- Forward / Backward. Use a positive number for forward ( Not sure why you would do it ), negative for backward. Default = -88 } function ThirdPersonDrawPlayer() return LsThirdPerson:GetBool() and not ( LocalPlayer():InVehicle() ) or LocalPlayer():IsPlayingTaunt() end hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", ThirdPersonDrawPlayer ) function ThirdPersonCalcView( Player, Origin, Ang, Fov ) if ( LsThirdPerson:GetBool() and not ( Player:InVehicle() ) ) then local TraceData = { } TraceData.start = Player:EyePos() TraceData.endpos = Player:EyePos() + ( Player:GetUp() * CameraOffset.UD ) + ( Player:GetRight() * CameraOffset.RL ) + ( Player:GetForward() * CameraOffset.FB ) TraceData.filter = Player TraceData.mask = MASK_SOLID_BRUSHONLY local Trace = util.TraceLine( TraceData ) local View = { } View.origin = Trace.HitPos + Player:GetForward() * 8 View.angles = Player:GetAngles() View.fov = Fov return View end end hook.Add( "CalcView", "ThirdPersonCalcView", ThirdPersonCalcView ) end [/code] Hope that worked ^ make a lua file with that in named ls_thirdperson and put it in lua/autorun/server Basically, type /firstperson and /thirdperson both self explanatory! <3[/QUOTE] Thanks!
[QUOTE=UnknownSir;43189718]You're welcome, are you sure you put it in the correct directory?[/QUOTE] Yep, I did, just doesn't seem to work.
[QUOTE=Namdalaz;43256924]Yep, I did, just doesn't seem to work.[/QUOTE] Just tested, works for me.
[QUOTE=code_gs;43258726]Just tested, works for me.[/QUOTE] Did you have to edit any of the code? Can you PM me exactly what you did to get it working?
[QUOTE=Namdalaz;43259618]Did you have to edit any of the code? Can you PM me exactly what you did to get it working?[/QUOTE] Do what the guy said.. make a lua file with that in named ls_thirdperson and put it in lua/autorun/server
I put it in the lua/autorun/server. Then type /thirdperson and then my console prints out: unkown command ls_thirdperson. Can someone help me?
Hey, to save a step in the code. Remove the ShouldDrawLocalPlayer hook, and inside the CalcView, set view.drawviewer = true; when in thirdperson to draw the localplayer. Saves a step and a few calls per frame.
Sorry, you need to Log In to post a reply to this thread.