Fabioxps Posted April 22, 2013 Share Posted April 22, 2013 I'm using this event in my RACE triggerClientEvent("showNextMapTextx",getRootElement()) just me on the server works perfect when you have more people creates many vehicles and destroy function does not work Client Side local peds = {} function asd() triggerServerEvent( "onCameraStartz",getRootElement(), inici) addEventHandler("onClientRender",root,camera) setTimer ( function() removeEventHandler("onClientRender",root,camera) end ,4000,1) end addEvent("showNextMapTextx",true) addEventHandler("showNextMapTextx",getRootElement(),asd) function camera ( ) for ped,veh in pairs(peds)do local x, y, z = getElementPosition(veh) setCameraMatrix(x+12, y+11, z+4, x, y, z) end end function cameraStarts(ped1) setPedControlState(ped1,"accelerate",true) setTimer(function() setPedControlState(ped1,"accelerate",false) end,800,1) car1 = getPedOccupiedVehicle(ped1) if not peds[ped1] then peds[ped1] = car1 end end addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root, cameraStarts ) Server Side addEvent("onCameraStartz",true) addEventHandler("onCameraStartz",getRootElement(), function() ped1 = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) car1 = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped1, car1 ,0 ) triggerClientEvent("onCameraStart",root, ped1, car1) setTimer( function() destroyElement(car1) destroyElement(ped1) end ,5000,1) end) from already thank you Link to comment
Jaysds1 Posted April 22, 2013 Share Posted April 22, 2013 try this: Client: local peds = {} function camera ( ) for _,ped in ipairs(peds)do local x, y, z = getElementPosition(peds[ped]) setCameraMatrix(x+12, y+11, z+4, x, y, z) end removeEventHandler("onClientRender",root,camera) end addEvent("showNextMapTextx",true) addEventHandler("showNextMapTextx",root,function() triggerServerEvent("onCameraStartz",root) addEventHandler("onClientRender",root,camera) end) addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root,function(ped1,car1) setPedControlState(ped1,"accelerate",true) setTimer(setPedControlState,800,1,ped1,"accelerate",false) if not peds[ped1] then peds[ped1] = car1 end end) Server: addEvent("onCameraStartz",true) addEventHandler("onCameraStartz",root,function() local ped1 = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local car1 = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped1, car1) triggerClientEvent("onCameraStart",root, ped1, car1) setTimer(function() destroyElement(car1) destroyElement(ped1) end,5000,1) end) Link to comment
Fabioxps Posted April 22, 2013 Author Share Posted April 22, 2013 try this:Client: local peds = {} function camera ( ) for _,ped in ipairs(peds)do local x, y, z = getElementPosition(peds[ped]) setCameraMatrix(x+12, y+11, z+4, x, y, z) end removeEventHandler("onClientRender",root,camera) end addEvent("showNextMapTextx",true) addEventHandler("showNextMapTextx",root,function() triggerServerEvent("onCameraStartz",root) addEventHandler("onClientRender",root,camera) end) addEvent( "onCameraStart", true ) addEventHandler( "onCameraStart",root,function(ped1,car1) setPedControlState(ped1,"accelerate",true) setTimer(setPedControlState,800,1,ped1,"accelerate",false) if not peds[ped1] then peds[ped1] = car1 end end) Server: addEvent("onCameraStartz",true) addEventHandler("onCameraStartz",root,function() local ped1 = createPed(0, 138.70454406738, 2491.1267089844, 16.484375) local car1 = createVehicle(411, -73.699996948242, 2506.3999023438, 16.299999237061,0,0,270) warpPedIntoVehicle ( ped1, car1) triggerClientEvent("onCameraStart",root, ped1, car1) setTimer(function() destroyElement(car1) destroyElement(ped1) end,5000,1) end) not working Link to comment
Fabioxps Posted April 22, 2013 Author Share Posted April 22, 2013 poblem fixed thank you Link to comment
Jaysds1 Posted April 22, 2013 Share Posted April 22, 2013 np, and sorry for the late reply, I was at school Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now