Jump to content

Camera Target


Try

Recommended Posts

ooh

Here is my intro script:

  
--MADE BY JESSEUNIT 
--RE-DISTRIBUTE NOT ALLOWED 
--DONT REMOVE THIS TAG 
--©, 2011 
function tuto() 
local guy = getPlayerAccount(source) 
     --If he is new show the intro 
     if (getAccountData(guy,"Achievement: New Guy") == false ) then 
  
   --Spawn the player so he is not stuck 
   spawnPlayer (source, -3255.5166015625+math.random(0,0), 1848.876953125+math.random(0,0), 9.8706741333008, 178.27844238281, math.random(265,312)) 
   setCameraTarget(source, true) 
  
    --Disable HUD 
    showPlayerHudComponent(source, "radar", false) 
    showChat(source, false) 
  
     --Put the camera infront of the house and other stuff 
     fadeCamera(source, false) 
     setTimer(fadeCamera, 4500, 1, source, true) 
     setTimer(setElementPosition, 3000, 1, source, -3255.5166015625+math.random(0,0.5), 1848.876953125+math.random(0,1), 9.8706741333008, 178.27844238281) 
     setTimer(setElementRotation, 3000, 1, source, 0, 0, 178.27844238281) 
     setTimer(setPedAnimation, 4600, 1, source, "ped", "getup_front") 
     setTimer(setPedAnimation, 5750, 1, source, "ped", "IDLE_stance") 
     setTimer(setPedAnimation, 6200, 1, source, "ped", "WALK_civi") 
     setTimer(setCameraMatrix, 4000, 1, source, -3256.9641113281, 1833.8905029297, 13.224102973938, -3256.3107910156, 1850.1762695313, 9.8706741333008, 0, 0) 
      
  
     --He is bored, let him play. 
     setTimer(setElementPosition, 13900, 1, source, -3255.1701660156+math.random(0,0), 1838.9616699219+math.random(0,0), 10.8706741333008, 192.73875427246) 
     setTimer(fadeCamera, 12000, 1, source, false) 
     setTimer(fadeCamera, 15000, 1, source, true) 
     setTimer(setCameraTarget, 14500, 1, source) 
  
     --Enable HUD back 
    setTimer(showPlayerHudComponent, 13900, 1, source, "radar", true) 
    setTimer(showChat, 13900, 1, source, true) 
else 
--if he is NOT new, spawn him. 
outputChatBox("Welcome back!", source, 0, 240, 0, false) 
fadeCamera(source, true) 
spawnPlayer (source, -3255.1701660156+math.random(0,3), 1838.9616699219+math.random(0,3), 9.8706741333008, 192.73875427246, math.random(265,312)) 
setCameraTarget(source, true) 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), tuto) 

I remove this code within 1 week (Due to script stealers, so make sure you copy & paste it)

Link to comment

Humm :\ sorrryy but i think u fail

I need now the camera target at the object then the player login

obj = createObject(1220,0,0,3)

setElementAlpha(obj,0)

setCameraTarget(source,obj)

moveObject(obj,20000,1,1,3)

possitions its exemples

Link to comment

Something like:

Just an example to show you how.

--client side 
addEventHandler("onClientPreRender", root, 
function() 
local x, y, z = getElementPosition(obj) 
setCameraMatrix(0, 0, 0, x, y, z) 
end) 

Here, 0,0,0 are where the camera will stay.

x,y,z are the coords of the object and the camera will keep rotation with the obj, something like exactly what you want.

However, you need to trigger a client event that will add that handler, maybe pass the object somehow.

And then later when the intro is done trigger a client event that will remove the event handler, or just make a timer.

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