Jump to content

Restricted vehicles


Resmurf

Recommended Posts

I want to make people dont even join the car (restricted vehicles) i got this script that kicks people out of the car, but i wanna make it to dont even join.

  
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} 
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 
        cancelEvent() 
        outputChatBox ( "You aren't a Police Officer , you mayn't drive this.", player ) --and tell the player why 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), copenterVehicle ) 

Link to comment

hm make sure you changed the code entirely with mine..

there's no reason why it should "kick" you out of the car now that you're not using removePedFromVehicle anymore..

onVehicleStartEnter gets triggered when the player starts entering the vehicle and afterwards it's cancelled if conditions are matched..

there should be no more entering providing you do meet the "IF" requirements.

make sure u changed the whole code again :S

Link to comment
  
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 ) 
  

there was obvious syntax errors in the tables.

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