JeViCo Posted January 2, 2018 Share Posted January 2, 2018 Hi, i have such problem as car definition client-side. Here my spawn part on server-side: function creatVehicleFromPlayerData (model,x,y,z,rx,ry,rz) vehicle = createVehicle(model,x,y,z,rx,ry,rz) if colorR and colorG and colorB then setVehicleColor(vehicle,colorR,colorG,colorB) end end I can't find how can i point at car when it spawns. client-side part: local player = getLocalPlayer ( ) -- get a local player local x, y, z = getElementPosition ( player ) -- retrive the player's position triggerServerEvent("creatVehicleFromPlayerData",getRootElement(),434,x,y,z,rx,ry,rz) setElementVelocity(vehicle,0,0,0) warpPedIntoVehicle(player,vehicle) end SetElementVelocity and warpPedIntoVehicle got nil. Tried to figure it out through admin script, but got nothing. I'm newbie so.... hope for your reply\ Link to comment
Tails Posted January 2, 2018 Share Posted January 2, 2018 Because the vehicle doesn't exist on the client, at least not the variable. Place the 2 functions on the server side in your function under createVehicle. 1 Link to comment
ShayF2 Posted January 3, 2018 Share Posted January 3, 2018 rx,ry,rz are not declared. run it all serverside and use local rx,ry,rz = getElementRotation(player) for those values. 1 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