Check if player already has weapon

This commit is contained in:
ElPumpo
2018-11-11 11:22:41 +01:00
parent b50650db54
commit 093d5535a6
9 changed files with 34 additions and 9 deletions
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['br'] = {
['buy_license'] = 'buy weapon license?',
['yes'] = '%s',
['no'] = 'no',
['buy'] = 'você comprou %s',
['buy'] = 'você comprou ~y~%s~s~ for ~r~R$%s~s~',
['not_enough_black'] = 'você não tem dinheiro sujo suficiente',
['not_enough'] = 'você não tem dinheiro suficiente',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'comprar',
['shop_menu'] = 'pressione ~INPUT_CONTEXT~ para comprar armas.',
['shop_menu_item'] = 'R$%s',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['de'] = {
['buy_license'] = 'buy weapon license?',
['yes'] = '%s',
['no'] = 'no',
['buy'] = 'du kaufst %s',
['buy'] = 'du kaufst ~y~%s~s~ for ~r~%s EUR~s~',
['not_enough_black'] = 'du hast nicht genug Schwarzgeld',
['not_enough'] = 'du hast nicht genug Geld',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'geschäft',
['shop_menu'] = 'drücke ~INPUT_CONTEXT~ um auf das Geschäft zuzugreifen.',
['shop_menu_item'] = '%s EUR',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['en'] = {
['buy_license'] = 'buy weapon license?',
['yes'] = '%s',
['no'] = 'no',
['buy'] = 'you bought %s',
['buy'] = 'you bought ~y~%s~s~ for ~r~$%s~s~',
['not_enough_black'] = 'you do not have enough dirty money',
['not_enough'] = 'you do not have enough money',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'weapon shop',
['shop_menu'] = 'press ~INPUT_CONTEXT~ to access the ~y~weapon store~s~.',
['shop_menu_item'] = '$%s',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['es'] = {
['buy_license'] = 'buy weapon license?',
['yes'] = '%s',
['no'] = 'no',
['buy'] = 'has comprado %s',
['buy'] = 'has comprado ~y~%s~s~ for ~r~%s EUR~s~',
['not_enough_black'] = 'usted no tiene ~r~suficiente~s~ dinero negro',
['not_enough'] = 'usted no tiene ~r~suficiente~s~ dinero',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'tienda',
['shop_menu'] = 'presione ~INPUT_CONTEXT~ para acceder a la tienda.',
['shop_menu_item'] = '%s EUR',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['fi'] = {
['buy_license'] = 'osta lisenssi?',
['yes'] = '%s',
['no'] = 'ei',
['buy'] = 'sinä ostit %s',
['buy'] = 'sinä ostit ~y~%s~s~ for ~r~%s EUR~s~',
['not_enough_black'] = 'ei tarpeeksi likaista rahaa',
['not_enough'] = 'sinulla ei ole tarpeeksi rahaa',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'kauppa',
['shop_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi kauppa ikkuna.',
['shop_menu_item'] = '%s EUR',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['fr'] = {
['buy_license'] = 'acheter une license?',
['yes'] = '%s',
['no'] = 'non',
['buy'] = 'vous avez acheté %s',
['buy'] = 'vous avez acheté ~y~%s~s~ for ~r~%s EUR~s~',
['not_enough_black'] = 'Vous n\'avez ~r~pas assez~s~ d\'argent sale',
['not_enough'] = 'vous n\'avez ~r~pas assez~s~ d\'argent',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'magasin',
['shop_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.',
['shop_menu_item'] = '%s EUR',
+2 -1
View File
@@ -2,9 +2,10 @@ Locales ['pl'] = {
['buy_license'] = 'czy chcesz kupić licencję?',
['yes'] = '%s',
['no'] = 'nie',
['buy'] = 'kupiłeś/aś %s',
['buy'] = 'kupiłeś/aś ~y~%s~s~ for ~r~%s PLN~s~',
['not_enough_black'] = 'nie masz wystarczająco brudnej kasy',
['not_enough'] = 'nie masz wystarczająco pieniędzy',
['already_owned'] = 'you already own this weapon!',
['shop'] = 'sklep',
['shop_menu'] = 'Wciśnij ~INPUT_CONTEXT~ aby otworzyć sklep.',
['shop_menu_item'] = '%s PLN',
+13
View File
@@ -0,0 +1,13 @@
Locales ['sv'] = {
['buy_license'] = 'vill du köpa ett vapenlicens?',
['yes'] = '%s',
['no'] = 'nej tack',
['buy'] = 'du köpte ~y~%s~s~ för ~r~%s SEK~s~',
['not_enough_black'] = 'du har inte tillräckligt med svarta pengar',
['not_enough'] = 'du har inte råd för detta',
['already_owned'] = 'du äger redan detta vapen!',
['shop'] = 'vapenaffär',
['shop_menu'] = 'tryck ~INPUT_CONTEXT~ för att komma åt ~y~vapenaffären~s~.',
['shop_menu_item'] = '%s SEK',
['map_blip'] = 'vapenaffär',
}
+7 -2
View File
@@ -58,12 +58,17 @@ AddEventHandler('esx_weashop:buyItem', function(weaponName, zone)
local xPlayer = ESX.GetPlayerFromId(_source)
local price = GetPrice(weaponName, zone)
if xPlayer.hasWeapon(weaponName) then
TriggerClientEvent('esx:showNotification', _source, _U('already_owned'))
return
end
if zone == "BlackWeashop" then
if xPlayer.getAccount('black_money').money >= price then
xPlayer.removeAccountMoney('black_money', price)
xPlayer.addWeapon(weaponName, 42)
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(weaponName)))
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(weaponName), price))
else
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_black'))
end
@@ -73,7 +78,7 @@ AddEventHandler('esx_weashop:buyItem', function(weaponName, zone)
if xPlayer.getMoney() >= price then
xPlayer.removeMoney(price)
xPlayer.addWeapon(weaponName, 42)
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(weaponName)))
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(weaponName), price))
else
TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))
end