Jump to content

Locking cars to teams


Fantanic

Recommended Posts

Posted (edited)

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
Posted (edited)
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

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted
  
setVehicleLocked 
getPlayerTeam 
getTeamFromName 
getPedOccupiedVehicle 
  

there are two kinds of people: those who know C++ and those who don´t. .)

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

Posted

To look just one vehicle, then you have to check if the vehicle the player is trying to enter is the one you want.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • 3 weeks later...
Posted (edited)

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
Posted

Yse, that's what I meant.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

But how do i make it locked to it i mean , now their stnds

if not( accountName == "loginusernamehere" ) then

it needs to be : if not( playerteam == "teamhere" ) then

?

Posted

Change:

if not( accountName == "loginusernamehere" ) then 

To:

if ( oldTeamName ~= "team name here" ) then 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local playerTeam = getPlayerTeam ( source ) 

Change 'source' to 'player'.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Posted

What errors are you getting now?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Of what gate are you talking about?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yeah, it seems like it can't be removed using the editor, you'll have to find the object model and do it manually.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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