๐งFunctions
client/functions.lua
Functions = {}
Functions.showNotification = function(type, message)
SetNotificationTextEntry('STRING')
AddTextComponentString(message)
DrawNotification(type, false)
end
Functions.displayHelpText = function(text)
AddTextEntry('helpText', text)
DisplayHelpTextThisFrame('helpText', false)
end
server/functions.lua
Functions = {}
Functions.getItems = function()
return ESX.Items()
end
Functions.getPlayer = function(source)
return ESX.GetPlayerFromId(source)
end
Functions.canCarryItem = function(player, item, amount)
return player.canCarryItem(item, amount)
end
Functions.getIdentifier = function(player)
return player.identifier
end
Functions.addInventoryItem = function(player, item, amount)
player.addInventoryItem(item, amount)
end
Functions.removeInventoryItem = function(player, item, amount)
player.removeInventoryItem(item, amount)
end
Functions.getInventoryItem = function(player, item)
local data = player.getInventoryItem(item)
if not data then return nil end
return {
name = data.name,
count = data.count
}
end
Functions.getPlayerJob = function(player)
return {
job = player.job.name,
grade = player.job.grade
}
end
Last updated