rename _source variable to playerId

This commit is contained in:
ElPumpo
2019-12-27 13:49:40 +01:00
parent aad435842b
commit 2d80e55631
4 changed files with 30 additions and 30 deletions
+10 -10
View File
@@ -55,7 +55,7 @@ end, function(source, args, user)
end, {help = _U('delete_vehicle')})
TriggerEvent('es:addGroupCommand', 'setmoney', 'admin', function(source, args, user)
local _source = source
local playerId = source
local target = tonumber(args[1])
local money_type = args[2]
local money_amount = tonumber(args[3])
@@ -70,17 +70,17 @@ TriggerEvent('es:addGroupCommand', 'setmoney', 'admin', function(source, args, u
elseif money_type == 'black' then
xPlayer.setAccountMoney('black_money', money_amount)
else
TriggerClientEvent('chatMessage', _source, 'SYSTEM', {255, 0, 0}, '^2' .. money_type .. ' ^0 is not a valid money type!')
TriggerClientEvent('chatMessage', playerId, 'SYSTEM', {255, 0, 0}, '^2' .. money_type .. ' ^0 is not a valid money type!')
return
end
else
TriggerClientEvent('chatMessage', _source, 'SYSTEM', {255, 0, 0}, 'Invalid arguments.')
TriggerClientEvent('chatMessage', playerId, 'SYSTEM', {255, 0, 0}, 'Invalid arguments.')
return
end
print('es_extended: ' .. GetPlayerName(source) .. ' just set $' .. money_amount .. ' (' .. money_type .. ') to ' .. xPlayer.name)
if xPlayer.source ~= _source then
if xPlayer.source ~= playerId then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('money_set', money_amount, money_type))
end
end, function(source, args, user)
@@ -88,7 +88,7 @@ end, function(source, args, user)
end, {help = _U('setmoney'), params = {{name = 'id', help = _U('id_param')}, {name = 'money type', help = _U('money_type')}, {name = 'amount', help = _U('money_amount')}}})
TriggerEvent('es:addGroupCommand', 'giveaccountmoney', 'admin', function(source, args, user)
local _source = source
local playerId = source
local xPlayer = ESX.GetPlayerFromId(args[1])
local account = args[2]
local amount = tonumber(args[3])
@@ -97,17 +97,17 @@ TriggerEvent('es:addGroupCommand', 'giveaccountmoney', 'admin', function(source,
if xPlayer.getAccount(account) then
xPlayer.addAccountMoney(account, amount)
else
TriggerClientEvent('esx:showNotification', _source, _U('invalid_account'))
TriggerClientEvent('esx:showNotification', playerId, _U('invalid_account'))
end
else
TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid'))
TriggerClientEvent('esx:showNotification', playerId, _U('amount_invalid'))
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
end, {help = _U('giveaccountmoney'), params = {{name = 'id', help = _U('id_param')}, {name = 'account', help = _U('account')}, {name = 'amount', help = _U('money_amount')}}})
TriggerEvent('es:addGroupCommand', 'giveitem', 'admin', function(source, args, user)
local _source = source
local playerId = source
local xPlayer = ESX.GetPlayerFromId(args[1])
local item = args[2]
local count = (args[3] == nil and 1 or tonumber(args[3]))
@@ -116,10 +116,10 @@ TriggerEvent('es:addGroupCommand', 'giveitem', 'admin', function(source, args, u
if xPlayer.getInventoryItem(item) then
xPlayer.addInventoryItem(item, count)
else
TriggerClientEvent('esx:showNotification', _source, _U('invalid_item'))
TriggerClientEvent('esx:showNotification', playerId, _U('invalid_item'))
end
else
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
TriggerClientEvent('esx:showNotification', playerId, _U('invalid_amount'))
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })