Add givemoney, giveaccountmoney, giveitem and giveweapon commands

This commit is contained in:
Jérémie N'gadi
2017-08-12 23:42:24 +02:00
parent 237cedeed6
commit e270494b1d
@@ -47,3 +47,71 @@ end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = 'Spawn un véhicule'})
TriggerEvent('es:addGroupCommand', 'givemoney', 'admin', function(source, args, user)
local _source = source
local xPlayer = ESX.GetPlayerFromId(args[2])
local amount = tonumber(args[3])
if amount ~= nil then
xPlayer.addMoney(amount)
else
TriggerClientEvent('esx:showNotification', _source, 'Montant invalide')
end
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = 'givemoney [id] [montant]'})
TriggerEvent('es:addGroupCommand', 'giveaccountmoney', 'admin', function(source, args, user)
local _source = source
local xPlayer = ESX.GetPlayerFromId(args[2])
local account = args[3]
local amount = tonumber(args[4])
if amount ~= nil then
if xPlayer.getAccount(account) ~= nil then
xPlayer.addAccountMoney(account, amount)
else
TriggerClientEvent('esx:showNotification', _source, 'Compte invalide')
end
else
TriggerClientEvent('esx:showNotification', _source, 'Montant invalide')
end
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = 'giveaccountmoney [id] [compte] [montant]'})
TriggerEvent('es:addGroupCommand', 'giveitem', 'admin', function(source, args, user)
local _source = source
local xPlayer = ESX.GetPlayerFromId(args[2])
local item = args[3]
local count = (args[4] == nil and 1 or tonumber(args[4]))
if count ~= nil then
if xPlayer.getInventoryItem(item) ~= nil then
xPlayer.addInventoryItem(item, count)
else
TriggerClientEvent('esx:showNotification', _source, 'Item invalide')
end
else
TriggerClientEvent('esx:showNotification', _source, 'Quantité invalide')
end
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = 'giveitem [id] [item] [[quantité]]'})
TriggerEvent('es:addGroupCommand', 'giveweapon', 'admin', function(source, args, user)
local xPlayer = ESX.GetPlayerFromId(args[2])
local weaponName = string.upper(args[3])
xPlayer.addWeapon(weaponName, 1000)
end, function(source, args, user)
TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.")
end, {help = 'giveweapon [id] [arme]'})