Jump to content

Plice cars only usable from cops


Dardex

Recommended Posts

Posted

Hey guys I would like to ask if there is any script that allows only cops to enter in Police cars, if not is there any way to create it.

Posted
Prestage if i want it only for groups not for skin is it possible

What do you mean by groups ?!

Is are they in teams or aclGroup or data ?

Posted

Sorry i mean for teams I created Police team.And if it is possible that police cars can be usable only from Police team.

Posted

Try this:

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

Posted
Try this:
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root ) 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'POLICE' then 
                cancelEvent() 
            end 
        end 
    end 
) 

forgot to close addEventHandler but now it says "" expected near "(" and script failed to start

Posted
Try this:
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root ) 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'POLICE' then 
                cancelEvent() 
            end 
        end 
    end 
) 

forgot to close addEventHandler but now it says "" expected near "(" and script failed to start

No he just forget comma .

Posted
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

Can you fix this :/

Posted (edited)
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

Can you fix this :/

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
) 

just a comma .

Edited by Guest
Posted
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

i did this but look what it says:

')' expected (to close '(' at line 3) near 'end'

Posted
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

i did this but look what it says:

')' expected (to close '(' at line 3) near 'end'

That's because there'a an extra end remove one .

Posted

There's an extra end. Use this code:

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
) 

Posted
policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
    end 
) 

i did this but look what it says:

')' expected (to close '(' at line 3) near 'end'

dude, there is function and if

and you put 3 ends under

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; 
  
addEventHandler ( 'onVehicleStartEnter', root, 
    function( player ) 
            if policeVehicles[ getElementModel( player ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then 
                cancelEvent() 
            end 
        end 
) 

try it

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