Jump to content

[HELP] Give internal ID to vehicle?


John_Scott

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...