[Bug] C# RemoveBlip, RemoveObject not working #309
MrGonzy
started this conversation in
[BUG] FiveM for GTAV Enhanced
Replies: 2 comments 6 replies
|
EDIT: Please disregard this comment and see below since this appears to be related specifically to .NET I wasn't able to replicate this in Lua. Is this perhaps exclusive to a runtime? If so, they will probably need more data and a test resource would be helpful. local blips = {}
---@param coords vector3
---@return number
function CreateBlip(coords)
local blip = AddBlipForCoord(coords)
SetBlipSprite(blip, 671)
SetBlipScale(blip, 1.0)
SetBlipColour(blip, 25)
SetBlipDisplay(blip, 4)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Test Blip")
EndTextCommandSetBlipName(blip)
return blip
end
RegisterCommand("addblip", function()
local coords = GetEntityCoords(PlayerPedId())
table.insert(blips, CreateBlip(coords))
end, false)
RegisterCommand("removeblips", function()
for i=1, #blips do
print("Attempting to remove blip with id: "..blips[i])
RemoveBlip(blips[i])
end
end, false) |
1 reply
|
I think there's a problem with the Broken example: [OnCommand("testblips")]
public static async void OnTestMarkerNull()
{
if (API.Players.Local.Ped == null) return;
var pedLoc = API.Players.Local.Ped.Position;
var blip = Native.AddBlipForCoord(pedLoc.X, pedLoc.Y, pedLoc.Z);
API.Log.Debug($"Created blip {blip} at {pedLoc}");
await Task.Delay(2500);
Native.RemoveBlip(out blip); // Value of `blip` is never actually accessed in the Native code
API.Log.Debug($"Removed blip {blip}"); // Prints 0, but blip wasn't deleted
}Working example code: [OnCommand("testblips")]
public static async void OnTestMarkerNull()
{
if (API.Players.Local.Ped == null) return;
var pedLoc = API.Players.Local.Ped.Position;
var blip = Native.AddBlipForCoord(pedLoc.X, pedLoc.Y, pedLoc.Z);
API.Log.Debug($"Created blip {blip} at {pedLoc}");
await Task.Delay(2500);
var blipRef = new Ref<int>(ref blip); // Create Ref of our blip AFTER await as Ref<int> doesn't survive the async await
Native.RemoveBlip(blipRef);
API.Log.Debug($"Removed blip {blipRef.Value}"); // Prints 0 since the blip is deleted?
} |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Created blip then afterwards when i want to delete blip by using DeleteBlip, doesnt work. Seems like out doesnt work though handle shows value of the blip id or object handle.
Issue type
Client
Repro rate
Always
Server build version
Build 98
OS
No response
CPU
No response
GPU
No response
RAM
No response
Storage type
SSD NVMe
Connection type
None
ISP and bandwidth
No response
DxDiag
No response
Network graph
No response
Platform
Windows
OS version / distribution
No response
CPU
No response
RAM
No response
Using txAdmin?
No
Hosting provider
None
Machine type
None
/perf endpoint output
No response
DDoS protection
No response
ulimit -n value (Linux only)
No response
Docker Compose file (Docker only)
No response
Steps to Reproduce
Expected Behavior
Blip should be removed on client sided
Actual Behavior
Blip was not removed on client sided
Evidence
No response
Additional Context
No response
All reactions