- Katılım
- 4 yıl 9 ay 14 gün
- Mesajlar
- 151
Merhabalar merak ettiğim bir soru için forumu açtım sunucumda herhangibi bir script in task barını değiştirmek istiyorum
Aşşağıya bir script in client.lua dosyasını bıraktım bu scriptteki progbar ı nasıl mythic_progbar a nasıl çevirebilirim yardımcı olurmusunuz ?
	
	
	
	
	
		
	
		
			
		
		
	
				
			Aşşağıya bir script in client.lua dosyasını bıraktım bu scriptteki progbar ı nasıl mythic_progbar a nasıl çevirebilirim yardımcı olurmusunuz ?
		Kod:
	
	ESX = nil
Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
    while ESX.GetPlayerData().job == nil do
        Citizen.Wait(10)
    end
    PlayerData = ESX.GetPlayerData()
end)
local PlayerData              = {}
local streetName, playerGender
Citizen.CreateThread(function()
  while ESX == nil do
      TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
      Citizen.Wait(10)
end
TriggerEvent('skinchanger:getSkin', function(skin)
      playerGender = skin.sex
  end)
end)
local hasBeenUnlocked = {}
local vehicleHotwired = {}
local gotKeys = false
local failedAttempt = {}
local vehicleSearched = {}
local disableH = false
local showText = false
local hasKilledNPC = false
local useLockpick = false
local vehicleBlacklist = {
['BMX'] = true,
['CRUISER'] = true,
['FIXTER'] = true,
['SCORCHER'] = true,
['TRIBIKE'] = true,
['TRIBIKE2'] = true,
['TRIBIKE3'] = true
}
fizzfaudisable = false
-- RegisterCommand('araçara', function()
--   if IsPedInAnyVehicle(PlayerPedId(), false) then
--     local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--     local plate = GetVehicleNumberPlateText(vehicle)
--      if not vehicleSearched[plate] and not hasVehicleKey(plate) and showText and not vehicleHotwired[plate] and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
--       showText = false
--       TriggerEvent('animation:hotwire', true)
--       fizzfaudisable = true
--        local finished = exports["np-taskbar"]:taskBar(10000,"Araç Aranıyor")
--        TriggerEvent('animation:hotwire', false)
--        fizzfaudisable = false
--        vehicleSearched[plate] = true
--        if not hasVehicleKey(plate) then
--         TriggerServerEvent('garage:searchItem', plate)
--         showText = true
--        end
--      elseif vehicleSearched[plate]  then
--       TriggerEvent('notification', 'Bu aracı aradım')
--      end
--     end
-- end)
Citizen.CreateThread(function()
while true do
  Citizen.Wait(5)
  if IsControlJustPressed(0, 74) and GetLastInputMethod(2) and not IsPedInAnyPlane(PlayerPedId()) and not IsPedInAnyHeli(PlayerPedId()) then
   TriggerEvent('keys:togglelocks')
  end
  if IsPedInAnyVehicle(PlayerPedId(), false) then
   local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
   local plate = GetVehicleNumberPlateText(vehicle)
    local carmodel = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
   if IsControlJustPressed(0, 246) and GetLastInputMethod(2) then
    if not vehicleSearched[plate] and not hasVehicleKey(plate) and showText and not vehicleHotwired[plate] and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
     showText = false
     TriggerEvent('animation:hotwire', true)
      local finished = exports["np-taskbar"]:taskBar(10000,"Araç Aranıyor")
      TriggerEvent('animation:hotwire', false)
      vehicleSearched[plate] = true
      if not hasVehicleKey(plate) then
        if GetVehicleClass(vehicle) ~= 7 and GetVehicleClass(vehicle) ~= 16 and GetVehicleClass(vehicle) ~= 18 and GetVehicleClass(vehicle) ~= 19 and carmodel ~= "TURSIMOR" and carmodel ~= "EXEMPLAR" and carmodel ~= "BANSHEE" and carmodel ~= "FELTZER" and carmodel ~= "DUMP" and carmodel ~= "JESTER" and carmodel ~= "MASSACRO" and carmodel ~= "RAPIDGT" and carmodel ~= "STRETCH" and carmodel ~= "ZENTORNO" then
          TriggerServerEvent('garage:searchItem', plate)
        else
          exports['mythic_notify']:SendAlert('error', 'Bir şey bulamadım')
        end
       showText = true
      end
    elseif vehicleSearched[plate]  then
     TriggerEvent('notification', 'Bu aracı zaten aradım.')
    end
   end
  end
  -- if not fizzfaudisable then
  --  EnableControlAction(0, 23, true)
  -- else
  --   DisableControlAction(0, 23, true)
  -- end
  -- if not fizzfaudisable then
  --   DisableControlAction(0, 74, true)
  -- end
end
end)
Citizen.CreateThread(function()
    while true do
        if DoesEntityExist(GetVehiclePedIsTryingToEnter(PlayerPedId())) then
            local veh = GetVehiclePedIsTryingToEnter(PlayerPedId())
            local pedd = GetPedInVehicleSeat(veh, -1)
            if DoesEntityExist(pedd) and not IsPedAPlayer(pedd) and not IsEntityDead(pedd) then
              --print('cannot enter this door dick')
             SetVehicleDoorsLocked(veh, 2)
             SetPedCanBeDraggedOut(pedd, false)
             TaskVehicleMissionPedTarget(pedd, veh, PlayerPedId(), 8, 50.0, 790564, 300.0, 15.0, 1)
             disableF = true
             Wait(1500)
             disableF = false
            end
        end
        Citizen.Wait(0)
    end
end)
RegisterNetEvent('vehicle:start')
AddEventHandler('vehicle:start', function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
SetVehicleEngineOn(vehicle, false, false)
end)
Citizen.CreateThread(function()
while true do
  Citizen.Wait(5)
  if not IsPedInAnyVehicle(PlayerPedId(), false) then
   showText = true
   -- Exiting
   local aiming, targetPed = GetEntityPlayerIsFreeAimingAt(PlayerId(-1))
   if aiming then
    if DoesEntityExist(targetPed) and not IsPedAPlayer(targetPed) and IsPedArmed(PlayerPedId(), 7) then
     local vehicle = GetVehiclePedIsIn(targetPed, false)
     local plate = GetVehicleNumberPlateText(vehicle)
     local distance = GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId(), true), GetEntityCoords(vehicle, true), false)
     if distance < 10 and IsPedFacingPed(targetPed, PlayerPedId(), 60.0) then
     SetVehicleForwardSpeed(vehicle, 0)
     hasBeenUnlocked[plate] = false
     SetVehicleForwardSpeed(vehicle, 0)
     TaskLeaveVehicle(targetPed, vehicle, 256)
     while IsPedInAnyVehicle(targetPed, false) do
      Citizen.Wait(5)
     end
     RequestAnimDict('missfbi5ig_22')
     RequestAnimDict('mp_common')
     SetPedDropsWeaponsWhenDead(targetPed,false)
     ClearPedTasks(targetPed)
     TaskTurnPedToFaceEntity(targetPed, GetPlayerPed(-1), 3.0)
     TaskSetBlockingOfNonTemporaryEvents(targetPed, true)
     SetPedFleeAttributes(targetPed, 0, 0)
     SetPedCombatAttributes(targetPed, 17, 1)
     SetPedSeeingRange(targetPed, 0.0)
     SetPedHearingRange(targetPed, 0.0)
     SetPedAlertness(targetPed, 0)
     SetPedKeepTask(targetPed, true)
     TaskPlayAnim(targetPed, "missfbi5ig_22", "hands_up_anxious_scientist", 8.0, -8, -1, 12, 1, 0, 0, 0)
     Wait(1500)
     TaskPlayAnim(targetPed, "missfbi5ig_22", "hands_up_anxious_scientist", 8.0, -8, -1, 12, 1, 0, 0, 0)
     Wait(2500)
     local distance = GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId(), true), GetEntityCoords(vehicle, true), false)
     if not IsEntityDead(targetPed) and distance < 12 then
      hasBeenUnlocked[plate] = true
      TaskPlayAnim(targetPed, "mp_common", "givetake1_a", 8.0, -8, -1, 12, 1, 0, 0, 0)
      TriggerEvent('police:Gunpoint')
      Wait(750)
      --TriggerEvent('chatMessage', '^2You Have Been Given The Keys')
      TriggerEvent('notification', 'Anahtarları aldım!')
      TriggerServerEvent('garage:addKeys', plate)
      Citizen.Wait(500)
      TaskReactAndFleePed(targetPed, GetPlayerPed(-1))
      SetPedKeepTask(targetPed, true)
      Wait(2500)
      TaskReactAndFleePed(targetPed, GetPlayerPed(-1))
      SetPedKeepTask(targetPed, true)
      Wait(2500)
      TaskReactAndFleePed(targetPed, GetPlayerPed(-1))
      SetPedKeepTask(targetPed, true)
      Wait(2500)
      TaskReactAndFleePed(targetPed, GetPlayerPed(-1))
      SetPedKeepTask(targetPed, true)
      end
     end
    end
   end
  end
