Lua
local docar = {}
local docarVeh = {}
--devModeC = false
cargeloescht = 0
car = 0
carVehs = { [1]=405 }
robstart = createMarker ( -1967.8, 309.3, 34.1, "cylinder", 1.1, 255, 255, 0, 255 )
function car_hit ( hitElement )
if isEvil ( hitElement ) then
outputChatBox("Tippe /car um ein Fahrzeug aus dem Autohaus zu rauben.", hitElement, 0, 125, 0 )
else
outputChatBox ("Nur für böse Fraktionen!", hitElement, 0, 125, 0 )
end
end
addEventHandler("onMarkerHit", robstart, car_hit )
function start_car ( thePlayer )
if isEvil ( thePlayer ) or getPlayerGang ( thePlayer ) >= 1 then
if getDistanceBetweenPoints3D ( -1967.8, 309.3, 33.5, getElementPosition ( thePlayer ) ) < 6 then
if car == 0 then
car = 1
cargeloescht = 0
outputChatBox("Ein Fahrzeug bei Wangcars wurde gestohlen!", getRootElement(), 125, 0, 0 )
outputChatBox("Das Fahrzeug steht gleich neben dem Pay and Spray bereit!", thePlayer, 0, 125, 0 )
setTimer ( function()
local rnd = math.random ( 1, 4 )
rob = createVehicle( carVehs[rnd], -1917.0654296875, 297.2919921875, 40.828777313232, 0, 0, 179.912109375, "WANGCARS" )
setElementHealth ( rob, 1900 )
docar[thePlayer] = true
docarVeh[rob] = true
warpPedIntoVehicle ( thePlayer, rob )
outputChatBox("Bringe das Fahrzeug zu der Rennflage auf der Map!", thePlayer, 67,110,238 )
finishMark = createMarker ( 797.59997558594, -617.90002441406, 15.03, "cylinder", 4, 0, 255, 255, 255 )
finishBli = createBlip ( 797.59997558594, -617.90002441406, 15.10000038147, 19, 2, 255, 0, 0, 255, 0, 999999, getRootElement() )
addEventHandler ("onVehicleExplode", getRootElement(), veh_explode )
addEventHandler ("onMarkerHit", finishMark, finishcar )
drnd = math.random ( 1, 5 )
zeit = math.random ( 1, 3 )
difficul = setTimer ( difficul_func, zeit*60*1000, 1, thePlayer, rob, brnd, zeit )
end, 5000, 1 )
setTimer ( car_erholt, 40*60*1000, 1)
else
outputChatBox("Es kann nur alle 40 Minuten ein Fahrzeug gestohlen werden!", thePlayer, 125, 0, 0 )
end
else
outputChatBox("Du bist zu weit entfernt!", thePlayer, 125, 0, 0 )
end
end
end
addCommandHandler ("car", start_car )
function difficul_func ( thePlayer, veh, rnd, zeit )
if rnd == 1 then
elseif rnd == 2 then
setVehicleWheelStates ( veh, 1, 0, 0, 0 )
outputChatBox("Du bist durch einen Nagel gefahren und hast nun einen Platten!", thePlayer, 125, 0, 0 )
elseif rnd == 3 then
setElementHealth ( veh, 325 )
outputChatBox ("Das Fahrzeug hat einen Motorschaden und fährt nurnoch 45km/H!", thePlayer, 175, 0, 0 )
setVehicleEngineState ( veh, false )
setVehicleHandling(veh, "engineAcceleration", 8)
setVehicleHandling(veh, "maxVelocity", 45)
elseif rnd == 4 then
elseif rnd == 5 then
if getElementHealth ( veh ) < 750 then
setElementHealth ( veh, 900 )
outputChatBox ("Dein Fahrzeug wurde ein wenig repariert!", thePlayer, 125, 0, 0 )
end
end
end
robEar = {
[405]=8000
}
function finishcar ( hitElement, matchingDimension ) -- X
if getElementType( hitElement ) == "vehicle" and matchingDimension then
if (docarVeh[hitElement]==true) then
local recon = getVehicleOccupant ( hitElement )
if (docar[recon]==true) then
local pay = robEar[getElementModel(hitElement)]
destroyElement(rob)
destroyElement(finishMark)
destroyElement(finishBli)
givePlayerSaveMoney ( recon, pay )
outputChatBox("Du hast "..pay.."$ erhalten!", recon, 0, 255, 0)
cargeloescht = 1
end
else
outputChatBox("Das ist nicht das richtige Fahrzeug!", hitElement, 125, 0, 0)
end
end
end
function veh_explode ()
if source == docarVeh[source] then
destroyElement(finishMark)
destroyElement(finishBli)
if isTimer ( difficul ) then
killTimer ( difficul )
end
end
end
function car_erholt ()
car = 0
outputChatBox ("Das Autohaus hat sich von dem Überfall erholt!", getRootElement(), 0, 125, 0 )
if cargeloescht == 0 then
cargeloescht = 1
destroyElement(rob)
destroyElement(finishMark)
destroyElement(finishBli)
if isTimer ( difficul ) then
killTimer ( difficul )
end
end
end
Alles anzeigen
Ich habe ein kleines Problem, undzwar wird nach der Abgabe des Fahrzeuges nicht der Blip gelöscht !