Team = createTeam("Taxi Driver", 0, 255, 0)
busTeams = { [Team] = true }
busVehs = { [420] = true }
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle
if getElementType ( thePlayer ) == "player" then
if ( busVehs[getElementModel ( source )] ) and ( not busTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin
removePedFromVehicle( thePlayer )-- force the player out of the vehicle
outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer)
end
end
end
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle )
markers = { }
blips = { }
peds = { }
function inVEH ( thePlayer )
if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then
if ( getElementModel ( source ) == 420 ) then
local x, y, z = unpack ( dropoffs [ math.random ( #dropoffs ) ] )
markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 )
local skins = unpack ( pedCus [ math.random ( #pedCus ) ] )
peds [ thePlayer ] = createPed( skins, x, y, z )
blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 )
addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit )
end
else
if ( isElement ( markers [ thePlayer ] ) ) then
destroyElement ( markers [ thePlayer ] )
end
if ( isElement ( blips [ thePlayer ] ) ) then
destroyElement( blips [ thePlayer ] )
end
end
end
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH )
function warpit ( thePlayer )
if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then
local vehicle = getPedOccupiedVehicle ( thePlayer )
if ( getElementModel ( vehicle ) == 420 ) then
warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 )
pickMeUp ( thePlayer )
end
end
end
function pickMeUp ( thePlayer )
if ( isElement ( markers [ thePlayer ] ) ) then
destroyElement ( markers [ thePlayer ] )
end
if ( isElement ( blips [ thePlayer ] ) ) then
destroyElement( blips [ thePlayer ] )
end
end