Jump to content

Plice cars only usable from cops


Dardex

Recommended Posts

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 
) 

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

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

Link to comment
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 :/

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

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

Link to comment

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 
) 

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

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