Merge pull request #174 from SinapsDev/main
IsVehicleOwnedByPlayer method
This commit is contained in:
3 files changed
+43
No files matched your search
@@ -518,6 +518,21 @@ Framework.GetOwnedVehicles = function(src)
|
|||||||
return vehicles
|
return vehicles
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Returns a table of owned vehicles for the player. format is {id = id, vehicle = model, plate = plate}
|
||||||
|
---@param src number
|
||||||
|
---@param plate string
|
||||||
|
---@return table
|
||||||
|
Framework.IsVehicleOwnedByPlayer = function(src, plate)
|
||||||
|
local citizenId = Framework.GetPlayerIdentifier(src)
|
||||||
|
local result = MySQL.Sync.fetchAll("SELECT id, vehicle, plate FROM owned_vehicles WHERE owner = '" .. citizenId .. "' AND plate = '" .. plate .. "'")
|
||||||
|
if not result[1] then return false end
|
||||||
|
|
||||||
|
local id = result[1].id
|
||||||
|
local vehicle = result[1].vehicle
|
||||||
|
local model = json.decode(vehicle).model
|
||||||
|
return { id = id, vehicle = model, plate = plate }
|
||||||
|
end
|
||||||
|
|
||||||
---@description Registers a usable item with a callback function.
|
---@description Registers a usable item with a callback function.
|
||||||
--- @param itemName string
|
--- @param itemName string
|
||||||
--- @param cb function
|
--- @param cb function
|
||||||
|
|||||||
@@ -633,6 +633,20 @@ Framework.GetOwnedVehicles = function(src)
|
|||||||
return vehicles
|
return vehicles
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Returns a table of owned vehicles for the player. format is {id = id, vehicle = model, plate = plate}
|
||||||
|
---@param src number
|
||||||
|
---@param plate string
|
||||||
|
---@return table
|
||||||
|
Framework.IsVehicleOwnedByPlayer = function(src, plate)
|
||||||
|
local citizenId = Framework.GetPlayerIdentifier(src)
|
||||||
|
local result = MySQL.Sync.fetchAll("SELECT id, vehicle, plate FROM player_vehicles WHERE citizenid = '" .. citizenId .. "' AND plate = '" .. plate .. "'")
|
||||||
|
if not result[1] then return false end
|
||||||
|
|
||||||
|
local id = result[1].id
|
||||||
|
local vehicle = result[1].vehicle
|
||||||
|
return { id = id, vehicle = vehicle, plate = plate }
|
||||||
|
end
|
||||||
|
|
||||||
---@description Registers a usable item with a callback function.
|
---@description Registers a usable item with a callback function.
|
||||||
---@param itemName string
|
---@param itemName string
|
||||||
---@param cb function
|
---@param cb function
|
||||||
|
|||||||
@@ -468,6 +468,20 @@ Framework.GetOwnedVehicles = function(src)
|
|||||||
return vehicles
|
return vehicles
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@description Returns a table of owned vehicles for the player. format is {id = id, vehicle = model, plate = plate}
|
||||||
|
---@param src number
|
||||||
|
---@param plate string
|
||||||
|
---@return table
|
||||||
|
Framework.IsVehicleOwnedByPlayer = function(src, plate)
|
||||||
|
local citizenId = Framework.GetPlayerIdentifier(src)
|
||||||
|
local result = MySQL.Sync.fetchAll("SELECT id, vehicle, plate FROM player_vehicles WHERE citizenid = '" .. citizenId .. "' AND plate = '" .. plate .. "'")
|
||||||
|
if not result[1] then return false end
|
||||||
|
|
||||||
|
local id = result[1].id
|
||||||
|
local vehicle = result[1].vehicle
|
||||||
|
return { id = id, vehicle = vehicle, plate = plate }
|
||||||
|
end
|
||||||
|
|
||||||
---@description Registers a usable item with a callback function.
|
---@description Registers a usable item with a callback function.
|
||||||
---@param itemName string
|
---@param itemName string
|
||||||
---@param cb function
|
---@param cb function
|
||||||
|
|||||||
Reference in new issue
Block a user