#include "script/common.lua" done = false messageSent = false timer = 0 function init() arrow = LoadSprite("gfx/arrowdown.png") garageLocation = FindLocation("garageLocation") garageTrigger = FindTrigger("trigger") car1 = FindVehicle("car1") car2 = FindVehicle("car2") local parked1 = FindVehicle("parked1") local parked2 = FindVehicle("parked2") mishap1=false mishap2=false snd = LoadSound("valuable.ogg") local taskDone = GetBool("savegame.mod.task.parkcars") if taskDone then Delete(car1) Delete(car2) done = true else Delete(parked1) Delete(parked2) end end function tick(dt) if messageSent then return end if done then timer = timer+dt if timer > 7 then SetString("cellphone.newMessage","cell_cam_heist") messageSent = true end end if not done and GetInt("savegame.mod.message.parkcars.read") > 0 then if IsVehicleInTrigger(garageTrigger, car1) and IsVehicleInTrigger(garageTrigger, car2) then done = true PlaySound(snd) SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_ALL_DONE")) SetBool("savegame.mod.task.parkcars", true) end local vehicle = GetPlayerVehicle() local t1 = GetVehicleTransform(car1) local t2 = GetVehicleTransform(car2) local car1inWater, depth1 = IsPointInWater(t1.pos) local car2inWater, depth2 = IsPointInWater(t2.pos) if vehicle == car1 or vehicle == car2 then if not IsVehicleInTrigger(garageTrigger, car1) and vehicle == car1 then drawArrow(garageLocation) SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_PARK_THE")) end if not IsVehicleInTrigger(garageTrigger, car2) and vehicle == car2 then drawArrow(garageLocation) SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_PARK_THE")) end else --not in any vehicle if not IsVehicleInTrigger(garageTrigger, car1) and not IsVehicleInTrigger(garageTrigger, car2) then if car1inWater then SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO_YELLOW_CAR")) drawArrowVehicle(car2) elseif car2inWater then SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO_RED_CAR")) drawArrowVehicle(car1) else SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO_RACE_CAR")) drawArrowVehicle(car1) drawArrowVehicle(car2) end elseif not IsVehicleInTrigger(garageTrigger, car1) and not car1inWater then drawArrowVehicle(car1) SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO_RED_CAR")) elseif not IsVehicleInTrigger(garageTrigger, car2) and not car2inWater then drawArrowVehicle(car2) SetString("hud.hintinfo", GetTranslatedStringByKey("UI_HUD_HINT_GO_TO_YELLOW_CAR")) end end if (car1inWater and depth1 > 1) and (car2inWater and depth2 > 1) then done = true PlaySound(snd) SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_I_GUESS")) SetBool("savegame.mod.task.parkcars", true) SetBool("savegame.mod.task.parkcars.water", true) end if (car1inWater and depth1 > 1) and IsVehicleInTrigger(garageTrigger, car2) then done = true PlaySound(snd) SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_I_GUESS")) SetBool("savegame.mod.task.parkcars", true) SetBool("savegame.mod.task.parkcars.water", true) end if (car2inWater and depth2 > 1) and IsVehicleInTrigger(garageTrigger, car1) then done = true PlaySound(snd) SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_I_GUESS")) SetBool("savegame.mod.task.parkcars", true) SetBool("savegame.mod.task.parkcars.water", true) end if (car1inWater and depth1 > 1) and not mishap1 and not done then mishap1 = true SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_WHOOOPS")) end if (car2inWater and depth2 > 1) and not mishap2 and not done then mishap2 = true SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_AH_WELL")) end end end function drawArrowVehicle(vehicle) if GetBool("game.map.enabled") then return end local arrowPos = GetVehicleTransform(vehicle).pos local c = GetCameraTransform().pos c[2] = arrowPos[2] local p = VecCopy(arrowPos) p[2] = p[2] + math.sin(GetTime()*5)*0.3+0.3 + 3 local t = Transform(p, QuatLookAt(arrowPos, c)) DrawSprite(arrow, t, 2, 2, .3, .3, .3, 3, false, true) DrawSprite(arrow, t, 2, 2, 1, 1, 1, 1, true, true) end function drawArrow(location) if GetBool("game.map.enabled") then return end local arrowPos = GetLocationTransform(location).pos local c = GetCameraTransform().pos c[2] = arrowPos[2] local p = VecCopy(arrowPos) p[2] = p[2] + math.sin(GetTime()*5)*0.3+0.3 + 2 local t = Transform(p, QuatLookAt(arrowPos, c)) DrawSprite(arrow, t, 2, 2, .3, .3, .3, 3, false, true) DrawSprite(arrow, t, 2, 2, 1, 1, 1, 1, true, true) end