Re-done locale names for commands, moved hardcoded strings to locale and added /setgroup command

This commit is contained in:
ElPumpo
2020-03-04 12:41:57 +01:00
parent c4655598f9
commit 4e4ebfff7b
10 changed files with 378 additions and 195 deletions
+45 -38
View File
@@ -1,65 +1,65 @@
ESX.RegisterCommand('setcoords', 'admin', function(xPlayer, args, showError)
xPlayer.setCoords({x = args.x, y = args.y, z = args.z})
end, false, {help = 'Teleport to coordinates', validate = true, arguments = {
{name = 'x', help = 'X coords', type = 'number'},
{name = 'y', help = 'Y coords', type = 'number'},
{name = 'z', help = 'Z coords', type = 'number'}
end, false, {help = _U('command_setcoords'), validate = true, arguments = {
{name = 'x', help = _U('command_setcoords_x'), type = 'number'},
{name = 'y', help = _U('command_setcoords_y'), type = 'number'},
{name = 'z', help = _U('command_setcoords_z'), type = 'number'}
}})
ESX.RegisterCommand('setjob', 'admin', function(xPlayer, args, showError)
if ESX.DoesJobExist(args.job, args.grade) then
args.playerId.setJob(args.job, args.grade)
else
showError('That job does not exist')
showError(_U('command_setjob_invalid'))
end
end, true, {help = _U('setjob'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'},
{name = 'job', help = _U('setjob_param2'), type = 'string'},
{name = 'grade', help = _U('setjob_param3'), type = 'number'}
end, true, {help = _U('command_setjob'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'job', help = _U('command_setjob_job'), type = 'string'},
{name = 'grade', help = _U('command_setjob_grade'), type = 'number'}
}})
ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
xPlayer.triggerEvent('esx:spawnVehicle', args.car)
end, false, {help = _U('spawn_car'), validate = false, arguments = {
{name = 'car', help = _U('spawn_car_param'), type = 'any'}
end, false, {help = _U('command_car'), validate = false, arguments = {
{name = 'car', help = _U('command_car_car'), type = 'any'}
}})
ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args, showError)
xPlayer.triggerEvent('esx:deleteVehicle', args.radius)
end, false, {help = _U('spawn_car'), validate = false, arguments = {
{name = 'radius', help = 'Optional, delete every vehicle within the specified radius', type = 'any'}
end, false, {help = _U('command_cardel'), validate = false, arguments = {
{name = 'radius', help = _U('command_cardel_radius'), type = 'any'}
}})
ESX.RegisterCommand('giveaccountmoney', 'admin', function(xPlayer, args, showError)
if args.playerId.getAccount(args.account) then
args.playerId.addAccountMoney(args.account, args.amount)
else
showError(_U('invalid_account'))
showError(_U('command_giveaccountmoney_invalid'))
end
end, true, {help = _U('giveaccountmoney'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'},
{name = 'account', help = _U('account'), type = 'string'},
{name = 'amount', help = _U('money_amount'), type = 'number'}
end, true, {help = _U('command_giveaccountmoney'), 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_giveaccountmoney_amount'), type = 'number'}
}})
ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args, showError)
args.playerId.addInventoryItem(args.item, args.count)
end, true, {help = _U('giveitem'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'},
{name = 'item', help = _U('item'), type = 'item'},
{name = 'count', help = _U('amount'), type = 'number'}
end, true, {help = _U('command_giveitem'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'item', help = _U('command_giveitem_item'), type = 'item'},
{name = 'count', help = _U('command_giveitem_count'), type = 'number'}
}})
ESX.RegisterCommand('giveweapon', 'admin', function(xPlayer, args, showError)
if args.playerId.hasWeapon(args.weapon) then
showError('Player already has that weapon')
showError(_U('command_giveweapon_hasalready'))
else
xPlayer.addWeapon(args.weapon, args.ammo)
end
end, true, {help = _U('giveweapon'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'},
{name = 'weapon', help = _U('weapon'), type = 'weapon'},
{name = 'ammo', help = _U('amountammo'), type = 'number'}
end, true, {help = _U('command_giveweapon'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'weapon', help = _U('command_giveweapon_weapon'), type = 'weapon'},
{name = 'ammo', help = _U('command_giveweapon_ammo'), type = 'number'}
}})
ESX.RegisterCommand('giveweaponcomponent', 'admin', function(xPlayer, args, showError)
@@ -68,29 +68,29 @@ ESX.RegisterCommand('giveweaponcomponent', 'admin', function(xPlayer, args, show
if component then
if xPlayer.hasWeaponComponent(args.weaponName, args.componentName) then
showError('Player already has that weapon component')
showError(_U('command_giveweaponcomponent_hasalready'))
else
xPlayer.addWeaponComponent(args.weaponName, args.componentName)
end
else
showError('Invalid weapon component')
showError(_U('command_giveweaponcomponent_invalid'))
end
else
showError('Player does not have that weapon')
showError(_U('command_giveweaponcomponent_missingweapon'))
end
end, true, {help = 'Give weapon component', validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'},
{name = 'weaponName', help = _U('weapon'), type = 'weapon'},
{name = 'componentName', help = 'weapon component', type = 'string'}
end, true, {help = _U('command_giveweaponcomponent'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'weaponName', help = _U('command_giveweapon_weapon'), type = 'weapon'},
{name = 'componentName', help = _U('command_giveweaponcomponent_component'), type = 'string'}
}})
ESX.RegisterCommand({'clear', 'cls'}, 'user', function(xPlayer, args, showError)
xPlayer.triggerEvent('chat:clear')
end, false, {help = _U('chat_clear')})
end, false, {help = _U('command_clear')})
ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer, args, showError)
TriggerClientEvent('chat:clear', -1)
end, false, {help = _U('chat_clear_all')})
end, false, {help = _U('command_clearall')})
ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args, showError)
for k,v in ipairs(args.playerId.inventory) do
@@ -99,7 +99,7 @@ ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args, showError
end
end
end, true, {help = _U('command_clearinventory'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'}
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
}})
ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, showError)
@@ -107,5 +107,12 @@ ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, showError)
args.playerId.removeWeapon(v.name)
end
end, true, {help = _U('command_clearloadout'), validate = true, arguments = {
{name = 'playerId', help = _U('id_param'), type = 'player'}
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
}})
ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, showError)
args.playerId.setGorup(args.group)
end, true, {help = _U('command_setgroup'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'group', help = _U('command_setgroup_group'), type = 'string'},
}})