Jump to content

Restricted Cars


Baseplate

Recommended Posts

well I wanna change this code from using Skins ID to Teams Names

copVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[599]=true } 
copSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[288]=true } 
  
function copenterVehicle ( player, seat, jacked ) 
    if ( copVehicles[getElementModel ( source )] ) and ( not copSkins[getElementModel ( player )] ) and ( seat == 0 ) then 
        removePedFromVehicle ( player )--force the player out of the vehicle 
        outputChatBox ( "You aren't a Police Officer , you mayn't drive this.", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), copenterVehicle ) 

Link to comment
copVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[599]=true } 
copTeam= { ["TeamName"]=true } 
  
function copenterVehicle ( player, seat, jacked ) 
local team = getPlayerTeam(player) 
    if ( copVehicles[getElementModel ( source )] ) and ( not copTeam[getTeamName ( team )] ) and ( seat == 0 ) then 
        removePedFromVehicle ( player )--force the player out of the vehicle 
        outputChatBox ( "You aren't a Police Officer , you mayn't drive this.", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), copenterVehicle ) 

not tested but sould work

Edited by Guest
Link to comment
copVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[599]=true } 
copTeams = {["Team"]=true,["Team2"]=true} 
  
function copenterVehicle ( player, seat, jacked ) 
    if ( copVehicles[getElementModel ( source )] ) and ( not copTeams[getTeamName(getPlayerTeam( player ))] ) and ( seat == 0 ) then 
        removePedFromVehicle ( player )--force the player out of the vehicle 
        outputChatBox ( "You aren't a Police Officer , you mayn't drive this.", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), copenterVehicle ) 

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