From 8a6579fd7e7c8a8469dbf92dd7c3df6d3842512d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 24 Mar 2020 10:57:25 +0100 Subject: [PATCH] Added /setaccountmoney command, closes #558 --- locales/br.lua | 2 ++ locales/cs.lua | 2 ++ locales/de.lua | 2 ++ locales/en.lua | 2 ++ locales/fi.lua | 2 ++ locales/fr.lua | 2 ++ locales/pl.lua | 2 ++ locales/sv.lua | 2 ++ server/commands.lua | 12 ++++++++++++ 9 files changed, 28 insertions(+) diff --git a/locales/br.lua b/locales/br.lua index df6faba3..d63f2867 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -80,6 +80,8 @@ Locales['br'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/cs.lua b/locales/cs.lua index 3c47581e..10c1d3a0 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -80,6 +80,8 @@ Locales['cs'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/de.lua b/locales/de.lua index 34ba3e4f..30ae1a18 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -80,6 +80,8 @@ Locales['de'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/en.lua b/locales/en.lua index 8edbe2a5..a5ec7122 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -80,6 +80,8 @@ Locales['en'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/fi.lua b/locales/fi.lua index a6abf874..034aebd3 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -80,6 +80,8 @@ Locales['fi'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/fr.lua b/locales/fr.lua index d0be55c0..c5d74c80 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -80,6 +80,8 @@ Locales['fr'] = { ['command_giveweaponcomponent_missingweapon'] = 'le joueur n\'a pas cette arme', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'se téléporter aux coordonnées', ['command_setcoords_x'] = 'axe X', ['command_setcoords_y'] = 'axe Y', diff --git a/locales/pl.lua b/locales/pl.lua index 31f1bf50..2a04b378 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -80,6 +80,8 @@ Locales['pl'] = { ['command_giveweaponcomponent_missingweapon'] = 'player does not have that weapon', ['command_save'] = 'save a player to database', ['command_saveall'] = 'save all players to database', + ['command_setaccountmoney'] = 'set account money for a player', + ['command_setaccountmoney_amount'] = 'amount of money to set', ['command_setcoords'] = 'teleport to coordinates', ['command_setcoords_x'] = 'x axis', ['command_setcoords_y'] = 'y axis', diff --git a/locales/sv.lua b/locales/sv.lua index 7c222e50..5cb32c29 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -80,6 +80,8 @@ Locales['sv'] = { ['command_giveweaponcomponent_missingweapon'] = 'spelaren har ej det vapnet', ['command_save'] = 'spara en spelare i databas', ['command_saveall'] = 'spara alla spelare i databas', + ['command_setaccountmoney'] = 'bestäm ny balans på ett spelarkonto', + ['command_setaccountmoney_amount'] = 'ny balans', ['command_setcoords'] = 'teleportera till koordinater', ['command_setcoords_x'] = 'x axel', ['command_setcoords_y'] = 'y axel', diff --git a/server/commands.lua b/server/commands.lua index 39c4a6ce..11d8f941 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -30,6 +30,18 @@ end, false, {help = _U('command_cardel'), validate = false, arguments = { {name = 'radius', help = _U('command_cardel_radius'), type = 'any'} }}) +ESX.RegisterCommand('setaccountmoney', 'admin', function(xPlayer, args, showError) + if args.playerId.getAccount(args.account) then + args.playerId.setAccountMoney(args.account, args.amount) + else + showError(_U('command_giveaccountmoney_invalid')) + end +end, true, {help = _U('command_setaccountmoney'), validate = true, arguments = { + {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}, + {name = 'account', help = _U('command_giveaccountmoney_account'), type = 'string'}, + {name = 'amount', help = _U('command_setaccountmoney_amount'), type = 'number'} +}}) + ESX.RegisterCommand('giveaccountmoney', 'admin', function(xPlayer, args, showError) if args.playerId.getAccount(args.account) then args.playerId.addAccountMoney(args.account, args.amount)