diff --git a/config.lua b/config.lua index cc22dc28..f072bfbb 100644 --- a/config.lua +++ b/config.lua @@ -16,7 +16,8 @@ Config.Zones = { } }, - blackweashop = { + + BlackWeashop = { legal=1, Items = {}, Pos = { diff --git a/esx_weashops.sql b/esx_weashops.sql index 9e4ef2d2..a7a907cd 100644 --- a/esx_weashops.sql +++ b/esx_weashops.sql @@ -6,12 +6,11 @@ CREATE TABLE `weashops` ( `name` varchar(255) NOT NULL, `item` varchar(255) NOT NULL, `price` int(11) NOT NULL, - `label` varchar(255) NOT NULL, PRIMARY KEY (`id`) ); -INSERT INTO `weashops` (name, item, price, label) VALUES - ('GunShop','WEAPON_Pistol',300, 'pistol'), - ('blackweashop','WEAPON_Pistol',500, 'pistol') +INSERT INTO `weashops` (name, item, price) VALUES + ('GunShop','WEAPON_PISTOL',300), + ('BlackWeashop','WEAPON_PISTOL',500) ; \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 56b81495..9fe64e37 100644 --- a/server/main.lua +++ b/server/main.lua @@ -3,22 +3,6 @@ local ItemsLabels = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -AddEventHandler('onMySQLReady', function() - - MySQL.Async.fetchAll( - 'SELECT * FROM items', - {}, - function(result) - - for i=1, #result, 1 do - ItemsLabels[result[i].name] = result[i].label - end-- - - end - ) - -end) - ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb) MySQL.Async.fetchAll( @@ -61,7 +45,7 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price, zone) xPlayer.removeAccountMoney('black_money', price) xPlayer.addWeapon(itemName, 42) - TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName]) + TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ESX.GetWeaponLabel(itemName)) else TriggerClientEvent('esx:showNotification', _source, _U('not_enough_black')) @@ -72,7 +56,7 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price, zone) xPlayer.removeMoney(price) xPlayer.addWeapon(itemName, 42) - TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName]) + TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ESX.GetWeaponLabel(itemName)) else TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))