Hallo also es kommt ja der marker aber wen ich /job mache steht da Du hast schon nen jib obwohl ich /quitjob gemacht habe
Lua
Airportcolsphere2 = createColSphere ( 1451.0444335938, -2287.1538085938, 12.5468755190, 5 )
Airportjobmarker2 = createMarker ( 1451.0444335938, -2287.1538085938, 12.5468755190, "cylinder", 2, 255, 0, 0 )
createBlip ( 1451.0444335938, -2287.1538085938, 12.5468755190, 05)
function AirportStart2 ( thePlayer )
local playeraccount = getPlayerAccount ( thePlayer )
local playerjob = getAccountData ( playeraccount, "job" )
if ( isElementWithinColShape ( thePlayer, Airportcolsphere2 ) ) then
if ( playerjob == 15 ) then
local dim = math.random ( 0, 0 )
local finish = math.random ( 1, 3 )
local PlaneID = "Pilot" .. tostring ( dim )
local finishid = "Finish" .. tostring ( dim )
setElementData ( thePlayer, "PlaneID", tostring ( dim ) )
setElementID ( createVehicle ( 592, -1607.1263427734, -496.35708618164, 23.137775421143, 0, 0, 45, "Plane" ), PlaneID )
setElementDimension ( getElementByID ( PlaneID ), dim )
setElementDimension ( thePlayer, dim )
warpPedIntoVehicle ( thePlayer, getElementByID ( PlaneID ), 0 )
if ( finish == 1 ) then
setElementID ( createMarker ( 1802.8526611328, -2494.75466918945, 14.378060340881, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid )
setElementDimension ( getElementByID ( finishid ), dim )
setElementID ( createBlip ( 1802.8526611328, -2494.75466918945, 14.378060340881, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) )
elseif ( finish == 2 ) then
setElementID ( createMarker ( -1643.7896728516, -151.75466918945, 14.971508026123, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid )
setElementDimension ( getElementByID ( finishid ), dim )
setElementID ( createBlip ( -1643.7896728516, -151.75466918945, 14.971508026123, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) )
elseif ( finish == 3 ) then
setElementID ( createMarker ( 46.052177429199, 2499.1655273938, 17.30576896675, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid )
setElementDimension ( getElementByID ( finishid ), dim )
setElementID ( createBlip ( 46.052177429199, 2499.1655273938, 17.30576896675, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) )
end
setElementDimension ( getElementByID ( "blip" .. tostring ( dim ) ), dim )
setElementData ( thePlayer, "onAirport2", 1 )
outputChatBox ( "Liefere deine Ladung am Zielort ab!", thePlayer )
setVehicleEngineState ( getElementByID ( PlaneID ), true )
else
outputChatBox ( "Du bist kein Pilot!", thePlayer )
end
end
end
addCommandHandler ( "airportstart", AirportStart2 )
function finishAirport2 ( hitPlayer, matchingDimension )
if ( source == getElementByID ( "Finish" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) then
if ( getElementData ( hitPlayer, "onAirport2" ) == 1 ) then
outputChatBox ( "Du hast die Lieferung erfolgreich abgegeben und 500$ verdient!", hitPlayer )
removePedFromVehicle ( hitPlayer )
destroyElement ( source )
destroyElement ( getElementByID ( "blip" .. tostring ( getElementDimension ( hitPlayer ) ) ) )
givePlayerMoney ( hitPlayer, 500 )
setElementData ( hitPlayer, "onAirport2", 0 )
setElementDimension ( hitPlayer, 0 )
setElementPosition ( hitPlayer, -1422.9653320313, -307.56689453125, 6.2353125 )
setPedRotation ( hitPlayer, 90 )
end
end
end
addEventHandler ( "onMarkerHit", getRootElement(), finishAirport2 )
function Airportjobhelp2 ( hitPlayer, matchingDimension )
local playeraccount = getPlayerAccount ( hitPlayer )
local playerjob = getAccountData ( playeraccount, "job" )
if ( playerjob == 15 ) then
outputChatBox ( "Tippe /airportstart um einen Auftrag zu bekommen!", hitPlayer )
elseif ( playerjob == 0 ) then
outputChatBox ( "Tippe /job um als Pilot zu arbeiten!", hitPlayer )
else
outputChatBox ( "Du hast bereits einen anderen Job!", hitPlayer )
end
end
addEventHandler ( "onColShapeHit", Airportcolsphere2, Airportjobhelp2 )
function Airport2(player,command)
local playeraccount = getPlayerAccount( player )
if getAccountData ( playeraccount, "job" ) ~= 0 then
outputChatBox("Du hast bereits einen Job!", player, 255,0,0)
else
if ( isElementWithinColShape ( player, Airportcolsphere2 ) ) then
if ( getAccountData ( playeraccount, "licb" ) == 1 ) then
setAccountData(playeraccount, "job", 15)
outputChatBox("Du bist nun Pilot", player,0,255,0)
else
outputChatBox("Du brauchst die Lizens der Klasse B", player, 255, 0, 0 )
end
end
end
end
addCommandHandler("job", Airport2)
function onAirportCancelExit2 ( thePlayer )
if ( getElementData ( thePlayer, "onAirport2" ) ~= false ) then
if ( getElementData ( thePlayer, "onAirport2" ) == 1 ) then
cancelEvent()
outputChatBox ( "Du kannst das Flugzeug nicht einfach so verlassen!", thePlayer )
end
end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), onAirportCancelExit_SF )
Alles anzeigen