Jump to content

Locking cars to teams


Fantanic

Recommended Posts

Hello ,

I found a lock script for more then one user but i want to lock a car to a team / gang / group .

Like that only SWAT can enter that car where it stand. (i dont want to lock police vehicles but only that vehicle where i created it via the script)

+ would be nice if other people could get in as passenger.

Here is the script , as u can see its free to edit : -

Edited by Guest
Link to comment
vehicles = { [598]=true,[596]=true,[597]=true,[599]=true } 
team = { "gang1", "gang2", "gang3" } 
  
function v ( player, seat, jacked ) 
    if ( vehicles[getElementModel(source)] ) and ( not team[getTeamName(player)] ) then 
        cancelEvent() 
        outputChatBox ( "* You're not gang men", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), v ) 

Edited by Guest
Link to comment
vehicles = { [598]=true,[596]=true,[597]=true,[599]=true } 
team = { "gang1", "gang2", "gang3" } 
  
function v ( player, seat, jacked ) 
    if ( vehicles[getElementModel(source)] ) and ( not team[getTeamName(player)] ) then 
        cancelEvent() 
        outputChatBox ( "* You're not gang men", player, 255, 0, 0 ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), v ) 

Erhm i dont rlly get it what to remove and where to place it

EDIT : I only want that LOCAL car locked , not that all the cars are locked to him!

So if i place a car at x y z that only that car is locked for that group / gang / squad.

Please , i need this with emergency.

Link to comment
  • 3 weeks later...

Sorry for my late responds

vehicle1 = createVehicle( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) -----this car can be found at LS Grove Street near PoolBar 
vehicle = createVehicle( modelID, x, y, z, rotX, rotY, rotZ ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
  
    function  lockPrivate( player, seat, jacked ) 
        if ( source == vehicle1 ) then 
            local playerTeam = getPlayerTeam ( source ) 
            local oldTeamName = getTeamName ( playerTeam ) 
            if ( oldTeamName ~= "admin" ) then 
                cancelEvent() 
                outputChatBox("This vehicle is locked for following team: admin ", player, 255, 0, 0, false) 
            else 
                outputChatBox("Welcome to your vehicle,Sir!", player, 0, 255, 0, false) 
            end 
        end 
    end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) 
setVehicleDamageProof(vehicle, true)  -----car won't take damage (change it to false if you want to take damage) 
  
  
-----Made by Alen141(ingame name:Jimboy)------ 
-----Special thanks to : Solidsnake14(ingame name:Castillo)----- 
-----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- 
-----Feel free to edit script on your own----- 
-----Don't remove credits----- 
  
  
  
  

Edited by Guest
Link to comment

sorry i meant some other errors :

vehicle1 = createVehicle( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) -----this car can be found at LS Grove Street near PoolBar 
vehicle = createVehicle( modelID, x, y, z, rotX, rotY, rotZ ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
  
    function  lockPrivate( player, seat, jacked ) 
        if ( source == vehicle1 ) then 
            local playerTeam = getPlayerTeam ( player ) 
            local oldTeamName = getTeamName ( playerTeam ) 
            if ( oldTeamName ~= "admin" ) then 
                cancelEvent() 
                outputChatBox("This vehicle is locked for following team: admin ", player, 255, 0, 0, false) 
            else 
                outputChatBox("Welcome to your vehicle,Sir!", player, 0, 255, 0, false) 
            end 
        end 
    end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) 
setVehicleDamageProof(vehicle, true)  -----car won't take damage (change it to false if you want to take damage) 
  
  
-----Made by Alen141(ingame name:Jimboy)------ 
-----Special thanks to : Solidsnake14(ingame name:Castillo)----- 
-----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- 
-----Feel free to edit script on your own----- 
-----Don't remove credits----- 

Link to comment
vehicle1 = createVehicle ( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) -----this car can be found at LS Grove Street near PoolBar 
vehicle = createVehicle ( modelID, x, y, z, rotX, rotY, rotZ ) 
state = setVehicleDoorState ( vehicle, 1, 1 ) 
setVehicleDamageProof ( vehicle, true )  -----car won't take damage (change it to false if you want to take damage) 
  
function lockPrivate( player, seat, jacked ) 
    if ( source == vehicle1 ) then 
        local playerTeam = getPlayerTeam ( player ) 
        local oldTeamName = ( playerTeam and getTeamName ( playerTeam ) or "" ) 
        if ( oldTeamName ~= "admin" ) then 
            cancelEvent ( ) 
            outputChatBox ( "This vehicle is locked for following team: admin ", player, 255, 0, 0, false ) 
        else 
            outputChatBox ( "Welcome to your vehicle,Sir!", player, 0, 255, 0, false ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) 
  
-----Made by Alen141(ingame name:Jimboy)------ 
-----Special thanks to : Solidsnake14(ingame name:Castillo)----- 
-----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- 
-----Feel free to edit script on your own----- 
-----Don't remove credits----- 

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