[Release] Delete Vehicle Script [v1.1.0] (Updated 2020)

hm… works for me. Not this script, but this native

Citizen.InvokeNative( 0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized( entity ) )

is working.

1 Like

your native is same to native in above on this post script and nothing change… what is make it work ?

Hey Wolf, so yeah i am experiencing the exact same issue. The vehicles spawned by me and other players cannot be deleted even thought the script has loaded correctly through the server logs. When i type /dv , the command gets sent through but there is no feedback and no event is triggered.

Working fine for me. I can delete vehicles spawned by myself and other players.

Strange as someone else noted above that there’s wasn’t working either, yet others say it does. What I can think of right now is have you set up the resource properly, and also do you have any scripts that modify the chat resource?

Update 1.0.1

  • Re-wrote most of client.lua to fix the issue with the command not working (?)

Please re-download the new client.lua!

Works very well, just wish it deleted ped vehicles, but you are working on this.

Indeed, currently re-writing the whole script so people don’t have to be in a vehicle to delete it, you just have to stand next to it.

Hey Everyone,

I’m very new here and just need some direction on where these files actually go.
I’ve copied the data into 3 text files with appropriate names and .lua extensions,
I’m assuming I create a new folder on server in resources folder and add it to the auto start list.
Do I put all 3 files on server or do any go on client-side?

Thanks,
-P

The 3 files go into a folder in your server’s resources folder, you then add the name of the resource to the AutoStartResources in citmp-server.yml.

Thanks Wolf that’s exactly what I did but unfortunately the command appears to be executed without any result. I must be one of the unfortunate few that this script does not work properly for

Have you tried it on player spawned vehicles, such as through Enhanced Reborn?

I’ve tried both spawn vehicles by myself and ped vehicles. I get in the vehicle, press T, then type the command /dv and it seems to take the input but no action as a result

I apologise that is isn’t working, I’m new to scripting for FiveM so I’m not sure how to help you with this. I mean it works for most people, so I just don’t get it.

Hey Wolf,

I’m linking the files I created to my google drive. Would you mind just checking them out to make sure I did them correctly? I’ve only delved into managing 5m server for a week now and I’m as green as it gets. Thanks in advance my friend.

https://drive.google.com/open?id=0B8ckYPGWKnH1NDJub2FNNTIzU1k

-Paul

In the client.lua you missed out the end statement on the deleteCar method.

Thanks Wolf,

Is this better?

**-- Register a network event **
**RegisterNetEvent( 'deleteVehicle' )**

**deletingVehicle = false **

**-- Add an event handler for the deleteVehicle event. **
**-- Gets called when a user types in /dv in chat (see client.lua)**
**AddEventHandler( 'deleteVehicle', function()**
**    deletingVehicle = true **
**end )**

**Citizen.CreateThread( function()**
**    while true do **
**        Citizen.Wait( 1 )**
**        **
**        if ( deletingVehicle ) then **
**            -- Get the ped of the player who typed /dv**
**            ped = GetPlayerPed( -1 )**
**            **
**            -- If the ped is valid **
**            if ( ped ) then **
**            **
**                -- Check to see if the player is in a car **
**                inVehicle = IsPedInAnyVehicle( ped, false )**
**                **
**                -- If the player is in a car **
**                if ( inVehicle ) then **
**                **
**                    -- Get the car they're in **
**                    car = GetVehiclePedIsIn( ped, false )**

**                    -- Delete it **
**                    deleteCar( car )**
**                end **
**            end **
**            **
**            deletingVehicle = false **
**        end **
**    end **
**end )**

**-- Delete car function borrowed frtom Mr.Scammer's model blacklist, thanks to him!**
**function deleteCar( entity )**
**	Citizen.InvokeNative( 0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized( entity ) )**
**end**
**```**
**```**
**type or paste code here**
**```**
1 Like

It put some weird formatting when i pasted, but i think i got all the lines now.

Thanks for your help!

-Paul

Does the script work now?

Hey Wolf, just got home and was able to test. It works on Player spawned vehicles.
It doesn’t work on PED vehicles. Any suggestions?