local ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObjects', function(obj) ESX = obj end)
Citizen.Wait(0)
end
PlayerData = ESX.GetPlayerData()
end)
local suankicadir = nil
local blips = {}
local AvailableCadir = {}
local kampcoords = vector3(20.21333, -1239.88, 29.295)
local kamp = {
[1] = {stash = vector3(31.53134, -1238.87, 29.307), obj = nil},
[2] = {stash = vector3(23.93257, -1235.58, 29.295), obj = nil},
[3] = {stash = vector3(20.31522, -1242.37, 29.295), obj = nil},
[4] = {stash = vector3(15.12099, -1231.14, 29.295), obj = nil},
}
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
suankicadir = math.random(1, #kamp)
ESX.ShowNotification('Yeni Çadırın: '..suankicadir)
CreateBlip()
end)
RegisterCommand('rcadir',function()
hascadir = true
suankicadir = math.random(1, #kamp)
ESX.ShowNotification('Yeni Çadırın: '..suankicadir)
if hascadir then
DeleteBlip()
end
CreateBlip()
end)
local sleep = 2000
Citizen.CreateThread(function()
while true do
if suankicadir ~= nil then
local player = PlayerPedId()
local playercoords = GetEntityCoords(player)
local stashdistance = #(playercoords - kamp[suankicadir].stash)
local kampdis = #(playercoords - kampcoords)
if kampdis <= 15.0 then
sleep = 5
if stashdistance <= 1.5 then
DrawText3D(kamp[suankicadir].stash, '[~g~E~w~] - Küçük Çanta')
DrawMarker(2, kamp[suankicadir].stash.x,kamp[suankicadir].stash.y,kamp[suankicadir].stash.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.4, 0.1, 255, 86, 27, 255, 0, 0, 0, 1, 0, 0, 0)
if IsControlJustReleased(0, 38) then
OpenStash()
end
end
else
sleep = 2000
end
end
Citizen.Wait(sleep)
end
end)
OpenStash = function()
TriggerServerEvent("inventory:server:OpenInventory", "stash", "Cadir_"..ESX.GetPlayerData().identifier,{maxweight = 10000,slots = 10,})
TriggerEvent("inventory:client:SetCurrentStash","Cadir_"..ESX.GetPlayerData().identifier)
end
function CreateBlip()
blip = AddBlipForCoord(kamp[suankicadir].stash,kamp[suankicadir].stash.y)
SetBlipSprite(blip, 547)
SetBlipScale(blip, 0.6)
SetBlipColour(blip, 4)
SetBlipAsShortRange(blip, false)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Çadırım")
EndTextCommandSetBlipName(blip)
end
function DeleteBlip()
if DoesBlipExist(blip) then
RemoveBlip(blip)
end
end
function DrawText3D(coord, text)
local onScreen,_x,_y=GetScreenCoordFromWorldCoord(coord.x, coord.y, coord.z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
local scale = 0.3
if onScreen then
SetTextScale(scale, scale)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextDropshadow(0)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 380
DrawRect(_x, _y + 0.0120, 0.0 + factor, 0.025, 41, 11, 41, 100)
end
end