mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 01:38:52 +00:00
rename _source variable to playerId
This commit is contained in:
@@ -456,10 +456,10 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, l
|
||||
label = weaponLabel,
|
||||
components = {}
|
||||
})
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:addWeapon', self.source, weaponName, ammo)
|
||||
TriggerClientEvent('esx:addInventoryItem', self.source, {label = weaponLabel}, 1)
|
||||
TriggerClientEvent('esx:addWeapon', self.source, weaponName, ammo)
|
||||
TriggerClientEvent('esx:addInventoryItem', self.source, {label = weaponLabel}, 1)
|
||||
end
|
||||
end
|
||||
|
||||
self.addWeaponComponent = function(weaponName, weaponComponent)
|
||||
|
||||
+10
-10
@@ -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.' } })
|
||||
|
||||
+3
-3
@@ -83,9 +83,9 @@ end)
|
||||
|
||||
RegisterServerEvent('esx:triggerServerCallback')
|
||||
AddEventHandler('esx:triggerServerCallback', function(name, requestId, ...)
|
||||
local _source = source
|
||||
local playerId = source
|
||||
|
||||
ESX.TriggerServerCallback(name, requestID, _source, function(...)
|
||||
TriggerClientEvent('esx:serverCallback', _source, requestId, ...)
|
||||
ESX.TriggerServerCallback(name, requestID, playerId, function(...)
|
||||
TriggerClientEvent('esx:serverCallback', playerId, requestId, ...)
|
||||
end, ...)
|
||||
end)
|
||||
|
||||
+14
-14
@@ -1,5 +1,5 @@
|
||||
AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
local _source = source
|
||||
local playerId = source
|
||||
local tasks = {}
|
||||
|
||||
local userData = {
|
||||
@@ -7,11 +7,11 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
inventory = {},
|
||||
job = {},
|
||||
loadout = {},
|
||||
playerName = GetPlayerName(_source),
|
||||
playerName = GetPlayerName(playerId),
|
||||
lastPosition = nil
|
||||
}
|
||||
|
||||
TriggerEvent('es:getPlayerFromId', _source, function(player)
|
||||
TriggerEvent('es:getPlayerFromId', playerId, function(player)
|
||||
-- Update user name in DB
|
||||
table.insert(tasks, function(cb)
|
||||
MySQL.Async.execute('UPDATE users SET name = @name WHERE identifier = @identifier', {
|
||||
@@ -208,11 +208,11 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
xPlayer.createAccounts(missingAccounts)
|
||||
end
|
||||
|
||||
ESX.Players[_source] = xPlayer
|
||||
ESX.Players[playerId] = xPlayer
|
||||
|
||||
TriggerEvent('esx:playerLoaded', _source, xPlayer)
|
||||
TriggerEvent('esx:playerLoaded', playerId, xPlayer)
|
||||
|
||||
TriggerClientEvent('esx:playerLoaded', _source, {
|
||||
TriggerClientEvent('esx:playerLoaded', playerId, {
|
||||
identifier = xPlayer.identifier,
|
||||
accounts = xPlayer.getAccounts(),
|
||||
inventory = xPlayer.getInventory(),
|
||||
@@ -224,7 +224,7 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
})
|
||||
|
||||
xPlayer.displayMoney(xPlayer.getMoney())
|
||||
TriggerClientEvent('esx:createMissingPickups', _source, ESX.Pickups)
|
||||
TriggerClientEvent('esx:createMissingPickups', playerId, ESX.Pickups)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -232,15 +232,15 @@ AddEventHandler('es:playerLoaded', function(source, _player)
|
||||
end)
|
||||
|
||||
AddEventHandler('playerDropped', function(reason)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local playerId = source
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if xPlayer then
|
||||
TriggerEvent('esx:playerDropped', _source, reason)
|
||||
TriggerEvent('esx:playerDropped', playerId, reason)
|
||||
|
||||
ESX.SavePlayer(xPlayer, function()
|
||||
ESX.Players[_source] = nil
|
||||
ESX.LastPlayerData[_source] = nil
|
||||
ESX.Players[playerId] = nil
|
||||
ESX.LastPlayerData[playerId] = nil
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -419,9 +419,9 @@ end)
|
||||
|
||||
RegisterServerEvent('esx:onPickup')
|
||||
AddEventHandler('esx:onPickup', function(id)
|
||||
local _source = source
|
||||
local playerId = source
|
||||
local pickup = ESX.Pickups[id]
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if pickup.type == 'item_standard' then
|
||||
if xPlayer.canCarryItem(pickup.name, pickup.count) then
|
||||
|
||||
Reference in New Issue
Block a user