John_Scott Posted October 31, 2014 Share Posted October 31, 2014 Hi! I yould like to create a vehicle shop with a duplication protection, so I would like to add an internal ID to every bought vehicle, and when the player spawn that, the scrip remove the old one. (If I buy a Bullet, go away and spawn it, again go away, again spawn it, the script remove the first Bullet) Thanks for the helping! Link to comment
Castillo Posted October 31, 2014 Share Posted October 31, 2014 You can store the vehicles in a table. Link to comment
Woovie Posted November 1, 2014 Share Posted November 1, 2014 Something like this is what I wrote years ago. local vehicles = {} function makeMyCar(player,command,modelid) if vehicles[player] then if vehicles[player][2] then destroyElement(vehicles[player][2]) end vehicles[player][2] = vehicles[player][1] local x,y,z = getElementPosition(player) vehicles[player][1] = createVehicle(modelid,x,y,z) warpPedIntoVehicle(player,vehicles[player][1]) else vehicles[player] = {} vehicles[player][1] = createVehicle(modelid,x,y,z) warpPedIntoVehicle(player,vehicles[player][1]) end end addCommandHandler("vi",makeMyCar) 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