Jump to content

Team Vehicle not working


Mike269

Recommended Posts

addEventHandler ( "onVehicleStartEnter", root, 
 function ( thePlayer ) 
  -- we should first check if it's a private vehicle. 
  if ( vehicleTable [ source ] ) then 
   -- if it's a private vehicle, get the player's team. 
   local team = getPlayerTeam ( thePlayer ) 
    
   -- if the player has a team, continue. Else, stop the function and avoid the player from entering the vehicle. 
   if ( team ) then 
    -- the player has a team, we should check if it's the right team! 
    if ( team == getTeamFromName ( "Violet Killers MC" ) 
     -- the team from the player matches the required team, he can enter now! 
     outputChatBox ( "Welcome to the vehicle of '".. getTeamName ( team ) .."'", thePlayer, 0, 255, 0, true ) 
    else 
     -- the player is not in the right team, so cancel the event again! 
     outputChatBox ( "This is a private vehicle, you can't enter it.", thePlayer, 255, 0, 0, true ) 
     cancelEvent() 
    end 
   else 
    outputChatBox ( "This is a private vehicle, you can't enter it.", thePlayer, 255, 0, 0, true ) 
    cancelEvent() 
   end 
  end 
 end 
) 

Guys whats wrong here? Can anyone tell me debugscript says: https://fbcdn-sphotos-h-a.akamaihd.net/ ... 2543e26caa

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