Jump to content

[SOLVED] Setting Max Vehicles for each player.


HeK

Recommended Posts

Hello guys, i have a script made by Stanley Sathler a great friend, and in this script you hit the marker a gui pops up and you choose a vehicle, the problem is, i want each player to have a Max of 1 vehicle, or they will spawn the area with vehicles.

-- -------------------------------------------------------- 
-- [x] Author: Stanley Sathler 
-- [x] Function: Spawn vehicle on map 
-- [X] Group: |MS-13| Mara Salvatrucha 
-- -------------------------------------------------------- 
  
function SpawnTheVehicle(model) 
    Vehicle = createVehicle(tonumber(model), 1597, -1705, 5) 
    setVehicleColor(Vehicle, 0) 
    warpPedIntoVehicle(source, Vehicle) 
end 
addEvent("SpawnVehicleOnMap", true) 
addEventHandler("SpawnVehicleOnMap", getRootElement(), SpawnTheVehicle) 

Edited by Guest
Link to comment
-- -------------------------------------------------------- 
-- [x] Author: Stanley Sathler 
-- [x] Function: Spawn vehicle on map 
-- [X] Group: |MS-13| Mara Salvatrucha 
-- -------------------------------------------------------- 
  
local playerVehicles = {}  
  
function SpawnTheVehicle(model) 
    if isElement(playerVehicles[source]) then destroyElement(playerVehicles[source]) end 
    playerVehicles[source] = createVehicle(tonumber(model), 1597, -1705, 5) 
    setVehicleColor(playerVehicles[source], 0) 
    warpPedIntoVehicle(source, playerVehicles[source]) 
end 
addEvent("SpawnVehicleOnMap", true) 
addEventHandler("SpawnVehicleOnMap", getRootElement(), SpawnTheVehicle) 

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...