BlockFighter Posted September 17, 2018 Share Posted September 17, 2018 Hi! My problem is that on the client side the object is seen by only one person who has tried it out and I want everyone to see the object on the server. Client Side: local rx,ry,rz = getElementPosition(getElementData(localPlayer,"cage")) local cx,cy,cz = getVehicleComponentPosition(getElementData(localPlayer,"cage"),"static_p01") local x,y,z = rx + cx, ry + cy+3, 0.8 local a,b = getScreenFromWorldPosition(x,y,z) local magnet = createObject(1301, rx-0.6, ry-5, rz+4, 0, 0, 0) setObjectScale(magnet, 0.3) setElementCollisionsEnabled(magnet, false) moveObject(magnet, 1000*60*1, rx-0.6, ry-5, rz-50) setTimer(function() destroyElement(magnet) local magnet2 = createObject(1301, rx-0.6, ry-5, rz-50, 0, 0, 0) setObjectScale(magnet2, 0.3) setElementCollisionsEnabled(magnet2, false) moveObject(magnet2, 1000*60*1, rx-0.6, ry-5, rz+4) local crate = createObject(1224, rx-0.6, ry-5, rz-50.3, 0, 0, 0) moveObject(crate, 1000*60*1, rx-0.6, ry-5, rz+3.3) setElementCollisionsEnabled(crate, false) setTimer(function() usedMagnet = false end, 1000*60*1, 1) end, 1000*60*1, 1) In principle I should only use this server site: setElementVisibleTo Link to comment
JeViCo Posted September 17, 2018 Share Posted September 17, 2018 if you created an element client-side you're not able to make it visible for other players - you can only create same object for others. I recommend you to create it server-side and manage it using setElementVisibleTo and SetElementCollidableWith + onClientElementStreamIn/out functions @BlockFighter Link to comment
BlockFighter Posted September 17, 2018 Author Share Posted September 17, 2018 But this is the problem that the "getScreenFromWorldPosition", "getVehicleComponentPosition" client side and I can not write it to server pages because it issues a error. Link to comment
JeViCo Posted September 17, 2018 Share Posted September 17, 2018 (edited) 1 hour ago, BlockFighter said: But this is the problem that the "getScreenFromWorldPosition", "getVehicleComponentPosition" client side and I can not write it to server pages because it issues a error. you should use setElementData ( set it server-side to make it synced using triggerServerEvent function), add onClientElementStreamIn to create an object, read any information using getElementData, remove object using onClientElementStreamOut AND onClientElementDestroy when the car disappears 100% works (custom vehicle wheels experience) Edited September 17, 2018 by JeViCo 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