[Release] CnRvehicles - my first script

When this is come? Add a timer so you can’t sell more than one vehicle in a specified time frame

Thanks so much for this, we really missed this feature from GTA:O!

Any improvements would be greatly appreciated!

everything works in vRP except when i sell a car i don’t get the money for it

Hi there Don thanks for this fix! Can I ask if you know how to add a message when a vehicle is sold? I tried:

TriggerClientEvent('esx:showNotification', "You sold a car!")

But nothing shows on screen.

Thanks for your time!

hey good thx thx thx

any update to vrp?..

Awesome Script <3 :slight_smile:
I did fix so it works with VRP:)) And its just a nice script, and works very well
So thumps up from here <3

Hey what’s up bro would you mind sharing the vrp remake of this ??

Hey guys, i found an exploit with this script and need some help fixing it.
Basically if the player drives in with a passenger the passenger can spam “E” and sell the car repeatedly without it disappearing and make god awful amounts of money. So im trying to add something to it to stop that from happening. This is what i have so far:

local driverPed = GetPlayerPed(-1) 
		--ability to sell car if in range of chop shop
		if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) and distance <= 4.0 then
			ShowHelp()
			if IsControlPressed(1, 38) then
				if (GetPedInVehicleSeat(vehicle, -1) == driverPed)
				sellVehicle()
				end
			end
		end

Any help would be greatly appreciated :smiley: Thanks

Hello and thank you for your release!

As @jon said, edit and add the server.lua with its text :

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)


----------------------------------------------------------------------------------------------------


RegisterServerEvent("sellVehicle")
AddEventHandler("sellVehicle", function(vehPrice)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	xPlayer.addAccountMoney('black_money', vehPrice)
	CancelEvent()
end)

And do not forget to comment in server.lua :

RegisterServerEvent("getVehPrice")
AddEventHandler("getVehPrice", function(class)
	for k, price in pairs(prices) do
		if class == price.id then
			vehPrice = price.price
			TriggerClientEvent("setVehPrice", -1, vehPrice)
		end
	end
end)

--RegisterServerEvent("sellVehicle")
--AddEventHandler("sellVehicle", function(vehPrice)
	--TriggerEvent("es:getPlayerFromId", source, function(user)
		--user.addMoney(vehPrice)
		--CancelEvent()
	--end)
--end)

RegisterServerEvent("resetMoney")
AddEventHandler("resetMoney", function()
	TriggerEvent("es:getPlayerFromId", source, function(user)
		user.setMoney(0)
	end)
end)

because otherwise you will receive clean money and dirty money.

A question, that I want to make it only available if 1 police is only. How can I do it? [ESX]

Or if you don’t know then how can I make a time limit into it?

Hi! I want to make the sell to this --> If I sell the vehicle give me an item that I put into the script. So it won’t give me money just a specified item.

how i can set a timer
pls help

If you want to have it so the scraper gives you items (ex. parts from cars) then this is how.

RegisterServerEvent("sellVehicle")
AddEventHandler("sellVehicle", function(vehPrice)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	xPlayer.addInventoryItem('screw', vehPrice)
	CancelEvent()
end)

This is a good idea, don’t see many servers rewarding car thiefs and I think that needs to change. I will be adding this to my garage mod (or making a spinoff thief job). Thanks for the idea.

How would I implement a timer?

Dafuq ? it had been made using a RP Framework

how to make add money to society money in organisation?