Koyax998 Posted May 6, 2013 Share Posted May 6, 2013 I have a script which is supposed to create a plane and set it's Z vector gravity high so it can't take off. Now here's the problem, in order to set the vehicles gravity I need to use setVehicleGravity function which is client sided only. Therefore I have to create a client-sided vehicle.. And that's where the problem arrives: The client sided vehicles are unenterable and undestructive... As an alternative I tried using warpPlayerIntoVehicle function but it is server-side function only. And now I am stuck, I don't know what to do, but the best solution would be to somehow create the vehicle server sided because I would like others to see it and somehow change the other part. Basically my question is: How do I make server-sided vehicle and change it's gravity? If it helps anyhow, this is the client sided code I wrote in order to create vehicle and change the gravity: function createPlane() local guy = getLocalPlayer() plane = createVehicle (577, -1635.5999755859, -142.30000305176, 14.800000190735, 0, 0, 316 ) setVehicleGravity(plane, 0.008, 0.008, -10) end addCommandHandler ("go", createPlane) Thanks in advance, Koyax Link to comment
Koyax998 Posted May 6, 2013 Author Share Posted May 6, 2013 triggerServerEvent ? What? Can you explain a bit more? Link to comment
Moderators IIYAMA Posted May 6, 2013 Moderators Share Posted May 6, 2013 (edited) Why don't you go reading what triggerServerEvent is? and maybe also take a close look at the wiki sample. To send information back. triggerClientEvent Edited May 6, 2013 by Guest Link to comment
DiSaMe Posted May 6, 2013 Share Posted May 6, 2013 If server and client scripts were completely separate, the latter ones would be nearly useless. But since client-side scripts can use all elements the client sees and server-side elements are visible for client, you can use functions on server-side elements in client-side scripts. The general ways to transfer the data between server and client are custom events and element data: addEvent addEventHandler triggerServerEvent triggerClientEvent setElementData getElementData When you cross-trigger the event on one side, the handler functions for that event on the other side will be called. You can pass the data as additional arguments and it will be transfered to another side. Element data is a simpler way to synchronize data: whatever you set on server/client becomes automatically synced for server and all clients unless you set the synchronize argument to false. Also, you can set the synced identifier and use it to get the element on the client: setElementID getElementByID Link to comment
Koyax998 Posted May 6, 2013 Author Share Posted May 6, 2013 Ok, thank you for the replies, please keep the topic open since I might be asking some more additional questions in case something doesn't work. 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