Jump to content

CameraTarget


Meshare

Recommended Posts

hi guys '

g_Players = getElementsByType("player")        -- get a list of all players in the server 
for i,aPlayer in ipairs(g_Players) do          -- find out what index the local player has in the list 
    if aPlayer == getLocalPlayer() then 
        g_CurrentSpectated = i 
        break 
    end 
end 
  
function spectatePrevious()                    -- decrement the spectate index and spectate the corresponding player 
     if g_CurrentSpectated == 1 then 
         g_CurrentSpectated = #g_Players 
     else 
         g_CurrentSpectated = g_CurrentSpectated - 1 
     end 
    setCameraTarget(g_Players[g_CurrentSpectated]) 
end 
  
function spectateNext()                        -- increment the spectate index and spectate the corresponding player 
     if g_CurrentSpectated == #g_Players then 
         g_CurrentSpectated = 1 
     else 
         g_CurrentSpectated = g_CurrentSpectated + 1 
     end 
    setCameraTarget(g_Players[g_CurrentSpectated]) 
end 
  
-- Bind above functions to arrow keys 
bindKey("arrow_l", "down", spectatePrevious) 
bindKey("arrow_r", "down", spectateNext) 

it is this in my code setCameraTarget for all players '

i want for all players in my team not all players in server '

thanks '

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...