Jump to content

Privatizar autos


Recommended Posts

-- VARIABLES

	-- TEAM VEHICLES

	local team_vehicles = {}

-- FUNCTIONS

	-- SET TEAM VEHICLE
	
	local function set_team_vehicle( thePlayer, commandName, theTeam )
  		if ( thePlayer ) then
    		local vehicle = getPedOccupiedVehicle( thePlayer )
    		local team = getTeamFromName( theTeam )
    	
    		if ( ( vehicle ) and ( team ) ) then
      			team_vehicles[ vehicle ] = team
      
      			outputChatBox( "Vehículo " .. getElementModel( vehicle ) .. " seteado para el equipo " .. getTeamName( team ), root, 0, 255, 0 ) 
      		end
    	end
  	end

	-- ENTER VEHICLE

	local function handle_enter( thePlayer, theSeat )
  		if ( ( thePlayer ) and ( theSeat ) and ( team_vehicles[ source ] ) ) then
    		local playerTeam = getPlayerTeam( thePlayer )
    		local vehicleTeam = team_vehicles[ source ]
   			
    		if ( playerTeam ~= vehicleTeam ) then
      			outputChatBox( "No puedes subirte a un vehículo de otro equipo. ( " .. getTeamName( vehicleTeam ) .. " )", thePlayer, 255, 0, 0 )
      			cancelEvent()
      		end
    	end
  	end

-- COMMAND HANDLERS

	-- SET TEAM VEHICLE

	addCommandHandler( "setteam", set_team_vehicle )

-- EVENT HANDLERS

	-- ENTER VEHICLE

	addEventHandler( "onVehicleStartEnter", root, handle_vehicle_enter )

Debería servirte para hacerte el sistema según tus necesidades.

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