.:HyPeX:. Posted February 10, 2014 Share Posted February 10, 2014 Hey guys, just got this really weird thing, when i turn it on, the vehicles are in a totally different place... in fact, when i setCameraTarget to the vehicle and i get the target and outputit i get rot 0,0,0 ... No idea what the hell is going on here, script here: local Lugar1 = "Winner" local Lugar2 = "Second" local Lugar3 = "Third" function AnimacionCamara() local LX = 1223.8726806641 local X = 1293.3072509766 local LZ = -8.9970026016235 local Z = 37.882595062256 local LY = -1806.4504394531 local Y = -1861.0502929688 setCameraMatrix(X,Y,Z) local x,y,z = getElementPosition(veh1) setCameraTarget( x, y, z) end function AnimacionAuto() veh1 = createVehicle(411, 1155.6629638672,-1850.1459960938,13.182800292969,0,0,270) veh2 = createVehicle(411, 1147.5030517578,-1853.4709472656,13.182800292969,0,0,270) veh3 = createVehicle(411, 1135.5479736328,-1850.8959960938,13.182800292969,0,0,270) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setPedControlState(ped1, "accelerate", true) setPedControlState(ped2, "accelerate", true) setPedControlState(ped3, "accelerate", true) end function PararAnimacionAuto() end function IniciarAnimacion() LX = 1223.8726806641 X = 1293.3072509766 LZ = -8.9970026016235 Z = 37.882595062256 LY = -1806.4504394531 Y = -1861.0502929688 if not on then on = true AnimacionAuto() fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", getRootElement(), 255,255,255,true) else on = nil PararAnimacionAuto() outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) end end addCommandHandler("gan", IniciarAnimacion, false) Link to comment
myonlake Posted February 10, 2014 Share Posted February 10, 2014 That's most likely because you're creating the vehicles client-side. I suggest switching to server-side and doing whatever you have to client-side. Client-side vehicles have limited features as well, just so you know. Link to comment
.:HyPeX:. Posted February 10, 2014 Author Share Posted February 10, 2014 That's most likely because you're creating the vehicles client-side. I suggest switching to server-side and doing whatever you have to client-side. Client-side vehicles have limited features as well, just so you know. I created client-sided vehicles before with no problem, i need to have them client-sided, and want to know why this is happening.. Link to comment
myonlake Posted February 10, 2014 Share Posted February 10, 2014 If you're not nearby the area where they are spawned, the vehicles are automatically teleported under the map since no one is streaming the vehicles. It's just a big problem sometimes to create entities client-side as they require a streamer. You can make your own streamer system and create all entities from a resource and use it to synchronize elements. I can't see a problem in using the server to make the vehicles. It's not too trustworthy to make them client-side. Link to comment
.:HyPeX:. Posted February 10, 2014 Author Share Posted February 10, 2014 If you're not nearby the area where they are spawned, the vehicles are automatically teleported under the map since no one is streaming the vehicles. It's just a big problem sometimes to create entities client-side as they require a streamer. You can make your own streamer system and create all entities from a resource and use it to synchronize elements.I can't see a problem in using the server to make the vehicles. It's not too trustworthy to make them client-side. They're laggy when used in big quantities, from personal experience, they work alot better in terms of performance in client side. How can i stream them? Link to comment
myonlake Posted February 10, 2014 Share Posted February 10, 2014 You can use setElementStreamable to toggle streaming. This might fix the issue. I also suggest you wrap the spawns inside a onClientResourceStart event, that might have an effect on the issue. Link to comment
.:HyPeX:. Posted February 10, 2014 Author Share Posted February 10, 2014 Yeah, the stream thingy worked, now, i cant destroy them with destroyElement.. and they keep piling up until i reconnect.. any idea? tried to disable the streaming, but nothing. function IniciarAnimacion() if not on then on = true veh1 = createVehicle(411, 1155.6629638672,-1850.1459960938,13.182800292969,0,0,270) setElementStreamable(veh1, false) veh2 = createVehicle(411, 1147.5030517578,-1853.4709472656,13.182800292969,0,0,270) setElementStreamable(veh2, false) veh3 = createVehicle(411, 1135.5479736328,-1850.8959960938,13.182800292969,0,0,270) setElementStreamable(veh3, false) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setPedControlState(ped1, "accelerate", true) setPedControlState(ped2, "accelerate", true) setPedControlState(ped3, "accelerate", true) fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", getRootElement(), 255,255,255,true) else on = nil setElementStreamable(veh1, true) setElementStreamable(veh2, true) setElementStreamable(veh3, true) destroyElement(veh1) destroyElement(veh2) destroyElement(veh3) outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) end Link to comment
Damien_Teh_Demon Posted February 11, 2014 Share Posted February 11, 2014 What you could do is freeze the object and check if the player is near them, and if so unfreeze it. I dont know if thatll work but just an idea Link to comment
myonlake Posted February 11, 2014 Share Posted February 11, 2014 That has nothing to do with this issue. Link to comment
Damien_Teh_Demon Posted February 11, 2014 Share Posted February 11, 2014 That has nothing to do with this issue. The issue is that they are falling through the ground because they are made clientside and the client is not loading those colliders because he is not near it, right? Link to comment
myonlake Posted February 11, 2014 Share Posted February 11, 2014 It won't stream frozen elements if they're not in the streaming distance, it won't fix anything. In addition, the problem was solved by passing in setElementStreamable. 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