mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
refactor(es_extended,esx_notify,skinchanger): Updated prints
Updated prints to use formatting on strings instead of concatenation.
This commit is contained in:
@@ -342,7 +342,7 @@ end, true, {help = TranslateCap('command_setgroup'), validate = true, arguments
|
||||
|
||||
ESX.RegisterCommand('save', 'admin', function(xPlayer, args, _)
|
||||
Core.SavePlayer(args.playerId)
|
||||
print("[^2Info^0] Saved Player - ^5".. args.playerId.source .. "^0")
|
||||
print(('[^2Info^0] Saved Player - ^5%s^0'):format(args.playerId.source))
|
||||
end, true, {help = TranslateCap('command_save'), validate = true, arguments = {
|
||||
{name = 'playerId', help = TranslateCap('commandgeneric_playerid'), type = 'player'}
|
||||
}})
|
||||
@@ -352,25 +352,25 @@ ESX.RegisterCommand('saveall', 'admin', function(xPlayer, args, _)
|
||||
end, true, {help = TranslateCap('command_saveall')})
|
||||
|
||||
ESX.RegisterCommand('group', {"user", "admin"}, function(xPlayer, _, _)
|
||||
print(xPlayer.getName()..", You are currently: ^5".. xPlayer.getGroup() .. "^0")
|
||||
print(('%s, you are currently: ^5%s^0'):format(xPlayer.getName(), xPlayer.getGroup()))
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('job', {"user", "admin"}, function(xPlayer, _, _)
|
||||
print(xPlayer.getName()..", You are currently: ^5".. xPlayer.getJob().name.. "^0 - ^5".. xPlayer.getJob().grade_label .. "^0")
|
||||
print(('%s, your job is: ^5%s^0 - ^5%s^0'):format(xPlayer.getJob().name, xPlayer.getJob().grade_label))
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('info', {"user", "admin"}, function(xPlayer, _, _)
|
||||
local job = xPlayer.getJob().name
|
||||
local jobgrade = xPlayer.getJob().grade_name
|
||||
print("^2ID : ^5"..xPlayer.source.." ^0| ^2Name:^5"..xPlayer.getName().." ^0 | ^2Group:^5"..xPlayer.getGroup().."^0 | ^2Job:^5".. job.."^0")
|
||||
print(('^2ID: ^5%s^0 | ^2Name: ^5%s^0 | ^2Group: ^5%s^0 | ^2Job: ^5%s^0'):format(xPlayer.source, xPlayer.getName(), xPlayer.getGroup(), job))
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('coords', "admin", function(xPlayer, _, _)
|
||||
local ped = GetPlayerPed(xPlayer.source)
|
||||
local coords = GetEntityCoords(ped, false)
|
||||
local heading = GetEntityHeading(ped)
|
||||
print("Coords - Vector3: ^5".. vector3(coords.x,coords.y,coords.z).. "^0")
|
||||
print("Coords - Vector4: ^5".. vector4(coords.x, coords.y, coords.z, heading) .. "^0")
|
||||
print(('Coords - Vector3: ^5%s^0'):format(vector3(coords.x,coords.y,coords.z)))
|
||||
print(('Coords - Vector4: ^5%s^0'):format(vector4(coords.x,coords.y,coords.z, heading)))
|
||||
end, true)
|
||||
|
||||
ESX.RegisterCommand('tpm', "admin", function(xPlayer, _, _)
|
||||
@@ -464,9 +464,9 @@ end, false)
|
||||
|
||||
ESX.RegisterCommand('players', "admin", function(xPlayer, _, _)
|
||||
local xPlayers = ESX.GetExtendedPlayers() -- Returns all xPlayers
|
||||
print("^5"..#xPlayers.." ^2online player(s)^0")
|
||||
print(('^5%s^2 online player(s)^0'):format(#xPlayers))
|
||||
for i = 1, #(xPlayers) do
|
||||
local xPlayer = xPlayers[i]
|
||||
print("^1[ ^2ID : ^5"..xPlayer.source.." ^0| ^2Name : ^5"..xPlayer.getName().." ^0 | ^2Group : ^5"..xPlayer.getGroup().." ^0 | ^2Identifier : ^5".. xPlayer.identifier .."^1]^0\n")
|
||||
print(('^1[^2ID: ^5%s^0 | ^2Name : ^5%s^0 | ^2Group : ^5%s^0 | ^2Identifier : ^5%s^1]^0\n'):format(xPlayer.source, xPlayer.getName(), xPlayer.getGroup(), xPlayer.identifier))
|
||||
end
|
||||
end, true)
|
||||
|
||||
@@ -349,8 +349,7 @@ function ESX.RefreshJobs()
|
||||
|
||||
if not Jobs then
|
||||
-- Fallback data, if no jobs exist
|
||||
ESX.Jobs['unemployed'] = {label = 'Unemployed',
|
||||
grades = {['0'] = {grade = 0, label = 'Unemployed', salary = 200, skin_male = {}, skin_female = {}}}}
|
||||
ESX.Jobs['unemployed'] = {label = 'Unemployed', grades = {['0'] = {grade = 0, label = 'Unemployed', salary = 200, skin_male = {}, skin_female = {}}}}
|
||||
else
|
||||
ESX.Jobs = Jobs
|
||||
end
|
||||
@@ -388,8 +387,7 @@ function ESX.UseItem(source, item, ...)
|
||||
local success, result = pcall(itemCallback, source, item, ...)
|
||||
|
||||
if not success then
|
||||
return result and print(result) or
|
||||
print(('[^3WARNING^7] An error occured when using item ^5"%s"^7! This was not caused by ESX.'):format(item))
|
||||
return result and print(result) or print(('[^3WARNING^7] An error occured when using item ^5"%s"^7! This was not caused by ESX.'):format(item))
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -420,7 +418,7 @@ function ESX.GetItemLabel(item)
|
||||
if ESX.Items[item] then
|
||||
return ESX.Items[item].label
|
||||
else
|
||||
print('[^3WARNING^7] Attemting to get invalid Item -> ^5' .. item .. "^7")
|
||||
print(('[^3WARNING^7] Attemting to get invalid Item -> ^5%s^7'):format(item))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ if not Config.OxInventory then
|
||||
local targetXPlayer = ESX.GetPlayerFromId(target)
|
||||
local distance = #(GetEntityCoords(GetPlayerPed(playerId)) - GetEntityCoords(GetPlayerPed(target)))
|
||||
if not sourceXPlayer or not targetXPlayer or distance > Config.DistanceGive then
|
||||
print("[^3WARNING^7] Player Detected Cheating: ^5" .. GetPlayerName(playerId) .. "^7")
|
||||
print(('[^3WARNING^7] Player Detected Cheating: ^5%s^7'):format(GetPlayerName(playerId)))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ if not Config.UseDeferrals then
|
||||
RegisterNetEvent('esx_identity:showRegisterIdentity', function()
|
||||
TriggerEvent('esx_skin:resetFirstSpawn')
|
||||
while not ready do
|
||||
print('Waiting for esx_identity NUI..')
|
||||
print('Waiting for esx_identity NUI..')
|
||||
Wait(100)
|
||||
end
|
||||
if not ESX.PlayerData.dead then setGuiState(true) end
|
||||
|
||||
@@ -6,9 +6,9 @@ local Debug = ESX.GetConfig().EnableDebug
|
||||
local function Notify(notificatonType, length, message)
|
||||
|
||||
if Debug then
|
||||
print("1 ".. tostring(notificatonType))
|
||||
print("2 "..tostring(length))
|
||||
print("3 "..message)
|
||||
print(('1 %s'):format(tostring(notificatonType)))
|
||||
print(('2 %s'):format(tostring(length)))
|
||||
print(('3 %s'):format(message))
|
||||
end
|
||||
|
||||
if type(notificatonType) ~= "string" then
|
||||
@@ -20,9 +20,9 @@ local function Notify(notificatonType, length, message)
|
||||
end
|
||||
|
||||
if Debug then
|
||||
print("4 ".. tostring(notificatonType))
|
||||
print("5 "..tostring(length))
|
||||
print("6 "..message)
|
||||
print(('4 %s'):format(tostring(notificatonType)))
|
||||
print(('5 %s'):format(tostring(length)))
|
||||
print(('6 %s'):format(message))
|
||||
end
|
||||
|
||||
SendNuiMessage(json.encode({
|
||||
|
||||
@@ -57,13 +57,13 @@ TriggerEvent('skinchanger:loadSkin', {
|
||||
|
||||
-- Get list of components and maxVals
|
||||
TriggerEvent('skinchanger:getData', function(components, maxVals)
|
||||
print('Components => ' .. json.encode(components))
|
||||
print('MaxVals => ' .. json.encode(maxVals))
|
||||
print(('Components => %s'):format(json.encode(components)))
|
||||
print(('MaxVals => %s'):format(json.encode(maxVals)))
|
||||
end)
|
||||
|
||||
-- Get current skin
|
||||
TriggerEvent('skinchanger:getSkin', function(skin)
|
||||
print(json.encode(skin))
|
||||
print(('%s'):format(json.encode(skin)))
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user