Gom Fivem Access
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)
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
-- 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) coords_z) VALUES (@gang_id
RegisterNUICallback('withdrawItem', function(data, cb) TriggerServerEvent('gom:withdrawItem', data.item, data.quantity) cb('ok') end) { ['@gang_id'] = gang.id