KatastrofaS Posted March 10, 2016 Share Posted March 10, 2016 How to get the coordinates of non streamable Vehicle? This is required on the server side. Link to comment
Captain Cody Posted March 10, 2016 Share Posted March 10, 2016 https://wiki.multitheftauto.com/wiki/GetElementPosition .... Link to comment
KatastrofaS Posted March 11, 2016 Author Share Posted March 11, 2016 It's a bad answer: when my train goes to another station, getElementPosition at some point unchanged gives the coordinates (the point where the train left me visible region). Link to comment
Captain Cody Posted March 11, 2016 Share Posted March 11, 2016 Attach a blip to it, and get cords of the blip. Link to comment
pro-mos Posted March 12, 2016 Share Posted March 12, 2016 triggerServerEvent ( event, theElement, positionX, positionY, posZ) and then use this server side addEvent("event") then make use of the position with an event handler.. Link to comment
KatastrofaS Posted March 12, 2016 Author Share Posted March 12, 2016 But I made it complicated: Server local root = getRootElement() local freight = createVehicle(537,2285,-1285,25.7) addEvent("toserver",true) addEventHandler("toserver",root, function(driver) triggerClientEvent(driver,"toclient",root,freight) end) addEvent("xyz",true) addEventHandler("xyz",root, function(x,y,z) outputChatBox(" " .. x .. " " .. y .. " " .. z ) end) setTimer(function() setTrainSpeed(freight,0.5) end,200,0) Client local root = getRootElement() addEventHandler("onClientVehicleEnter",root, function(player) if player == localPlayer then triggerServerEvent("toserver",root,player) end end) addEvent("toclient",true) addEventHandler("toclient",root, function(freight) setElementStreamable(freight,false) setTimer(function() triggerServerEvent("xyz",root,getElementPosition(freight)) end,300,0) end) What did I do wrong? Link to comment
pro-mos Posted March 13, 2016 Share Posted March 13, 2016 Server local freight = createVehicle(537,2285,-1285,25.7) addEventHandler("onVehicleEnter",root, function(driver) triggerClientEvent(driver,"toclient",root,freight) end) addEvent("xyz",true) addEventHandler("xyz",root, function(x,y,z) outputChatBox(" " .. x .. " " .. y .. " " .. z ) end) setTimer(function() setTrainSpeed(freight,0.5) end,200,0) Client addEvent("toclient",true) addEventHandler("toclient",root, function(freight) setElementStreamable(freight,false) setTimer(function() triggerServerEvent("xyz",root,getElementPosition(freight)) end,300,0) end) this would spam the chat with the train position, no matter what car you enter and even when you exit the train Link to comment
KatastrofaS Posted March 13, 2016 Author Share Posted March 13, 2016 Thanks, the problem is solved. I hope and maybe solution to a purely server-side, when there is no connected client? Link to comment
pro-mos Posted March 15, 2016 Share Posted March 15, 2016 Thanks, the problem is solved.I hope and maybe solution to a purely server-side, when there is no connected client? If there's no clients connected then you dont need to setElementStreamable() So there is no point of making that server side only 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