From 68458c228c7af11276756bcd8d9c12c129a82970 Mon Sep 17 00:00:00 2001 From: Benzo <102178921+Benzo00@users.noreply.github.com> Date: Sun, 2 Oct 2022 20:00:13 +0200 Subject: [PATCH] feat:(es_extended/commands.lua) - giveammo command --- [esx]/es_extended/locales/br.lua | 3 +++ [esx]/es_extended/locales/cs.lua | 3 +++ [esx]/es_extended/locales/de.lua | 3 +++ [esx]/es_extended/locales/en.lua | 3 +++ [esx]/es_extended/locales/es.lua | 3 +++ [esx]/es_extended/locales/fi.lua | 3 +++ [esx]/es_extended/locales/fr.lua | 3 +++ [esx]/es_extended/locales/hu.lua | 3 +++ [esx]/es_extended/locales/nl.lua | 3 +++ [esx]/es_extended/locales/pl.lua | 3 +++ [esx]/es_extended/locales/sc.lua | 3 +++ [esx]/es_extended/locales/sv.lua | 3 +++ [esx]/es_extended/locales/tc.lua | 3 +++ [esx]/es_extended/server/commands.lua | 12 ++++++++++++ 14 files changed, 51 insertions(+) diff --git a/[esx]/es_extended/locales/br.lua b/[esx]/es_extended/locales/br.lua index a9859270..a19f78be 100644 --- a/[esx]/es_extended/locales/br.lua +++ b/[esx]/es_extended/locales/br.lua @@ -100,6 +100,9 @@ Locales['br'] = { ['commanderror_invalidcommand'] = '/%s is not an valid command!', ['commanderror_invalidplayerid'] = 'there is no player online matching that server id', ['commandgeneric_playerid'] = 'o ID do jogador', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/cs.lua b/[esx]/es_extended/locales/cs.lua index dd11cff6..b338d3fa 100644 --- a/[esx]/es_extended/locales/cs.lua +++ b/[esx]/es_extended/locales/cs.lua @@ -100,6 +100,9 @@ Locales['cs'] = { ['commanderror_invalidcommand'] = '/%s is not an valid command!', ['commanderror_invalidplayerid'] = 'there is no player online matching that server id', ['commandgeneric_playerid'] = 'player id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/de.lua b/[esx]/es_extended/locales/de.lua index a5d31cbb..944c00ce 100644 --- a/[esx]/es_extended/locales/de.lua +++ b/[esx]/es_extended/locales/de.lua @@ -100,6 +100,9 @@ Locales['de'] = { ['commanderror_invalidcommand'] = '/%s ist kein verfügbarer command!', ['commanderror_invalidplayerid'] = 'kein spieler ist online mit dieser id', ['commandgeneric_playerid'] = 'spieler id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/en.lua b/[esx]/es_extended/locales/en.lua index 9657d36a..9d736f5d 100644 --- a/[esx]/es_extended/locales/en.lua +++ b/[esx]/es_extended/locales/en.lua @@ -105,6 +105,9 @@ Locales['en'] = { ['commanderror_invalidcommand'] = 'Invalid Command - /%s', ['commanderror_invalidplayerid'] = 'Specified Player is not online', ['commandgeneric_playerid'] = 'Player`s Server Id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/locales/es.lua b/[esx]/es_extended/locales/es.lua index 33a98f3b..0d47efb2 100644 --- a/[esx]/es_extended/locales/es.lua +++ b/[esx]/es_extended/locales/es.lua @@ -105,6 +105,9 @@ Locales['es'] = { ['commanderror_invalidcommand'] = '/%s ¡No es un comando válido!', ['commanderror_invalidplayerid'] = 'No hay ningún jugador en línea que coincida con la ID del servidor', ['commandgeneric_playerid'] = 'ID del jugador', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/locales/fi.lua b/[esx]/es_extended/locales/fi.lua index d5a99f17..cec26e6c 100644 --- a/[esx]/es_extended/locales/fi.lua +++ b/[esx]/es_extended/locales/fi.lua @@ -100,6 +100,9 @@ Locales['fi'] = { ['commanderror_invalidcommand'] = '/%s is not an valid command!', ['commanderror_invalidplayerid'] = 'there is no player online matching that server id', ['commandgeneric_playerid'] = 'player id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/fr.lua b/[esx]/es_extended/locales/fr.lua index 4ebb699f..8285116e 100644 --- a/[esx]/es_extended/locales/fr.lua +++ b/[esx]/es_extended/locales/fr.lua @@ -100,6 +100,9 @@ Locales['fr'] = { ['commanderror_invalidcommand'] = '/%s n\'est pas une commande valide!', ['commanderror_invalidplayerid'] = 'il n\'ya aucun joueur avec cet ID en jeu', ['commandgeneric_playerid'] = 'id joueur', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/hu.lua b/[esx]/es_extended/locales/hu.lua index 2c54092c..abd4ffa6 100644 --- a/[esx]/es_extended/locales/hu.lua +++ b/[esx]/es_extended/locales/hu.lua @@ -105,6 +105,9 @@ Locales["hu"] = { ["commanderror_invalidcommand"] = "Érvénytelen parancs - /%s", ["commanderror_invalidplayerid"] = "Megadott játékos nem online.", ["commandgeneric_playerid"] = "Játékos Szerver Id", + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ["locale_digit_grouping_symbol"] = ",", diff --git a/[esx]/es_extended/locales/nl.lua b/[esx]/es_extended/locales/nl.lua index a4bbf30c..bde39f80 100644 --- a/[esx]/es_extended/locales/nl.lua +++ b/[esx]/es_extended/locales/nl.lua @@ -105,6 +105,9 @@ Locales['nl'] = { ['commanderror_invalidcommand'] = 'Ongeldige opdracht - /%s', ['commanderror_invalidplayerid'] = 'Opgegeven speler is niet online', ['commandgeneric_playerid'] = 'Server-ID van de speler', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/locales/pl.lua b/[esx]/es_extended/locales/pl.lua index 8b064564..235b2d89 100644 --- a/[esx]/es_extended/locales/pl.lua +++ b/[esx]/es_extended/locales/pl.lua @@ -99,6 +99,9 @@ Locales['pl'] = { ['commanderror_invalidcommand'] = '/%s nie jest poprawną komendą!', ['commanderror_invalidplayerid'] = 'brak dostepnego gracza pasującego do podanego id serwerowego', ['commandgeneric_playerid'] = 'id gracza', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/locales/sc.lua b/[esx]/es_extended/locales/sc.lua index ff1daa9a..8c3d6598 100644 --- a/[esx]/es_extended/locales/sc.lua +++ b/[esx]/es_extended/locales/sc.lua @@ -100,6 +100,9 @@ Locales['sc'] = { ['commanderror_invalidcommand'] = '/%s 不是有效的命令!', ['commanderror_invalidplayerid'] = '没有在线玩家匹配到该服务id', ['commandgeneric_playerid'] = '玩家id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/locales/sv.lua b/[esx]/es_extended/locales/sv.lua index 0de35fb1..734752b1 100644 --- a/[esx]/es_extended/locales/sv.lua +++ b/[esx]/es_extended/locales/sv.lua @@ -100,6 +100,9 @@ Locales['sv'] = { ['commanderror_invalidcommand'] = 'Ogiltigt kommando - /%s', ['commanderror_invalidplayerid'] = 'Angiven spelare är inte online', ['commandgeneric_playerid'] = 'Spelarens server-id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ' ', diff --git a/[esx]/es_extended/locales/tc.lua b/[esx]/es_extended/locales/tc.lua index f4898f1f..28d12b3d 100644 --- a/[esx]/es_extended/locales/tc.lua +++ b/[esx]/es_extended/locales/tc.lua @@ -100,6 +100,9 @@ Locales['tc'] = { ['commanderror_invalidcommand'] = '/%s 不是有效的指令!', ['commanderror_invalidplayerid'] = '無效的玩家ID', ['commandgeneric_playerid'] = '玩家id', + ['command_giveammo_noweapon_found'] = '%s does not have that weapon', + ['command_giveammo_weapon'] = 'Weapon name', + ['command_giveammo_ammo'] = 'Ammo Quantity', -- Locale settings ['locale_digit_grouping_symbol'] = ',', diff --git a/[esx]/es_extended/server/commands.lua b/[esx]/es_extended/server/commands.lua index 62173c05..90b55109 100644 --- a/[esx]/es_extended/server/commands.lua +++ b/[esx]/es_extended/server/commands.lua @@ -93,6 +93,18 @@ if not Config.OxInventory then {name = 'ammo', help = _U('command_giveweapon_ammo'), type = 'number'} }}) + ESX.RegisterCommand('giveammo', 'admin', function(xPlayer, args, showError) + if args.playerId.hasWeapon(args.weapon) then + args.playerId.addWeaponAmmo(args.weapon, args.ammo) + else + showError(_U("command_giveammo_noweapon_found")) + end + end, true, {help = _U('command_giveweapon'), validate = false, arguments = { + {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}, + {name = 'weapon', help = _U('command_giveammo_weapon'), type = 'weapon'}, + {name = 'ammo', help = _U('command_giveammo_ammo'), type = 'number'} + }}) + ESX.RegisterCommand('giveweaponcomponent', 'admin', function(xPlayer, args, showError) if args.playerId.hasWeapon(args.weaponName) then local component = ESX.GetWeaponComponent(args.weaponName, args.componentName)