end
end)
Citizen.CreateThread(function()
while true do
  Citizen.Wait(5)
  if IsPedShooting(PlayerPedId()) then
   hasKilledNPC = true
  end
  if IsPedInAnyVehicle(PlayerPedId(), false) then
   local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
   local plate = GetVehicleNumberPlateText(vehicle)
   if DoesEntityExist(vehicle) and not hasVehicleKey(plate) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() and not vehicleHotwired[plate] and not vehicleBlacklist[GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))] then
    while not IsPedInAnyVehicle(PlayerPedId(), false) do
     Citizen.Wait(5)
    end
    SetVehicleEngineOn(vehicle, false, false)
    if showText then
     local pos = GetOffsetFromEntityInWorldCoords(vehicle, 0.0, 1.25, 0.35)
     DrawText3Ds(pos["x"],pos["y"],pos["z"], " [Y] Ara / [H] Düzkontak" )
    end
    if useLockpick then
      useLockpick = false
     if not failedAttempt[plate] and not vehicleHotwired[plate] then
       TriggerEvent('animation:hotwire', true)
       showText = false
       local finished = exports["reload-skillbar"]:taskBar(3000,math.random(5,15))
      if finished == 100 then
        TriggerEvent('animation:hotwire', false)
     
        if true then
         vehicleHotwired[plate] = true
         SetVehicleEngineOn(vehicle, true, true)
          if math.random(100) < 50 then
            local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
                    local plate = GetVehicleNumberPlateText(vehicle)
                    local model = GetEntityModel(vehicle)
                    local model = GetDisplayNameFromVehicleModel(model)
                    local s = source
                    local playerPed = PlayerPedId()
                    local playerCoords = GetEntityCoords(playerPed)
                    local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
                    local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
                  local streetName = (GetStreetNameFromHashKey(street1))
                  TriggerServerEvent('esx_outlawalert:carJackInProgress', {
                    x = ESX.Math.Round(playerCoords.x, 1),
                    y = ESX.Math.Round(playerCoords.y, 1),
                    z = ESX.Math.Round(playerCoords.z, 1)
                    }, streetName, model, playerGender, plate)
          end
         TriggerEvent('notification', 'Düzkontak tamamdır.')
         TriggerServerEvent('removelockpick')
         showText = true
        else
         TriggerEvent('notification', 'Buna düzkontak yapamam.', 2)
         failedAttempt[plate] = true
         showText = true
        end
      else
        TriggerEvent('animation:hotwire', false)
        failedAttempt[plate] = true
      end
     elseif failedAttempt[plate] then
      TriggerEvent('notification', 'Buna düzkontak yapamam.', 2)
     elseif vehicleHotwired[plate] then
      TriggerEvent('notification', 'Buna düzkontak yapamam.', 2)
     else
      TriggerEvent('notification', 'Buna düzkontak yapamam.', 2)
     end
    elseif IsControlJustPressed(0, 304) then
      local carmodel = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
      if not failedAttempt[plate] and not vehicleHotwired[plate] then
        local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
        if GetVehicleClass(vehicle) ~= 7 and GetVehicleClass(vehicle) ~= 16 and GetVehicleClass(vehicle) ~= 18 and GetVehicleClass(vehicle) ~= 19 and carmodel ~= "TURSIMOR" and carmodel ~= "EXEMPLAR" and carmodel ~= "BANSHEE" and carmodel ~= "FELTZER" and carmodel ~= "DUMP" and carmodel ~= "JESTER" and carmodel ~= "MASSACRO" and carmodel ~= "RAPIDGT" and carmodel ~= "STRETCH" and carmodel ~= "ZENTORNO" then
        local plate = GetVehicleNumberPlateText(vehicle)
        TriggerEvent('animation:hotwire', true)
        local finished = exports['reload-skillbar']:taskBar(4000,math.random(5,15))
        if finished == 100 then
          local finished = exports['reload-skillbar']:taskBar(3000,math.random(5,15))
          if finished == 100 then
            local finished = exports['reload-skillbar']:taskBar(2000,math.random(5,15))
            if finished == 100 then
              if IsPedInAnyVehicle(PlayerPedId(), false) then
           
                local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
           
                local plate = GetVehicleNumberPlateText(vehicle)
           
           
           
                if DoesEntityExist(vehicle) and not hasVehicleKey(plate) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() and not vehicleHotwired[plate] and not vehicleBlacklist[GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))] then
           
                while not IsPedInAnyVehicle(PlayerPedId(), false) do
           
                  Citizen.Wait(5)
           
                end
           
               
           
                  Citizen.Wait(500)
           
             
                    local model = GetEntityModel(vehicle)
                    local model = GetDisplayNameFromVehicleModel(model)
                    local s = source
                    local plate = GetVehicleNumberPlateText(vehicle)
                    local playerPed = PlayerPedId()
                    local playerCoords = GetEntityCoords(playerPed)
                    local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
                    local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
                  local streetName = (GetStreetNameFromHashKey(street1))
                  TriggerServerEvent('esx_outlawalert:carJackInProgress', {
                    x = ESX.Math.Round(playerCoords.x, 1),
                    y = ESX.Math.Round(playerCoords.y, 1),
                    z = ESX.Math.Round(playerCoords.z, 1)
                    }, streetName, model, playerGender, plate)
           
                  Citizen.Wait(500)
           
           
                  TriggerEvent('animation:hotwire', false)
           
                  vehicleHotwired[plate] = true
           
                  SetVehicleEngineOn(vehicle, true, true)
           
                  -- Adding This For Test
           
                  TriggerServerEvent('garage:addKeys', plate)
           
                  TriggerEvent('notification', 'Çalıştı.')
           
                  TriggerEvent('notification', 'Motor çalışıyor.')
           
                  SetVehicleEngineOn(vehicle, true, true)
           
                  showText = true
           
                  SetVehicleEngineOn(vehicle, true, true)
                end
              end
            else
             
              local model = GetEntityModel(vehicle)
              local model = GetDisplayNameFromVehicleModel(model)
              local s = source
              local plate = GetVehicleNumberPlateText(vehicle)
              local playerPed = PlayerPedId()
              local playerCoords = GetEntityCoords(playerPed)
              local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
              local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
            local streetName = (GetStreetNameFromHashKey(street1))
            TriggerServerEvent('esx_outlawalert:carJackInProgress', {
              x = ESX.Math.Round(playerCoords.x, 1),
              y = ESX.Math.Round(playerCoords.y, 1),
              z = ESX.Math.Round(playerCoords.z, 1)
              }, streetName, model, playerGender, plate)
     
              TriggerEvent('animation:hotwire', false)
              failedAttempt[plate] = true
            end
          else
           
            local model = GetEntityModel(vehicle)
            local model = GetDisplayNameFromVehicleModel(model)
            local s = source
            local plate = GetVehicleNumberPlateText(vehicle)
            local playerPed = PlayerPedId()
            local playerCoords = GetEntityCoords(playerPed)
            local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
            local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
          local streetName = (GetStreetNameFromHashKey(street1))
          TriggerServerEvent('esx_outlawalert:carJackInProgress', {
            x = ESX.Math.Round(playerCoords.x, 1),
            y = ESX.Math.Round(playerCoords.y, 1),
            z = ESX.Math.Round(playerCoords.z, 1)
            }, streetName, model, playerGender, plate)
   
            TriggerEvent('animation:hotwire', false)
            failedAttempt[plate] = true
          end
        else
         
          local model = GetEntityModel(vehicle)
          local model = GetDisplayNameFromVehicleModel(model)
          local s = source
          local plate = GetVehicleNumberPlateText(vehicle)
          local playerPed = PlayerPedId()
          local playerCoords = GetEntityCoords(playerPed)
          local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
          local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
        local streetName = (GetStreetNameFromHashKey(street1))
        TriggerServerEvent('esx_outlawalert:carJackInProgress', {
          x = ESX.Math.Round(playerCoords.x, 1),
          y = ESX.Math.Round(playerCoords.y, 1),
          z = ESX.Math.Round(playerCoords.z, 1)
          }, streetName, model, playerGender, plate)
          TriggerEvent('animation:hotwire', false)
          failedAttempt[plate] = true
        end
      else
        exports['mythic_notify']:SendAlert('error', 'Bu sistem çok gelişmiş')
      end
      else
        local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
                    local plate = GetVehicleNumberPlateText(vehicle)
                    local model = GetEntityModel(vehicle)
                    local model = GetDisplayNameFromVehicleModel(model)
                    local s = source
                    local playerPed = PlayerPedId()
                    local playerCoords = GetEntityCoords(playerPed)
                    local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(src)))
                    local street1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
                  local streetName = (GetStreetNameFromHashKey(street1))
                  TriggerServerEvent('esx_outlawalert:carJackInProgress', {
                    x = ESX.Math.Round(playerCoords.x, 1),
                    y = ESX.Math.Round(playerCoords.y, 1),
                    z = ESX.Math.Round(playerCoords.z, 1)
                    }, streetName, model, playerGender, plate)
        exports["mythic_notify"]:SendAlert('error', 'Bu aracı çalıştıramadım')
      end
    end
   
   end
  end
