This line of code dosent work?


#1
Citizen.CreateThread(function ()
    car = GetVehiclePedIsIn(GetPlayerPed(-1), false)

    if not car then
        TriggerEvent("chatMessage", "ERROR", {255, 0, 0}, "You have to be sitting in a vehicle.")
        return
    elseif car then
        Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(car))
    end
end)

Ive tried this in my server and it literally does nothing, can someone help me get this vehicle to delete when sitting in it.


#2

How would this ever run? Like you need to assign a hotkey or a command.


#3

@kanersps It has a way to run, i dont want to post it all this is just the part that isnt working… it gives me an error (which is in the code and is supposed to happen) when im not in a vehicle but once i get in it does nothing…


#4

That is the native to set the entity as no longer needed, not the one to directly remove it.

This is the native you need

Citizen.InvokeNative(0xEA386986E786A54F, Citizen.PointerValueIntInitialized(car))

#5

this does not work either. thank you for the post.