Gom Fivem -

-- Claim turf RegisterNetEvent('gom:claimTurf') AddEventHandler('gom:claimTurf', function(zoneName, coords) local src = source local Player = QBCore.Functions.GetPlayer(src)

MySQL.Async.fetchAll('SELECT g.* FROM gom_gangs g JOIN gom_members m ON g.id = m.gang_id WHERE m.identifier = @identifier', { ['@identifier'] = identifier }, function(result) if result[1] then cb(result[1]) else cb(nil) end end) end) gom fivem

-- Periodic income from turfs Citizen.CreateThread(function() while true do Citizen.Wait(1800000) -- Every 30 minutes MySQL.Async.fetchAll('SELECT * FROM gom_turfs', {}, function(turfs) for _, turf in pairs(turfs) do MySQL.Async.execute('UPDATE gom_gangs SET money = money + @income WHERE id = @gang_id', { ['@income'] = turf.income_rate, ['@gang_id'] = turf.gang_id }) end end) end end) ( client/gom_client.lua ) local QBCore = exports['qb-core']:GetCoreObject() local playerGang = nil local currentTurfZones = {} -- Get player gang on spawn RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.TriggerCallback('gom:getPlayerGang', function(gang) playerGang = gang end) end) { ['@identifier'] = identifier }

-- Stash system RegisterNetEvent('gom:storeItem') AddEventHandler('gom:storeItem', function(itemName, quantity) local src = source exports['gom']:getPlayerGang(src, function(gang) if gang then MySQL.Async.fetchAll('SELECT * FROM gom_stash WHERE gang_id = @gang_id AND item_name = @item', { ['@gang_id'] = gang.id, ['@item'] = itemName }, function(result) if result[1] then MySQL.Async.execute('UPDATE gom_stash SET quantity = quantity + @q WHERE id = @id', { ['@q'] = quantity, ['@id'] = result[1].id }) else MySQL.Async.insert('INSERT INTO gom_stash (gang_id, item_name, quantity) VALUES (@gang_id, @item, @q)', { ['@gang_id'] = gang.id, ['@item'] = itemName, ['@q'] = quantity }) end TriggerClientEvent('QBCore:Notify', src, 'Item stored in gang stash', 'success') end) end end) end) function(turfs) for _

CREATE TABLE gom_stash ( id INT PRIMARY KEY AUTO_INCREMENT, gang_id INT NOT NULL, item_name VARCHAR(50) NOT NULL, quantity INT DEFAULT 0, FOREIGN KEY ( gang_id ) REFERENCES gom_gangs ( id ) ); ( server/gom_server.lua ) local QBCore = exports['qb-core']:GetCoreObject() local gangs = {} -- Create gang RegisterNetEvent('gom:createGang') AddEventHandler('gom:createGang', function(gangName, color) local src = source local Player = QBCore.Functions.GetPlayer(src) local identifier = Player.PlayerData.citizenid

files { 'html/ .html', 'html/ .css', 'html/*.js' }

Ðåãèñòðàöèÿ