end
end)
-- RegisterCommand('düzkontak', function()
--   TriggerEvent('animation:hotwire', true)
--   if IsPedInAnyVehicle(PlayerPedId(), false) then
--     local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--     local plate = GetVehicleNumberPlateText(vehicle)
--     if DoesEntityExist(vehicle) and not hasVehicleKey(plate) and GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() and not vehicleHotwired[plate] and not vehicleBlacklist[GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))] then
--      while not IsPedInAnyVehicle(PlayerPedId(), false) do
--       Citizen.Wait(5)
--      end
--       local finished = exports["np-taskbar"]:taskBar(10000,"Düz Kontak")
--       Citizen.Wait(500)
--       local finished = exports["np-taskbar"]:taskBar(10000,"Düz Kontak 2")
--       if math.random(1, 5) == 1 then
--         TriggerEvent('police:lockpick')
--       end
--       Citizen.Wait(500)
--       local finished = exports["np-taskbar"]:taskBar(10000,"Düz Kontak 3")
--       TriggerEvent('animation:hotwire', false)
--       vehicleHotwired[plate] = true
--       SetVehicleEngineOn(vehicle, true, true)
--       -- Adding This For Test
--       TriggerServerEvent('garage:addKeys', plate)
--       TriggerEvent('notification', 'Çalıştı.')
--       TriggerEvent('notification', 'Motor çalışıyor.')
--       SetVehicleEngineOn(vehicle, true, true)
--       showText = true
--       SetVehicleEngineOn(vehicle, true, true)
--     end
--   end
-- end)
RegisterNetEvent('es_extended:car:keys')
AddEventHandler('es_extended:car:keys', function(vehicle)
    local plate = GetVehicleNumberPlateText(vehicle)
    vehicleHotwired[plate] = true
    SetVehicleEngineOn(vehicle, true, true)
end)
RegisterNetEvent('es_extended:car:keys')
AddEventHandler('es_extended:car:keys', function(vehicle)
    local plate = GetVehicleNumberPlateText(vehicle)
    vehicleHotwired[plate] = true
    SetVehicleEngineOn(vehicle, true, true)
end)
RegisterNetEvent('disc-hotwire:forceTurnOver')
AddEventHandler('disc-hotwire:forceTurnOver', function(vehicle)
    local plate = GetVehicleNumberPlateText(vehicle)
    vehicleHotwired[plate] = true
    SetVehicleEngineOn(vehicle, true, true)
end)
RegisterNetEvent('fizzfau:vehicleshopfix')
AddEventHandler('fizzfau:vehicleshopfix', function(plate, vehicle)
  vehicleHotwired[plate] = true
  SetVehicleEngineOn(vehicle, true, true)
end)
AddEventHandler('vehicle:setUnlocked', function(plate)
hasBeenUnlocked[plate] = true
end)
function DrawText3Ds(x,y,z, text)
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
SetTextScale(0.3, 0.3)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 370
DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end
-- Giving Vehicle Keys
AddEventHandler('keys:togglelocks', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local vehicle = nil
if IsPedInAnyVehicle(ped, false) then vehicle = GetVehiclePedIsIn(ped, false) else vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) end
if DoesEntityExist(vehicle) then
  Citizen.CreateThread(function()
   if hasVehicleKey(GetVehicleNumberPlateText(vehicle)) then
    if not IsPedInAnyVehicle(PlayerPedId(), false) then
     playLockAnimation()
     SetVehicleEngineOn(vehicle, true, true, true)
     SetVehicleLights(vehicle, 2) Wait(200) SetVehicleLights(vehicle, 1) Wait(200) SetVehicleLights(vehicle, 2) Wait(200) SetVehicleLights(vehicle, 1)
     SetVehicleEngineOn(vehicle, false, false, false)
     SetVehicleLights(vehicle, 0)
    end
    if GetVehicleDoorLockStatus(vehicle) == 1 then
     SetVehicleDoorsLocked(vehicle, 2)
    TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 8, "unlock", 0.1)
    TriggerEvent('notification', 'Araç  kilitlendi')
    elseif GetVehicleDoorLockStatus(vehicle) == 2 then
    TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 8, "lock", 0.1)
    TriggerEvent('notification', 'Aracın kilidi açıldı')
     SetVehicleDoorsLocked(vehicle, 1)
    end
   end
  end)
