Jump to content

call spectator mode


spAik

Recommended Posts

Hi,

I am trying to adjust a respawn-script to my needs.

Its arezus training script.

Now i want the client to be able to leave this modus and start spectating again...

therefor i tried to use the following command:

function spectator()

clientCall(getLocalPlayer(), "Spectate.start", 'manual' )

end

My question. Is this even the right command to make the client spectate other players?

Link to comment
  
addEventHandler("onClientPlayerWasted", getLocalPlayer(), 
function() 
    if(source ~= getLocalPlayer())then return end 
    reset = true 
    setElementData(getLocalPlayer(), "respawn.playing", false, true) 
    setTimer(function() 
    local statea = getElementData(getLocalPlayer(), "hunterarea.playing") 
    if statea then 
        setElementData(getLocalPlayer(), "hunterarea.playing", false, true) 
        unbindKey("mouse1", "down", cdoshoot) 
        unbindKey("lshift", "down", cdjump) 
        unbindKey("lalt", "down", cdspeed) 
    end 
    end,1500,1) 
    setTimer(function() 
        --local state = getElementData(getLocalPlayer(), "respawn.playing") or true 
            if(running)then 
                showRespawn = true 
                setElementData(getLocalPlayer(), "respawn.playing", false, true) 
                bindKey(RESPAWN_KEY, "up", respawn) 
                bindKey(SPECTATE_KEY, "up", spectator) 
            end 
        end, 
    3000, 1) 
end) 

  
local me = getLocalPlayer() 
function spectator() 
clientCall(me, "Spectate.start", 'manual' ) 
end 

Link to comment
  • Moderators
addEventHandler("onClientPlayerWasted", getLocalPlayer(),

function()

if(source ~= getLocalPlayer())then return end

Why check the local player, when he is the only player that can execute the event?

    function manualSpectate() 
        bindKey(SPECTATE_KEY, "up", spectator) 
    end 

Something like this or what?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...