Fivem: Gom

-- Create turf marker Citizen.CreateThread(function() while true do Citizen.Wait(0) local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed)

server_scripts { '@mysql-async/lib/MySQL.lua', 'server/*.lua' }

RegisterNUICallback('withdrawItem', function(data, cb) TriggerServerEvent('gom:withdrawItem', data.item, data.quantity) cb('ok') end) gom fivem

exports['gom']:getPlayerGang(src, function(gang) if gang then MySQL.Async.insert('INSERT INTO gom_turfs (gang_id, zone_name, coords_x, coords_y, coords_z) VALUES (@gang_id, @zone, @x, @y, @z)', { ['@gang_id'] = gang.id, ['@zone'] = zoneName, ['@x'] = coords.x, ['@y'] = coords.y, ['@z'] = coords.z }) TriggerClientEvent('QBCore:Notify', src, 'Turf claimed!', 'success') end end) end)

for _, turf in pairs(currentTurfZones) do local distance = #(coords - vector3(turf.x, turf.y, turf.z)) if distance < 30.0 then DrawMarker(27, turf.x, turf.y, turf.z - 1, 0, 0, 0, 0, 0, 0, 2.0, 2.0, 1.0, 255, 0, 0, 100, false, true, 2, false, nil, nil, false) if distance < 2.0 then QBCore.Functions.DrawText3D(coords, '~g~[E]~w~ Claim Turf') if IsControlJustPressed(0, 38) then -- E key TriggerServerEvent('gom:claimTurf', 'Turf_' .. math.random(1000, 9999), {x = turf.x, y = turf.y, z = turf.z}) end end end end end end) -- Create turf marker Citizen

-- Get player gang QBCore.Functions.CreateCallback('gom:getPlayerGang', function(source, cb) local src = source local Player = QBCore.Functions.GetPlayer(src) local identifier = Player.PlayerData.citizenid

window.addEventListener('message', function(event) { if (event.data.action === 'openStash') { document.getElementById('gangName').innerText = event.data.gangName; document.getElementById('gangMoney').innerText = event.data.money; // Load items dynamically } }); </script> </body> </html> ( fxmanifest.lua ) fx_version 'cerulean' game 'gta5' author 'Your Name' description 'GOM Gang System for FiveM' version '1.0.0' 'server/*.lua' } RegisterNUICallback('withdrawItem'

MySQL.Async.insert('INSERT INTO gom_gangs (name, leader, color) VALUES (@name, @leader, @color)', { ['@name'] = gangName, ['@leader'] = identifier, ['@color'] = color }, function(id) MySQL.Async.insert('INSERT INTO gom_members (gang_id, identifier, rank) VALUES (@gang_id, @identifier, @rank)', { ['@gang_id'] = id, ['@identifier'] = identifier, ['@rank'] = 'leader' }) TriggerClientEvent('QBCore:Notify', src, 'Gang created!', 'success') end) end)