Open CxCore-xyz opened 2 years ago
"Found" a sample code to fix this problem. Goes into qb-core/client/functions.lua
function QBCore.Functions.SpawnObject(model, coords, cb) local model = (type(model) == 'number' and model or GetHashKey(model))
Citizen.CreateThread(function()
RequestModel(model)
local obj = CreateObject(model, coords.x, coords.y, coords.z, true, false, true)
SetModelAsNoLongerNeeded(model)
if cb then
cb(obj)
end
end)
end
function QBCore.Functions.SpawnLocalObject(model, coords, cb) local model = (type(model) == 'number' and model or GetHashKey(model))
Citizen.CreateThread(function()
RequestModel(model)
local obj = CreateObject(model, coords.x, coords.y, coords.z, false, false, true)
SetModelAsNoLongerNeeded(model)
if cb then
cb(obj)
end
end)
end
function QBCore.Functions.DeleteObject(object) SetEntityAsMissionEntity(object, false, true) DeleteObject(object) end
The only problem i found with this scripts is that you can fish anywhere you want even where there isn't any waters. Like in the sand, road, buildings and etc. The best fix would be to make an check wich will check if you're poiting into the waters or something like that. For now i made the -3.0 on the checkcoords to -45.0 Z but theres still some places like mountains where you can abuse this bug. This scripts is amazing but because of this bug it's kinda ruins all the point of it.