else
  TriggerEvent('notification', 'Araç yok.', 2)
end
end)
function playLockAnimation()
if not IsPedInAnyVehicle(PlayerPedId(), false) then
  RequestAnimDict('anim@mp_player_intmenu@key_fob@')
  while not HasAnimDictLoaded('anim@mp_player_intmenu@key_fob@') do
   Citizen.Wait(1)
  end
  TaskPlayAnim(PlayerPedId(), "anim@mp_player_intmenu@key_fob@", "fob_click", 24.0, 16.0, 1000, 50, 0, false, false, false)
end
end
function GetPlayers()
    local players = {}
    for i = 0, 63 do
        if NetworkIsPlayerActive(i) then
            table.insert(players, i)
        end
    end
    return players
end
function GetClosestPlayer()
    local players = GetPlayers()
    local closestDistance = -1
    local closestPlayer = -1
    local ply = GetPlayerPed(-1)
    local plyCoords = GetEntityCoords(ply, 0)
    for index,value in ipairs(players) do
        local target = GetPlayerPed(value)
        if(target ~= ply) then
            local targetCoords = GetEntityCoords(GetPlayerPed(value), 0)
            local distance = GetDistanceBetweenCoords(targetCoords["x"], targetCoords["y"], targetCoords["z"], plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
            if(closestDistance == -1 or closestDistance > distance) then
                closestPlayer = value
                closestDistance = distance
            end
        end
    end
    return closestPlayer, closestDistance
end
function getVehicleInDirection(coordFrom, coordTo)
  local offset = 0
  local rayHandle
  local vehicle
  for i = 0, 100 do
    rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z + offset, 10, GetPlayerPed(-1), 0)
    a, b, c, d, vehicle = GetRaycastResult(rayHandle)
    offset = offset - 1
    if vehicle ~= 0 then break end
  end
  local distance = Vdist2(coordFrom, GetEntityCoords(vehicle))
  if distance > 25 then vehicle = nil end
    return vehicle ~= nil and vehicle or 0
