Jump to content

vehicleavoidenter


xArgonx

Recommended Posts

I want to make a system that player avoid from using every car, the problem is, that i want that this system only works for the door 0 (driver seat) so a player who should not be allowed to enter on the driver's sead atlhought he can enter on the other seats

here is the code i tried it out:

ambulanceVehicles = { [416]=true } 
  
ambulanceSkins = {[274]=true, [276]=true} 
  
doors = {[0]=true} 
function enterAmbulanceVehicle ( player, seat, jacked, door ) 
    if ( ambulanceVehicles[getVehicleID ( source )] ) and ( not ambulanceSkins[getPlayerSkin ( player )] ) and if (doors[ then  
    [color=#BF0000]if door == 0[/color] 
  
         cancelEvent() 
            outputChatBox ( "Du darfst dieses vehicle nicht benutzen!", player, 255, 255, 255, true) 
    end 
    end 
end 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterAmbulanceVehicle )  
  

Link to comment

Why don't you check if you get any errors? At line 7, the code doesn't seem to be finished or messed up. Make sure you don't get any errors. Line 8 also doesn't seem to be done. It will work if you'll keep an eye on all these brackets and "if ... then" not just "if ... ".

Link to comment
ambulanceVehicles = { [416]=true } 
  
ambulanceSkins = {[274]=true, [276]=true} 
  
function enterAmbulanceVehicle ( player, seat, jacked, door ) 
    if ( ( ambulanceVehicles[getVehicleID ( source )] ) and ( not ambulanceSkins[getPlayerSkin ( player )] ) and ( door == 0 ) ) then 
        cancelEvent() 
        outputChatBox ( "Du darfst dieses vehicle nicht benutzen!", player, 255, 255, 255, true) 
    end 
end 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterAmbulanceVehicle )  

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