Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.28 KB | None | 0 0
  1. ESX.RegisterCommand('setcoords', 'admin', function(xPlayer, args, showError)
  2.     xPlayer.setCoords({x = args.x, y = args.y, z = args.z})
  3. end, false, {help = _U('command_setcoords'), validate = true, arguments = {
  4.     {name = 'x', help = _U('command_setcoords_x'), type = 'number'},
  5.     {name = 'y', help = _U('command_setcoords_y'), type = 'number'},
  6.     {name = 'z', help = _U('command_setcoords_z'), type = 'number'}
  7. }})
  8.  
  9. ESX.RegisterCommand('setjob', 'admin', function(xPlayer, args, showError)
  10.     if ESX.DoesJobExist(args.job, args.grade) then
  11.         args.playerId.setJob(args.job, args.grade)
  12.     else
  13.         showError(_U('command_setjob_invalid'))
  14.     end
  15. end, true, {help = _U('command_setjob'), validate = true, arguments = {
  16.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  17.     {name = 'job', help = _U('command_setjob_job'), type = 'string'},
  18.     {name = 'grade', help = _U('command_setjob_grade'), type = 'number'}
  19. }})
  20.  
  21. ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
  22.     xPlayer.triggerEvent('esx:spawnVehicle', args.car)
  23. end, false, {help = _U('command_car'), validate = false, arguments = {
  24.     {name = 'car', help = _U('command_car_car'), type = 'any'}
  25. }})
  26.  
  27. ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args, showError)
  28.     xPlayer.triggerEvent('esx:deleteVehicle', args.radius)
  29. end, false, {help = _U('command_cardel'), validate = false, arguments = {
  30.     {name = 'radius', help = _U('command_cardel_radius'), type = 'any'}
  31. }})
  32.  
  33. ESX.RegisterCommand('setaccountmoney', 'admin', function(xPlayer, args, showError)
  34.     if args.playerId.getAccount(args.account) then
  35.         args.playerId.setAccountMoney(args.account, args.amount)
  36.     else
  37.         showError(_U('command_giveaccountmoney_invalid'))
  38.     end
  39. end, true, {help = _U('command_setaccountmoney'), validate = true, arguments = {
  40.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  41.     {name = 'account', help = _U('command_giveaccountmoney_account'), type = 'string'},
  42.     {name = 'amount', help = _U('command_setaccountmoney_amount'), type = 'number'}
  43. }})
  44.  
  45. ESX.RegisterCommand('giveaccountmoney', 'admin', function(xPlayer, args, showError)
  46.     if args.playerId.getAccount(args.account) then
  47.         args.playerId.addAccountMoney(args.account, args.amount)
  48.     else
  49.         showError(_U('command_giveaccountmoney_invalid'))
  50.     end
  51. end, true, {help = _U('command_giveaccountmoney'), validate = true, arguments = {
  52.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  53.     {name = 'account', help = _U('command_giveaccountmoney_account'), type = 'string'},
  54.     {name = 'amount', help = _U('command_giveaccountmoney_amount'), type = 'number'}
  55. }})
  56.  
  57. ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args, showError)
  58.     args.playerId.addInventoryItem(args.item, args.count)
  59. end, true, {help = _U('command_giveitem'), validate = true, arguments = {
  60.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  61.     {name = 'item', help = _U('command_giveitem_item'), type = 'item'},
  62.     {name = 'count', help = _U('command_giveitem_count'), type = 'number'}
  63. }})
  64.  
  65. ESX.RegisterCommand('giveweapon', 'admin', function(xPlayer, args, showError)
  66.     if args.playerId.hasWeapon(args.weapon) then
  67.         showError(_U('command_giveweapon_hasalready'))
  68.     else
  69.         xPlayer.addWeapon(args.weapon, args.ammo)
  70.     end
  71. end, true, {help = _U('command_giveweapon'), validate = true, arguments = {
  72.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  73.     {name = 'weapon', help = _U('command_giveweapon_weapon'), type = 'weapon'},
  74.     {name = 'ammo', help = _U('command_giveweapon_ammo'), type = 'number'}
  75. }})
  76.  
  77. ESX.RegisterCommand('giveweaponcomponent', 'admin', function(xPlayer, args, showError)
  78.     if args.playerId.hasWeapon(args.weaponName) then
  79.         local component = ESX.GetWeaponComponent(args.weaponName, args.componentName)
  80.  
  81.         if component then
  82.             if xPlayer.hasWeaponComponent(args.weaponName, args.componentName) then
  83.                 showError(_U('command_giveweaponcomponent_hasalready'))
  84.             else
  85.                 xPlayer.addWeaponComponent(args.weaponName, args.componentName)
  86.             end
  87.         else
  88.             showError(_U('command_giveweaponcomponent_invalid'))
  89.         end
  90.     else
  91.         showError(_U('command_giveweaponcomponent_missingweapon'))
  92.     end
  93. end, true, {help = _U('command_giveweaponcomponent'), validate = true, arguments = {
  94.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  95.     {name = 'weaponName', help = _U('command_giveweapon_weapon'), type = 'weapon'},
  96.     {name = 'componentName', help = _U('command_giveweaponcomponent_component'), type = 'string'}
  97. }})
  98.  
  99. ESX.RegisterCommand({'clear', 'cls'}, 'user', function(xPlayer, args, showError)
  100.     xPlayer.triggerEvent('chat:clear')
  101. end, false, {help = _U('command_clear')})
  102.  
  103. ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer, args, showError)
  104.     TriggerClientEvent('chat:clear', -1)
  105. end, false, {help = _U('command_clearall')})
  106.  
  107. ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args, showError)
  108.     for k,v in ipairs(args.playerId.inventory) do
  109.         if v.count > 0 then
  110.             args.playerId.setInventoryItem(v.name, 0)
  111.         end
  112.     end
  113. end, true, {help = _U('command_clearinventory'), validate = true, arguments = {
  114.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
  115. }})
  116.  
  117. ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, showError)
  118.     for k,v in ipairs(args.playerId.loadout) do
  119.         args.playerId.removeWeapon(v.name)
  120.     end
  121. end, true, {help = _U('command_clearloadout'), validate = true, arguments = {
  122.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
  123. }})
  124.  
  125. ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, showError)
  126.     args.playerId.setGroup(args.group)
  127. end, true, {help = _U('command_setgroup'), validate = true, arguments = {
  128.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
  129.     {name = 'group', help = _U('command_setgroup_group'), type = 'string'},
  130. }})
  131.  
  132. ESX.RegisterCommand('save', 'admin', function(xPlayer, args, showError)
  133.     ESX.SavePlayer(args.playerId)
  134. end, true, {help = _U('command_save'), validate = true, arguments = {
  135.     {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}
  136. }})
  137.  
  138. ESX.RegisterCommand('saveall', 'admin', function(xPlayer, args, showError)
  139.     ESX.SavePlayers()
  140. end, true, {help = _U('command_saveall')})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement