• OBS_MODE_ROAMING Not Working
    6 replies, posted
Spent all day trying to figure this out. I haven't made a lot of spectator addons but there's quite a few people over the past (from what I can gather) half decade who have all experienced this issue: OBS_MODE_ROAMING doesn't work. I can use any other OBS_MODE and it works just fucking fine. SERVER: function GM:PlayerDeath( victim, weapon, killer )       victim:ConCommand("ZedFed")     victim:Spectate( OBS_MODE_ROAMING )     victim:SpectateEntity( killer ) end hook.Add( "PlayerDeath", "playerDeathTest", PlayerDeath) CLIENT: function OnePop()      twoPop = vgui.Create ("DFrame")       twoPop:SetSize(ScrW(),ScrH())     twoPop:Center()     twoPop:SetVisible(true)     twoPop:ShowCloseButton(false)     twoPop:SetDraggable(false)     twoPop:SetTitle("")     twoPop:MakePopup()     twoPop.Paint = function(s,w,h)     draw.RoundedBox(0,0,0,w,h,Color(0,0,0,255))     draw.SimpleText("YOU DIED","DermaDefault",ScrW()/2,ScrH()/2-100,Color(250,100,100),1,1)     end     timer.Simple(10, function()     twoPop:Close() end) end concommand.Add("ZedFed", OnePop) Other Information: Custom Gamemode with "Base" base. All functions are derived from base meaning I have to manually disable things like Noclip (which I've done). I've knocked out a few issues in my script today but this has been driving me insane. The issue is exactly as described here: Weird Spectate / SetObserverMode() You can Hold "S" to propel yourself into the air but you just plummet back down; the only "success" I've had is messing with the gravity and I know that's not how this is intended to work. Any help would be appreciated I've followed the many suggestions found throughout this forum - where people had the same issues.
``` lua_run Entity(1):Kill() Entity(1):Spectate( 6 ) ``` Works for me like a charm.
Yeah works for me too if I just type it into console. But that's not the way it's supposed to work.
It will work if you put it into a Lua file all the same. There's literally no difference.
Weird Spectate / SetObserverMode() https://forum.facepunch.com/f/gmoddev/mipt/Why-isn-t-ply-Spectate-OBS-MODE-ROAMING-working-in-server-side/0/ Simple spectator mode for dead players. Problems That Don't Need Their Own Thread v4 There's obviously a difference. I've tried every one of these solutions. Many people all with varying degrees of experience have had the issue at some point and none of them except RoopeFI have found a solution to the best of my knowledge. At least try the script I provided before dismissing the issue.
First of all, your "SERVER" code is wrong. Have a look at examples on the hook.Add page if you want to use a hook. Your hook.Add call does nothing because it references a non existent function. GM:PlayerDeath is not the same as PlayerDeath. As for the problem you are having, you will want to use either a 0-second timer or a different hook (like PostPlayerDeath) to call Spectate. I suspect the game engine does something to nullify the Spectate() call in PlayerDeath.
I'm sorry I'm just exhausted from trying to figure this out all day. For anyone who stumbles upon this in the future I solved it by using the correct syntax for the hook. hook.Add("PostPlayerDeath","PPDtest", function(_Player)     _Player:Spectate(6) end)
Sorry, you need to Log In to post a reply to this thread.