end
local disable = false
RegisterNetEvent('animation:hotwire')
AddEventHandler('animation:hotwire', function(disable)
local lPed = GetPlayerPed(-1)
ClearPedTasks(lPed)
   ClearPedSecondaryTask(lPed)
RequestAnimDict("mini@repair")
while not HasAnimDictLoaded("mini@repair") do
  Citizen.Wait(0)
end
if disable ~= nil then
  if not disable then
   lockpicking = false
   return
  else
   lockpicking = true
  end
end
while lockpicking do
  if not IsEntityPlayingAnim(lPed, "mini@repair", "fixing_a_player", 3) then
   ClearPedSecondaryTask(lPed)
   TaskPlayAnim(lPed, "mini@repair", "fixing_a_player", 8.0, -8, -1, 16, 0, 0, 0, 0)
  end
  Citizen.Wait(1)
end
ClearPedTasks(lPed)
end)
-- Start stealing a car
local isLockpicking = false
RegisterNetEvent('lockpick:vehicleUse')
AddEventHandler('lockpick:vehicleUse', function()
local coords = GetEntityCoords(GetPlayerPed(-1))
local vehicle = nil
if IsPedInAnyVehicle(PlayerPedId(), false) then
  vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
else
  vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71)
end
  if DoesEntityExist(vehicle) then
   if not IsPedInAnyVehicle(PlayerPedId(), false) then
    if GetVehicleDoorLockStatus(vehicle) ~= 1 then
     RequestAnimDict("mini@repair")
     while not HasAnimDictLoaded("mini@repair") do
         Citizen.Wait(0)
     end
     TriggerEvent('carLockpickAnim')
     Citizen.CreateThread(function()
      if math.random(1, 2) == 1 then
        TriggerEvent('police:lockpick')
      end
      exports["t0sic_loadingbar"]:StartDelayedFunction('Araç Kilidi Açılıyor', 20000, function()
       isLockpicking = false
       SetVehicleDoorsLocked(vehicle, 1)
       SetVehicleDoorsLockedForAllPlayers(vehicle, false)
       hasBeenUnlocked[GetVehicleNumberPlateText(vehicle)] = true
       TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 8, "lock", 0.1)
       TriggerEvent('notification', 'Aracın kilidi açıldı')
       SetVehicleEngineOn(vehicle, true, true, true)
       SetVehicleLights(vehicle, 2) Wait(200)
       SetVehicleLights(vehicle, 1) Wait(200)
       SetVehicleLights(vehicle, 2) Wait(200)
       SetVehicleLights(vehicle, 1) Wait(200)
       ClearPedTasksImmediately(GetPlayerPed(-1))
       TriggerServerEvent('removelockpick')
      end)
     end)
    end
   else
    local plate = GetVehicleNumberPlateText(vehicle)
    if failedAttempt[plate] or vehicleHotwired[plate] or hasVehicleKey(plate) then
     TriggerEvent('notification', 'Buna düzkontak yapamam.', 2)
    else
     useLockpick = true
    end
   end
