Jump to content

Restricted Cars


Baseplate

Recommended Posts

Posted

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 ) 

Posted

create a table for teams. e.g

copTeams = {["Team"]=true,["Team2"]=true}

replace copSkins[getElementModel ( player )] ) with copTeams[getTeamName(getPlayerTeam( player ))]

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

Posted

well is there anyway to make it in place of get in the car and get jacked out of it to if he press Enter he can't get in it and show him at a GUI You aren't a Police Officer , you mayn't drive this.

Posted (edited)

use

addEventHandler ( "onVehicleStartEnter", getRootElement(), copenterVehicle ) 

and

guiCreateWindow 
 guiCreateLabel 
 guiCreateButton 
 guiSetVisible 
showCursor 
 "onClientGUIClick" 

Edited by Guest

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