Jump to content

[REQ] Restrict Vehicle To Skin Or Team


Recommended Posts

I don't usually do any scripts for people that don't try, Cause they'll never learn .

But i'll do it for you this time .

This Well restrict a player that dose not have a certain skin from entering a certain vehicle .

Server :

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        if ( getElementModel ( source ) == carID ) and ( getPlayerSkin ( enteringPlayer ) ~= skinID ) then 
            cancelEvent( ) 
        end 
    end 
) 

Link to comment
I don't usually do any scripts for people that don't try, Cause they'll never learn .

But i'll do it for you this time .

This Well restrict a player that dose not have a certain skin from entering a certain vehicle .

Server :

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        if ( getElementModel ( source ) == carID ) and ( getPlayerSkin ( enteringPlayer ) ~= skinID ) then 
            cancelEvent( ) 
        end 
    end 
) 

Is there ONLY server or client to?

Link to comment
You mean can you do it client side .?

If so, Yes you can, Just change the event into onClientVehicleStartEnter, Change the parameters and it should work .

Here is the script:

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and ( getPlayerSkin ( enteringPlayer ) ~= 285 ) then 
            cancelEvent( ) 
        end 
    end 
) 

This makes the Enforcer Restricted to the Swat skin, and I also want it to allow the 217 (Staff Skin) to be able to go in it to. How will I make that?

Link to comment

Like this?

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
        end 
    end 
) 

Link to comment
Like this?
addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
        end 
    end 
) 

Yes, Perfect, 1 more thing to add to it. If user is not skin it say "You Are Not Part Of The SWAT Team To Enter This Vehicle" please add that

Link to comment

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
      outputChatBox("You Are Not Part Of The SWAT Team To Enter This Vehicle",enteringPlayer,255,0,0,true) 
        end 
    end 
) 
Link to comment
addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
            outputChatBox( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) 
        end 
    end 
) 

EDIT :

LooL, Same time me and Mr.Pres[T]ege :lol:

Link to comment
addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
            outputChatBox( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) 
        end 
    end 
) 

EDIT :

LooL, Same time me and Mr.Pres[T]ege

addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then 
            cancelEvent( ) 
      outputChatBox("You Are Not Part Of The SWAT Team To Enter This Vehicle",enteringPlayer,255,0,0,true) 
        end 
    end 
) 

Sorry If I'm wasting your time but this spams my server and it should show it like every 5 seconds or 3

EDIT: also the skins that have no rights to enter the vehicle should be alowed to enter as passenger please fix.

Link to comment
The msg it will show only if you're trying to enter the vehicle and you aren't on swat skin or staff skin

and what you mean with that -_- you say you just want staff and swat skin can enter the vehicle right? 427

Right, only swat and staff skin can enter enforcer 427 id but other skins should be alowed to enter as passenger.

Link to comment
addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer, seat ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 and seat == 0 ) and not ( skin == 285 or skin == 217 ) then 
            outputChatBox ( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) 
            cancelEvent( ) 
        end 
    end 
) 

Link to comment
addEventHandler( "onVehicleStartEnter", root, 
    function ( enteringPlayer, seat ) 
        local skin = getElementModel ( enteringPlayer ) 
        if ( getElementModel ( source ) == 427 and seat == 0 ) and not ( skin == 285 or skin == 217 ) then 
            outputChatBox ( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) 
            cancelEvent( ) 
        end 
    end 
) 

Works thanks. but it spams my server if they press enter more than 5 times in less than 1 seconds its spam, it should be like 1 time every 3 seconds can you do that plz?

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