Jump to content

(50P SpawnScript Collum) --- Locking cars to 2 classes


jonas13362

Recommended Posts

local vehicle = createVehicle(506, 2100.2697, 1397.4947, 10.3, 0, 0, 0) 
setElementData(vehicle, "HLS", "groupname") 
setElementData(vehicle, "HLS2", "groupname") 
  
addEventHandler("onVehicleStartEnter", root, 
    function(thePlayer, seat, jacked, door) 
        local vehicleOwner = getElementData(source, "HLS") or getElementData(source, "HLS2") 
        local gangGroup = getElementData(thePlayer, "HLS") or getElementData(thePlayer, "HLS2") 
        if (not vehicleOwner) then return end 
        if (gangGroup ~= vehicleOwner) then 
            outputChatBox("This car is locked and belongs to the following class: Admins", thePlayer, 245, 20, 20, false) 
            cancelEvent() 
        end 
    end 
) 

Link to comment
local vehicle = createVehicle(506, 2100.2697, 1397.4947, 10.3, 0, 0, 0) 
setElementData(vehicle, "HLS", {"SWAT HQ", "SWAT Member"}) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(thePlayer, seat, jacked, door) 
        local vehicleOwners = getElementData(source, "HLS") 
        local gangGroup = getElementData(thePlayer, "HLS") 
        if (not vehicleOwners) then return end 
  
        local canUseVehicle = false 
        for i = 1, #vehicleOwners do 
            if gangGroup == vehicleOwners[i] then 
                canUseVehicle = true 
            end 
        end 
  
        if not canUseVehicle then 
            outputChatBox("This car is locked and belongs to the following class: Admins", thePlayer, 245, 20, 20, false) 
            cancelEvent() 
        end 
    end 
) 

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