Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions [core]/es_extended/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,20 @@ function ESX.ShowInventory()
end)
end

---@param entity1 The Entity That Will Face
---@param entity The Entity To Be Faced
---@return nil
function ESX.FaceEntity(entity1, entity2)
-- Credits to Havoc
local ent1 = GetEntityCoords(entity1)
local ent2 = GetEntityCoords(entity2)
local xCoords = (ent2.x - ent1.x)
local yCoords = (ent2.y - ent1.y)
local heading = GetHeadingFromVector_2d(xCoords, yCoords)

SetEntityHeading(entity1, heading)
end

ESX.SecureNetEvent('esx:showNotification', ESX.ShowNotification)

ESX.SecureNetEvent('esx:showAdvancedNotification', ESX.ShowAdvancedNotification)
Expand Down
17 changes: 17 additions & 0 deletions [core]/es_extended/shared/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,20 @@ function ESX.Await(conditionFunc, errorMessage, timeoutMs)

return false
end

---@param str string
function ESX.SanitizeString(str)
if not str or type(str) ~= "string" then
return error("Argument must be of type string!")
end

str = string.gsub(str, "[%c]", "")

str = string.gsub(str, "[<>]", "")

str = string.gsub(str, "[\"'%%;%$%&%*%(%)%[%]{}]", "")

str = string.gsub(str, "^%s*(.-)%s*$", "%1")

return str
end