Jump to content

[HELP] Restrict Vehicles to multiple TEAMS


P4RK0UR

Recommended Posts

    local military = {[520]=true, [425]=true, [447]=true,} 
      
    function pAccess (thePlayer, seat) 
    if military[getElementModel(source)] and getTeamName(getPlayerTeam(thePlayer)) ~= "Army" and seat == 0 then 
        cancelEvent() 
        outputChatBox("you are not part of the Military", thePlayer) 
    end 
    end 
    addEventHandler("onVehicleStartEnter",root,pAccess) 

I am so nearly done, i just want to restrict this to MULTIPLE teams.

please can you add AirForce and MARSOC to this script as i don't know how to dot it for more that one.

thank you so much for your time and help. :D

Link to comment
local military = { [ 520 ] = true, [ 425 ] = true, [ 447 ] = true } 
local teams = 
    { 
        [ "Military" ] = true, 
        [ "AirForce" ] = true, 
        [ "MARSOC" ] = true 
    } 
  
function pAccess ( thePlayer, seat ) 
    if ( military [ getElementModel ( source ) ] and not teams [ getTeamName ( getPlayerTeam ( thePlayer ) ) ] and seat == 0 ) then 
        cancelEvent ( ) 
        outputChatBox ( "you are not part of the Military", thePlayer ) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", root, pAccess ) 

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