[Free] s_carhunt [ESX]

Hello,

Today I’ll be releasing my vehiclehunting script, which I suppose no one has released before, afaik.
It has outlived it’s purpose for me as of now, but hopefully you guys like the idea and possibly even make it better.

Basically this script allows you to create “event” or activity for players to hunt down vehicles in map and claim them as theirs, kind of like finding abandoned vehicles.

Features:

  • Synced for players

  • Shouldn’t be possible for players to double claim same vehicle (Atleast there’s logs)

  • Spawncoords are on serverside

  • Spawns are always randomized from coord table. Also you can set specific vehicles in specific coordinates

  • Automatically spawns new vehicle in new coords from table upon claiming

  • Vehicles are spawned locally so it shouldn’t create duplicates, didn’t really test this that much

  • Logs player activity upon claiming

  • Extra feature - I added command “/pc” for you to print coords in discord, less painful to add new spawnpoints. Prints as Vector3 and Vector4, useful for other stuff too

Requirements

  • ESX, esx_vehicleshop (setting vehicle owned)

Preview and Download

Known bugs:

  • If coordtable runs down to last, it will repeatedly spawn same vehicle in last position, not sure how to fix but ain’t no problem as long as you have enough spawnpoints placed :smile:

Feel free to edit and stuff, but do not use this in any paid content, thanks.
I don’t feel like seeing lightly modified versions as paid

Preview for “/pc” -command
f081cef45a6f71d959cd447f10cfe385

9 Likes

i see some stuff in the client side about renzu_customs will this work with his vehicle system because thats what I use and the cars arent spawning at all. I even tried installing esx vehicleshop and restarted the script to see if that worked but still the cars dont spawn

I only use renzus custom thus there are some traces. It’s not really integrated with his system other than getting vehprops. Also when you restart the script you’ll need to rejoin your server, it spawns vehicle for the player when he joins

if you want to test it alone just

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end
	--TriggerEvent('s_carhunt:GetServerCoords') --Uncomment this and you can just restart the script and it will spawn vehicles. Do not leave this uncommented when putting live
end)

The cars are spawning for me now but not giving the option to claim them i assume it would need to be integrated for renzu vehicle system is there anyway you could add that or tell me how I could do it

Any errors? It does not use vehicle shops for anything else than getting license plates in your used format, and possibly setting vehicle owned for player, not sure about last mentioned. It shouldnt affect 3dtext in anyway tho. Check client and server console if there’s any errors

I got an error on line 122. but i commented it, so theres no error now. I put all the functions for generating plates so i dont need to use esx_vehicleshop, but theres a problem, when reclaiming the car after the fade screen its spawn another car. Logs, vehicle in owned_vehicle table, drawtext work without any problem.

Edit: if you get in the car and accelerate it moves without even reclaiming it

How many vehicles have you set in table? Sounds like the bug i mentioned in the post?

Edit: try adding like 4 vehicles in table, check that in the getsharedobject thread the event is commented, restart script, rejoin your server and then check the spawns and claims

Problem still. It duplicates the vehicle.

Edit: I manage to fix it. on function prepare() i changed DeleteVehicle with DeleteEntity and thats all. everything is working really good. Thanks man

here’s the modified script
s_carhunt.rar (6.3 KB)

Oh lol that’ odd. Glad u fixed it and thanks for telling me👍🏻