Jump to content

[HELP]My small script is not working.


Z-Dash

Recommended Posts

Hello,My small cient sided script isn't working

script job:Air Force team can enter vehicles other teams cant..

function AFVeh(thePlayer) 
  if getTeamName(getPlayerTeam(getLocalPlayer())) =~ "Air Force" then 
   outputChatBox("This vehicle is for the Air Force Team!", 0, 100, 0 ) 
   cancelEvent() 
  end 
 end 
end 
addEventHandler("onClientVehicleStartEnter", getRootElement(), AFVeh) 

Link to comment
addEventHandler("onClientVehicleStartEnter",getRootElement(),function() 
    local plrTeam = getPlayerTeam(getLocalPlayer()) 
    if ( plrTeam ) then 
        if ( getTeamName(plrTeam) ~= "Air Force" ) then 
            outputChatBox("This vehicle is for the Air Force Team!", 0, 100, 0 ,true) 
            cancelEvent() 
        end 
    end 
end) 

Link to comment

With that, the message will appear to the local player even if a remote player tries to enter, as far as I know.

addEventHandler ( "onClientVehicleStartEnter", root, 
    function ( thePlayer ) 
        if ( thePlayer == localPlayer ) then 
            local plrTeam = getPlayerTeam ( localPlayer ) 
            if ( plrTeam ) then 
                if ( getTeamName ( plrTeam ) ~= "Air Force" ) then 
                    outputChatBox ( "This vehicle is for the Air Force Team!", 0, 100, 0 ,true ) 
                    cancelEvent ( ) 
                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...