mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
Bit of tidying
This commit is contained in:
@@ -56,6 +56,14 @@ function isServer()
|
||||
return IsDuplicityVersion()
|
||||
end
|
||||
|
||||
--- Allows the user to check if an export exists before trying to call it
|
||||
--- @return boolean boolean True if it exists
|
||||
---@usage
|
||||
--- ```lua
|
||||
--- if checkExportExists("qb-inventory", "OpenInventory") then
|
||||
--- exports["qb-inventory"]:OpenInventory()
|
||||
--- end
|
||||
--- ```
|
||||
function checkExportExists(resource, export)
|
||||
if not resource or not export then return false end
|
||||
|
||||
@@ -417,6 +425,7 @@ end
|
||||
function drawLine(startCoords, endCoords, col)
|
||||
if not debugMode then return end
|
||||
|
||||
local col = col or vec4(255, 255, 255, 150)
|
||||
CreateThread(function()
|
||||
for i = 100, 0, -1 do
|
||||
DrawLine(startCoords.x, startCoords.y, startCoords.z, endCoords.x, endCoords.y, endCoords.z, col.x, col.y, col.z, col.w)
|
||||
@@ -435,6 +444,7 @@ end
|
||||
function drawSphere(coords, col)
|
||||
if not debugMode then return end
|
||||
|
||||
local col = col or vec4(255, 255, 255, 150)
|
||||
CreateThread(function()
|
||||
for i = 100, 0, -1 do
|
||||
DrawSphere(coords.x, coords.y, coords.z, 0.5, col.x, col.y, col.z, col.w)
|
||||
@@ -875,9 +885,9 @@ local materials = {
|
||||
--- local matHash, matName = GetGroundMaterialAtPosition(vector3(100,200,300))
|
||||
--- print("Material:", matName)
|
||||
--- ```
|
||||
function GetGroundMaterialAtPosition(coords, ped)
|
||||
function GetGroundMaterialAtPosition(coords, Ped)
|
||||
local endCoords = vec3(coords.x, coords.y, coords.z - 1.1)
|
||||
local rayHandle = StartShapeTestCapsule(coords.x, coords.y, coords.z, endX, endY, endZ, 1.0, 1, Ped or PlayerPedId(), 7)
|
||||
local rayHandle = StartShapeTestCapsule(coords.x, coords.y, coords.z, endCoords.x, endCoords.y, endCoords.z, 1.0, 1, Ped or PlayerPedId(), 7)
|
||||
local _, hit, _, _, materialHash, _ = GetShapeTestResultIncludingMaterial(rayHandle)
|
||||
local materialName = "Unknown"
|
||||
for k, v in pairs(materials) do
|
||||
|
||||
@@ -73,8 +73,8 @@ if not isServer() then
|
||||
--- local isPlayerAnimal = isAnimal()
|
||||
--- local isSpecificPedAnimal = isAnimal(somePedEntity)
|
||||
--- ```
|
||||
function isPedAnimal(ped)
|
||||
local PedModel = GetEntityModel(ped or PlayerPedId())
|
||||
function isPedAnimal(Ped)
|
||||
local PedModel = GetEntityModel(Ped or PlayerPedId())
|
||||
for _, animalCategory in pairs(AnimalPeds) do
|
||||
for animalModelHash, _ in pairs(animalCategory) do
|
||||
if PedModel == animalModelHash then
|
||||
@@ -105,8 +105,8 @@ if not isServer() then
|
||||
--- print("Driver is a cat!")
|
||||
--- end
|
||||
--- ```
|
||||
function isCat(ped)
|
||||
local PedModel = GetEntityModel(ped or PlayerPedId())
|
||||
function isCat(Ped)
|
||||
local PedModel = GetEntityModel(Ped or PlayerPedId())
|
||||
for modelHash, _ in pairs(AnimalPeds.CatPeds) do
|
||||
if PedModel == modelHash then
|
||||
debugPrint("^4isAnimal^7: ^2Ped is ^4Cat")
|
||||
@@ -148,8 +148,8 @@ if not isServer() then
|
||||
--- end
|
||||
--- end
|
||||
--- ```
|
||||
function isDog(ped)
|
||||
local PedModel = GetEntityModel(ped or PlayerPedId())
|
||||
function isDog(Ped)
|
||||
local PedModel = GetEntityModel(Ped or PlayerPedId())
|
||||
for modelHash, _ in pairs(AnimalPeds.BigDogs) do
|
||||
if PedModel == modelHash then
|
||||
debugPrint("^4isAnimal^7: ^2Ped is ^4Dog")
|
||||
@@ -199,8 +199,8 @@ if not isServer() then
|
||||
--- local getAnim = getAnimalAnims(ped)
|
||||
--- playAnim(getAnim.sitDict, getAnim.sitAnim, -1, 1)
|
||||
--- ```
|
||||
function getAnimalAnims(ped)
|
||||
local model = GetEntityModel(ped)
|
||||
function getAnimalAnims(Ped)
|
||||
local model = GetEntityModel(Ped)
|
||||
local animalTable = {}
|
||||
for _, animalCategory in pairs(AnimalPeds) do
|
||||
for k, v in pairs(animalCategory) do
|
||||
|
||||
@@ -111,7 +111,7 @@ local notifyFunc = {
|
||||
--- triggerNotify("Alert", "You have been warned for misconduct.", "error", playerId)
|
||||
--- ```
|
||||
function triggerNotify(title, message, type, src)
|
||||
if not Config.System or not Config.System.Notify then debugPrint("Notify triggered but not set up") return end
|
||||
if not Config.System?.Notify then debugPrint("Notify triggered but not set up") return end
|
||||
|
||||
if src then
|
||||
notifyFunc[Config.System.Notify].server(title, message, type, src)
|
||||
|
||||
@@ -236,7 +236,6 @@ local moneyFunc = {
|
||||
--- ```lua
|
||||
--- chargePlayer(100, "cash", playerId)
|
||||
--- ```
|
||||
---
|
||||
function chargePlayer(cost, moneyType, newsrc)
|
||||
local is_success = false
|
||||
local src = newsrc or source
|
||||
|
||||
Reference in New Issue
Block a user