Xeno Posted January 14, 2012 Share Posted January 14, 2012 How would you like, make a table that spawns cars..? Like this.. carpos = {[carid,[carx],[cary],[carz],[carrotation]} It would be cool if you could help me. Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 local vehicles = { {model=411, x=0, y=0, z=3, rot=0} } for index, vehicle in ipairs(vehicles) do createVehicle(vehicle.model, vehicle.x, vehicle.y, vehicle.z, 0, 0, vehicle.rot) end Link to comment
Xeno Posted January 14, 2012 Author Share Posted January 14, 2012 Sorry for the double post, but how would I get a car if it was like myVehicle = createVehicle(Ect) -- Would I use this?> if vehicle == myVehicle then Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 I don't get what do you mean. Link to comment
Xeno Posted January 15, 2012 Author Share Posted January 15, 2012 Like, if I were to enter a certain car, and if that vehicle was the one spawned like this: myvehicle = createVehicle It would output a chat box message. If I use onClientVehicleEnter it will output the text when you enter any vehicle, I need it so it only outputs the text when you enter myVehicle Link to comment
mjau Posted January 15, 2012 Share Posted January 15, 2012 myVehicle = createVehicle function enter() if source == myVehicle then outputChatBox("You have entered the vehicle") end end addEventHandler("onClientVehicleEnter", getRootElement(), enter) Link to comment
Xeno Posted January 15, 2012 Author Share Posted January 15, 2012 Sorry for the double post, again ( I dont want to make a new topic for such a small problem..) But I cant seem to enter the vehicle if its been made on the table??? Please help D: Link to comment
Castillo Posted January 16, 2012 Share Posted January 16, 2012 Post your script code. Link to comment
TAPL Posted January 16, 2012 Share Posted January 16, 2012 Sorry for the double post, again ( I dont want to make a new topic for such a small problem..) But I cant seem to enter the vehicle if its been made on the table??? Please help D: this because you're using createVehicle from client side , if you using them server side you will be able to enter the vehicle. Link to comment
FatalTerror Posted January 16, 2012 Share Posted January 16, 2012 Sorry for the double post, again ( I dont want to make a new topic for such a small problem..) But I cant seem to enter the vehicle if its been made on the table??? Please help D: Like that ? local vehicles = { {model=411, x=0, y=0, z=3, rot=0} } addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index, vehicle in ipairs(vehicles) do local car = createVehicle(vehicle.model, vehicle.x, vehicle.y, vehicle.z, 0, 0, vehicle.rot) addEventHandler("onVehicleEnter", getRootElement(), function() if(source == car)then outputChatBox("You have entered the vehicle") end end) end end) 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