Jump to content

Camera lags?


Recommended Posts

Oh yes :) Its a little long but...

Server-Side

function peds() 
if not isElement(RacerPed) then 
RacerPed = createPed (0,2068.4143066406, 1007.5880737305, 10.190197944641) 
end 
if not isElement(RaceVehicle) then 
RaceVehicle = createVehicle (411,2068.4143066406, 1007.5880737305, 10.190197944641,0,0,0) 
warpPedIntoVehicle ( RacerPed, RaceVehicle )   
triggerClientEvent ( "ondrive", getRootElement(),RacerPed) 
end 
end 

Client-Side

function driveit(trped1) 
if trped1 then 
setPedControlState(trped1,"accelerate",true) 
setTimer(function () setPedControlState(trped1,"accelerate",false) end,6000,1) 
startfollow(trped1) 
car = getPedOccupiedVehicle(trped1) 
end 
end 
addEvent( "ondrive", true ) 
addEventHandler( "ondrive", getRootElement(), driveit ) 
  
function follow(trped1) 
local x, y, z = getElementPosition(car) 
setCameraMatrix(x+5, y+12, z+4, x, y, z) 
end 
  
function startfollow(trped1) 
--triggerEvent("stopDrawInfo",getRootElement()) 
addEventHandler("onClientPreRender", getRootElement(),follow) 
setTimer(function()timerTime = timerTime - 1 end, 1000, 7) 
Timer = setTimer(function() fadeCamera ( false, 1.0, 0, 0, 0 ) end, 7000, 1) 
setTimer(function() stopfollow() triggerServerEvent("killracer",getRootElement()) end, 8000, 1) 
setElementDimension ( getLocalPlayer(), 0 ) 
end 
addEvent( "StartFollowing", true ) 
addEventHandler( "StartFollowing", getRootElement(), startfollow ) 

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