end
end)
AddEventHandler('carLockpickAnim', function()
isLockpicking = true
loadAnimDict('veh@break_in@0h@p_m_one@')
while isLockpicking do
  if not IsEntityPlayingAnim(PlayerPedId(), "veh@break_in@0h@p_m_one@", "low_force_entry_ds", 3) then
   TaskPlayAnim(PlayerPedId(), "veh@break_in@0h@p_m_one@", "low_force_entry_ds", 1.0, 1.0, 1.0, 1, 0.0, 0, 0, 0)
   Citizen.Wait(1500)
   ClearPedTasks(PlayerPedId())
  end
  Citizen.Wait(1)
end
ClearPedTasks(PlayerPedId())
end)
function loadAnimDict(dict)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
  Citizen.Wait(5)
end
end
Citizen.CreateThread(function()
while true do
  Citizen.Wait(50)
  if GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)) ~= nil and GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)) ~= 0 and not gotKeys then
   local curveh = GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))
   local plate1 = GetVehicleNumberPlateText(curveh)
   if not hasVehicleKey(GetVehicleNumberPlateText(curveh)) then
    local pedDriver = GetPedInVehicleSeat(curveh, -1)
    if DoesEntityExist(pedDriver) and IsEntityDead(pedDriver) and not IsPedAPlayer(pedDriver) and not hasVehicleKey(GetVehicleNumberPlateText(curveh)) and hasKilledNPC then
     hasKilledNPC = false
     gotKeys = true
     Wait(500)
     exports["t0sic_loadingbar"]:StartDelayedFunction('Anahtar Alınıyor', 2000, function()
      TriggerServerEvent('garage:addKeys', plate1)
      Wait(500)
      gotKeys = false
     end)
    end
   end
  end
end
end)
local vehicleKeys = {}
local myCharacterID = 0
RegisterNetEvent("garage:updateKeys")
AddEventHandler("garage:updateKeys", function(data, char_id)
vehicleKeys = data
myCharacterID = char_id
end)
function hasVehicleKey(plate)
if vehicleKeys[plate] ~= nil then
  for id,v in pairs(vehicleKeys[plate]) do
   if v.id == myCharacterID then
    return true
   end
  end
  return false
else
  return false
end
end
-- 
	 
				





 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		