Jump to content

setPlayerTeam


Lloyd Logan

Recommended Posts

Yes, exactly.

So when a marker and blip is destroyed after picking up a ped, it keeps creating a random marker and blip from pickups, but I would like to be from the dropoff table, how would i do this?

  
local dropoffs = { 
[1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, 
[2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, 
[3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, 
[4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } 
}  
  
local sss = { 
  
[1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, 
[2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, 
[3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, 
[4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } 
} 
  
local pedCus = { 
[1]={ 9 }, 
[2]={ 10 }, 
[3]={ 14 }, 
[4]={ 15 }, 
[5]={ 37 } 
} 
  
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 ) == "thePlayer" 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 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 
            if ( isElement ( markers [ thePlayer ] ) ) then 
                destroyElement ( markers [ thePlayer ] ) 
            end 
            if ( isElement ( blips [ thePlayer ] ) ) then 
                destroyElement( blips [ thePlayer ] ) 
            end 
            warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) 
            cancelEvent() 
        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...