ESX = nil
shopid = nil
robstarted = false
robx = nil
roby = nil
robz = 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 safes = {
[1] = {number = 1, x = 378.2127, y = 333.4241, z = 103.26, heading = 255.47},
[2] = {number = 2, x = -1478.91, y = -375.482, z = 39.163, heading = 228.54},
[3] = {number = 3, x = -43.4747, y = -1748.35, z = 29.0, heading = 320.15},
[4] = {number = 4, x = 1159.547, y = -314.049, z = 69.0, heading = 10.81},
[5] = {number = 5, x = -709.707, y = -904.176, z = 19.0, heading = 5.29},
[6] = {number = 6, x = 28.17700, y = -1339.19, z = 29.2, heading = 269.79},
}
Citizen.CreateThread(function()
while true do
local wait = 750
for i=1, #safes, 1 do
local ped = GetPlayerPed(-1)
local pedCoords = GetEntityCoords(ped)
pedDistance = GetDistanceBetweenCoords(pedCoords, safes[i].x, safes[i].y, safes[i].z - 1, false)
if pedDistance <= 1.0 then
DrawText3D(safes[i].x, safes[i].y, safes[i].z, '~g~E~w~ - Kasayı Aç')
if IsControlJustReleased(0, 38) then
openSafe(safes[i].number, safes[i].x, safes[i].y, safes[i].z - 1)
end
wait = 5
end
end
Citizen.Wait(wait)
end
end)
Citizen.CreateThread(function()
while true do
local sleepThread = 3000
if robstarted then
sleepThread = 10
local ped = GetPlayerPed(-1)
local pedCoords = GetEntityCoords(ped)
distance = GetDistanceBetweenCoords(pedCoords, robx, roby, robz, false)
if distance >= 15 then
EndMinigame(false)
end
else
sleepThread = 3000
end
Citizen.Wait(sleepThread)
end
end)
DrawText3D = function(x, y, z, text)
local onScreen,x,y = World3dToScreen2d(x, y, z)
local factor = #text / 370
if onScreen then
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(x,y)
DrawRect(x,y + 0.0125, 0.015 + factor, 0.03, 41, 11, 41, 120)
end
end
function openSafe(id, x, y, z)
local ped = GetPlayerPed(-1)
ESX.TriggerServerCallback('shop_robbery:copCount', function(cops)
if cops >= Config.NeededCops then -- polis sayısı
if IsPedArmed(ped, 4) then
ESX.TriggerServerCallback('shop_robbery:getTime', function(time)
ESX.TriggerServerCallback('shop_robbery:getShops', function(shops)
local remainingtime = time - shops.robtime
if time - shops.robtime <= 7200 then
TriggerEvent('notification', 'Bu dükkanın soyulabilmesi için ' .. math.floor((7200 - remainingtime) / 60) .. ' dakika gerekiyor!', 2)
elseif time - shops.robtime >= 7200 then
local bravekeke = exports["reload-skillbar"]:taskBar(3000,math.random(5,15))
if bravekeke ~= 100 then
TriggerEvent('notification', 'Bu konuda harbi çöpsün!', 2)
else
local bravekeke2 = exports["reload-skillbar"]:taskBar(2000,math.random(5,15))
if bravekeke2 ~= 100 then
TriggerEvent('notification', 'Bu konuda harbi çöpsün!', 2)
else
robstarted = true
robx = x
roby = y
robz = z
TriggerServerEvent('shop_robbery:notifyPolice')
TriggerEvent('police:storeRobbery')
exports['mythic_progbar']:Progress({
name = "startrob",
duration = Config.StartSearchTime,
label = 'Kasa kilidi kurcalanıyor',
useWhileDead = false,
canCancel = true,
controlDisables = {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
},
animation = {
animDict = "mini@repair",
anim = "fixing_a_ped",
},
}, function(cancelled)
if not cancelled then
SafeRewards = math.random(Config.SafeRewardMin, Config.SafeRewardMax)
StartMinigame(SafeRewards)
shopid = id
else
TriggerEvent('notification', 'Kasayı zorlamaktan vazgeçtin', 1)
end
end)
end
end
end
end, id)
end)
else
TriggerEvent('notification', 'Tehdit içeren bir unsur yok!', 2)
end
else
TriggerEvent('notification', 'Şehirde yeterli polis yok!', 2)
end
end)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(2500)
if robstarted then
TriggerServerEvent('shop_robbery:blipRobCop', robx, roby, robz)
end
end
end)
local bliptimer = 5
Citizen.CreateThread(function()
while true do
Citizen.Wait(60000)
if robstarted then
bliptimer = bliptimer - 1
if bliptimer == 0 then
shopid = nil
robstarted = false
robx = nil
roby = nil
robz = nil
bliptimer = 5
end
end
end
end)
RegisterNetEvent('shop_robbery:blipRobCopC')
AddEventHandler('shop_robbery:blipRobCopC', function(x, y, z)
local transT = 250
local Blip = AddBlipForCoord(x, y, z)
SetBlipSprite(Blip, 162)
SetBlipColour(Blip, 3)
SetBlipAlpha(Blip, transT)
SetBlipScale(Blip, 1.7)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Market Soygunu")
EndTextCommandSetBlipName(Blip)
SetBlipAsShortRange(Blip, false)
while transT ~= 0 do
Wait(4)
transT = transT - 1
SetBlipAlpha(Blip, transT)
if transT == 0 then
SetBlipSprite(Blip, 2)
return
end
end
end)
function lockFinished(rewards)
TriggerServerEvent('shop_robbery:robbedUpdate')
TriggerServerEvent('shop_robbery:giveMoney', rewards)
end
-- jam minigame
function StartMinigame(rewards)
FreezeEntityPosition(PlayerPedId(),true)
local txd = CreateRuntimeTxd("JSCTextureDict")
for i = 1, 2 do
CreateRuntimeTextureFromImage(txd, tostring(i), "LockPart" .. i .. ".PNG")
end
MinigameOpen = true
SoundID = GetSoundId()
Timer = GetGameTimer()
if not RequestAmbientAudioBank("SAFE_CRACK", false) then
RequestAmbientAudioBank("SAFE_CRACK", false)
end
if not HasStreamedTextureDictLoaded("JSCTextureDict", false) then
RequestStreamedTextureDict("JSCTextureDict", false)
end
Citizen.CreateThread(function()
Update(rewards)
end)
end
function Update(rewards)
Citizen.CreateThread(function()
HandleMinigame(rewards)
end)
while MinigameOpen do
InputCheck()
if IsEntityDead(GetPlayerPed(PlayerId())) then
EndMinigame(false, false)
end
Citizen.Wait(0)
end
end
function InputCheck()
local leftKeyPressed = IsControlPressed(0, 174) or 0 -- left arrow
local rightKeyPressed = IsControlPressed(0, 175) or 0 -- right arrow
if IsControlPressed(0, 113) then
EndMinigame(false)
end
if IsControlPressed(0, 48) then -- z
rotSpeed = 0.1
modifier = 33
elseif IsControlPressed(0, 21) then --left shift
rotSpeed = 1.0
modifier = 50
else
rotSpeed = 0.4
modifier = 90
end
local lockRotation = math.max(modifier / rotSpeed, 0.1)
if leftKeyPressed ~= 0 or rightKeyPressed ~= 0 then
LockRotation = LockRotation - (rotSpeed * tonumber(leftKeyPressed))
LockRotation = LockRotation + (rotSpeed * tonumber(rightKeyPressed))
if (GetGameTimer() - Timer) > lockRotation then
PlaySoundFrontend(0, "tumbler_turn", "SAFE_CRACK_SOUNDSET", false)
Timer = GetGameTimer()
end
end
end
function HandleMinigame(rewards)
local lockRot = math.random(385.00, 705.00)
local lockNumbers = {}
local correctGuesses = {}
lockNumbers[1] = 1
lockNumbers[2] = math.random( 45.0, 359.0)
lockNumbers[3] = math.random(lockNumbers[2] - 719.0, lockNumbers[2] - 405.0)
lockNumbers[4] = math.random(lockNumbers[3] + 45.0, lockNumbers[3] + 359.0)
lockNumbers[5] = math.random(lockNumbers[4] - 719.0, lockNumbers[4] - 405.0)
lockNumbers[6] = math.random(lockNumbers[5] + 45.0, lockNumbers[5] + 359.0)
lockNumbers[7] = math.random(lockNumbers[6] - 719.0, lockNumbers[6] - 405.0)
-----------------------
-- REDO LOCK NUMBERS --
-----------------------
-- Make numbers persist if chosen.
-- Add number count for difficulty.
-- Multiples of 2 are positive, 45 - 359;
-- Multiples of 3 are negative, 719 - 405;
-- Everything else is negative, 45 - 359;
---------------------------------------------
-- Still havn't done, you're welcome to ^^ --
---------------------------------------------
-- print("Here ya go, bloody cheater.")
for i = 1,7 do
-- print(math.floor((lockNumbers[i] % 360) / 3.60))
end
text31('Not: (iki sola) ' .. (math.floor((lockNumbers[1] % 360) / 3.60)) .. ' (sağa) ' .. (math.floor((lockNumbers[2] % 360) / 3.60)) .. ' (iki sola) ' .. (math.floor((lockNumbers[3] % 360) / 3.60)) .. ' (sağa) ' .. (math.floor((lockNumbers[4] % 360) / 3.60)) .. ' (iki sola) ' .. (math.floor((lockNumbers[5] % 360) / 3.60)) .. ' (sağa) ' .. (math.floor((lockNumbers[6] % 360) / 3.60)) .. ' (iki sola) ' .. (math.floor((lockNumbers[7] % 360) / 3.60)) .. ' ', 3)
Citizen.Wait(10)
TriggerEvent('notification', '"LeftShift" tuşu ile hızlandırabilir, "Z" tuşu ile yavaşlatabilirsiniz. "G" tuşu ile kapatabilirsiniz.', 1)
--------------------------------------
-- Comment this out for a challenge --
--------------------------------------
local correctCount = 1
local hasRandomized = false
LockRotation = 0.0 + lockRot
while MinigameOpen do
DrawSprite("JSCTextureDict", "1", 0.8, 0.5, 0.15, 0.26, -LockRotation, 255, 255, 255, 255)
DrawSprite("JSCTextureDict", "2", 0.8, 0.5, 0.176, 0.306, -0.0, 255, 255, 255, 255)
hasRandomized = true
local lockVal = math.floor(LockRotation)
if correctCount > 1 and correctCount < 8 and lockVal + (Config.LockTolerance * 3.60) < lockNumbers[correctCount - 1] and lockNumbers[correctCount - 1] < lockNumbers[correctCount] then
EndMinigame(false)
MinigameOpen = false
elseif correctCount > 1 and correctCount < 8 and lockVal - (Config.LockTolerance * 3.60) > lockNumbers[correctCount - 1] and lockNumbers[correctCount - 1] > lockNumbers[correctCount] then
EndMinigame(false)
MinigameOpen = false
elseif correctCount > 7 then
EndMinigame(true, rewards)
end
for k,v in pairs(lockNumbers) do
if not hasRandomized then
LockRotation = lockRot
end
if lockVal == v and correctCount == k then
local canAdd = true
for key,val in pairs(correctGuesses) do
if val == lockVal and key == correctCount then
canAdd = false
end
end
if canAdd then
PlaySoundFrontend(-1, "tumbler_pin_fall", "SAFE_CRACK_SOUNDSET", true)
correctGuesses[correctCount] = lockVal
correctCount = correctCount + 1;
end
end
end
Citizen.Wait(0)
end
end
text31 = function(text, duration)
local sure = duration * 30000
ClearPrints()
BeginTextCommandPrint('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandPrint(sure, 1)
end
function EndMinigame(won, rewards)
MinigameOpen = false
if won then
PlaySoundFrontend(SoundID, "tumbler_pin_fall_final", "SAFE_CRACK_SOUNDSET", true)
Citizen.Wait(100)
PlaySoundFrontend(SoundID, "safe_door_open", "SAFE_CRACK_SOUNDSET", true)
lockFinished(rewards)
TriggerEvent('notification', 'Kasa açıldı', 3)
FreezeEntityPosition(PlayerPedId(),false)
ClearPrints()
else
PlaySoundFrontend(SoundID, "tumbler_reset", "SAFE_CRACK_SOUNDSET", true)
TriggerEvent('notification', 'Kasayı açamadın!', 2)
shopid = nil
robstarted = false
robx = nil
roby = nil
robz = nil
bliptimer = 5
FreezeEntityPosition(PlayerPedId(),false)
ClearPrints()
end
end