Jump to content

[Help] Restrict Vehicles to Skin ID


P4RK0UR

Recommended Posts

    addEventHandler( "onVehicleStartEnter", root, 
        function ( enteringPlayer ) 
            local skin = getElementModel ( enteringPlayer ) 
            if ( getElementModel ( source ) == 520 or 425 ) and not ( skin == 287 or skin == 217 ) then 
                cancelEvent( ) 
          outputChatBox("You must be in Army to enter the vehicle!",enteringPlayer,255,0,0,true) 
            end 
        end 
    ) 

This to me seems fine but when i enter a cop car with a cop it tells me i must be in the Army! WTF? i though this script only counted towards the hydra and the hunter for the admin skin and army skin. Please tell me what i am doing wrong and kindly correct me :D

Link to comment
addEventHandler( "onVehicleStartEnter", root, 
        function ( enteringPlayer ) 
            local skin = getElementModel ( enteringPlayer ) 
            if ( getElementModel ( source ) == 520 or getElementModel ( source ) == 425 ) and not ( skin == 287 or skin == 217 ) then 
                cancelEvent( ) 
          outputChatBox("You must be in Army to enter the vehicle!",enteringPlayer,255,0,0,true) 
            end 
        end 
    ) 
  

Because you use "getElementModel ( source ) == 520 or 425", but it doesn't check the model for both 520 and 425. It checks if the model is 520 and if a VALUE 425 exists (it always does though)

Edited by Guest
Link to comment
addEventHandler ( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        local model = getElementModel ( source ) 
        if ( model == 520 or model == 425 and skin ~= 287 and skin ~= 217 ) then 
            cancelEvent ( ) 
            outputChatBox ( "You must be in Army to enter the vehicle!", enteringPlayer, 255, 0, 0, true ) 
        end 
    end 
) 

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