Jump to content

Script car jacked


Recommended Posts

I wish instead of skins were team, someone could help me? this script makes players who are not the team, do not enter the vehicle

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true } 
policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } 
  
function enterVehicle ( player, seat, jacked ) --when a player enters a vehicle 
    if ( policeVehicles[getElementModel(source)] ) and ( not policeSkins[getElementModel(player)] ) then 
        cancelEvent() 
        outputChatBox ('#F08080[AVISO] #FF0000Este veículo pertence a Gang LEI!',getRootElement(),255,255,255,true) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) 

Link to comment

It's a wiki example -_-"

Put i'll help you :

teams = { 'team1', 'team2' } 
cars = { 240, 320 } 
  
function checkTeam( player ) 
    for k,v in ipairs( teams ) do 
        if getTeamName( getPlayerTeam( player ) ) == v then 
            return true 
        end 
    end 
    return false 
end 
  
addEventHandler( 'onVehicleStartEnter', root, function( player ) 
    for k,v in ipairs( cars ) do 
        if getElementModel( source ) == v then 
            local check = checkTeam( player ) 
            if not check then 
                cancelEvent( ) 
                outputChatBox( '#F08080[AVISO] #FF0000Este veículo pertence a Gang LEI!', root, 255, 255, 255, true ) 
            end 
        end 
    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...