Jump to content

setCameraTarget not working?


Deltt

Recommended Posts

Hey there,

i'm working on a script and i tried to spawn my player with spawnPlayer and set their cameras behind them with setCameraTarget, but it wont work.

The player always looks to 0 / 360° for about 1 second, then he changes the direction into the rotation in the spawnPlayer command, without setting the camera with him.

Does anyone know how to handle that?

addEvent("SpawnPlayer", true) 
addEventHandler("SpawnPlayer", root, function() 
    skin = getElementModel(client) 
    if(getElementData(client, "Fraction")=="Civilian") then spawnPlayer(client, 1021.8951, -1051.8469, 31.6043, 70, skin) end 
    elseif(getElementData(client, "Fraction")=="LSPD") then spawnPlayer(client, 246.4510, 66.7, 1003.7, 90, skin, 6) end 
    setCameraTarget(client) 
end) 

Link to comment
-- # Server Side 
addEvent("SpawnPlayer", true) 
addEventHandler("SpawnPlayer", root, 
    function (      ) 
    local skin = getElementModel ( client ); 
    if ( getElementData ( client, "Fraction" ) == "Civilian" ) then  
        spawnPlayer( client, 1021.8951, -1051.8469, 31.6043, 70, skin ); 
         setCameraTarget ( client,client ); 
    elseif ( getElementData( client, "Fraction" ) =="LSPD" ) then  
        spawnPlayer( client, 246.4510, 66.7, 1003.7, 90, skin, 6 ); 
        setCameraTarget ( client,client ); 
    end; 
end 
); 

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