DrifteR Posted September 8, 2010 Posted September 8, 2010 Hi , Can someone help me with this? local x,y,z,rx,ry,rz= 0,15,15,0,0,0 function createpirateship(cmd) local lx,ly,lz = getElementPosition(getLocalPlayer()) lx = lx + 5 veh = createVehicle( 484, lx, ly, lz) base = createObject( 8493, 2,2,2) setElementCollisionsEnabled ( base, false ) attachElements ( base, veh, x,y,z,rx,ry,rz) end function rotateIt(cmd, addZ) if(addZ) then rz=rz+addZ setElementAttachedOffsets (base,x,y,z,rx,ry,rz) end end addCommandHandler("pirate", createpirateship) addCommandHandler("rotate", rotateIt) The problem is that after i created the vehicle , i can't drive it. I know im a noob (started to learn lua 2 days ago) Can someone help me correct this problem , and is there any "GetCurrentVehicle" to attach the objects on the vehicle while i'm in it?
Moderators Zango Posted September 8, 2010 Moderators Posted September 8, 2010 Vehicles created clientside can't be driven, because of sync issues. Instead turn this serverside or trigger a server event.
dzek (varez) Posted September 8, 2010 Posted September 8, 2010 Yup, as Zango said - create vehicle on server side. You will need (on clientside) triggerServerEvent and on server: addEvent addEventHandler And for getting vehicle (also remember to check seat - to be sure if player is DRIVING vehicle, not seating as passenger) getPedOccupiedVehicle Useful links: Functions lists: https://wiki.multitheftauto.com/wiki/Cli ... _Functions https://wiki.multitheftauto.com/wiki/Ser ... _Functions Events: https://wiki.multitheftauto.com/wiki/Cli ... ing_Events https://wiki.multitheftauto.com/wiki/Ser ... ing_Events Tutorial: https://wiki.multitheftauto.com/wiki/Scr ... troduction And wiki in general https://wiki.multitheftauto.com/wiki/Main_Page Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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