[Release] esx-CarRental

I’ve built a resource that allows players to rent cars from specified locations. Each rental is customizable to however much you want to charge it. You can config each location for dropoff and pickups as well as how often a player is charged for the rental. Once a player rents a vehicle they will be charged periodically until they return the car. Damaging the car will result in $500 being deducted unless they purchase a $200 insurance.

Not really much in the way for pictures. A simple menu that uses WarMenu for its base. If you guys really want pictures I can upload some.

Download:CarRental.zip (7.1 KB)

Source: https://github.com/mja00/esx-carRental

Changelog:

v1.2: Fixed car damage checks and car returns.

v1.1: Money removal uses ESX instead of ES(Thanks Samas)

v1: Initial release

23 Likes

Interesting

+1…

I will surely check it out…

1 Like

here’s pictures for everyone, this is literally perfect. Thank you for this.





Good work.

You say it’s an esx resource, but you’re using esx just for the squeeze and essentialmod for player info.

-- Display notification on the top map
function Notification(message)
  Citizen.CreateThread(function()

    SetNotificationTextEntry('STRING')
    AddTextComponentString(message)
    DrawNotification(false, false)

  end)
end

Just said it’s an esx resource to kinda force people to make sure they use ESX since that’s how money is handled for the resource.

Essentialmod :

RegisterServerEvent("chargePlayer")
AddEventHandler("chargePlayer", function(chargeAmount)
	TriggerEvent("es:getPlayerFromId", source, function(user)
		user.removeMoney(chargeAmount)
		CancelEvent()
	end)
end)

Esx :

ESX = nil

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

RegisterServerEvent("chargePlayer")
AddEventHandler("chargePlayer", function(chargeAmount)
     local xPlayer        = ESX.GetPlayerFromId(source)
     xPlayer.removeMoney(chargeAmount)
     CancelEvent()
end)

Esx doc: https://esx-org.github.io/es_extended/server-xplayer-functions/xplayer.removemoney/

Yet there is a real difference…

Okay? Thanks I guess?

Technically I can name the resource however I want

people trust developers! So I was not anything like name. And even less imposed resources if in the end it is possible to use

2 Likes

Well if you have a better name please tell what you think it should be named.

1 Like

if you use essentialmode = es-CarRental or esx esx-CarRental.

Whatever happens, you have to update the code

1 Like

Ahhhhh, I understand what you mean now. I was completely confused as to why you posted code examples. I’m fixing and uploading it now.

There is a bug in your car return. You can give back every car which you stole before :wink:

And I change the position from Warmenu to middle:
menus[id].x = 0.35 – Position left right
menus[id].y = 0.50 --Position des up down

on your position is the chat window.

Thx for sharing! Use it!

is that fixed? I’d like to get that fixed for my server if possible, let me know when a patch comes out! :smiley:

Awesome Script <3 :slight_smile:
I did fix so it works with VRP! And it just works very good
+1

I’m I the only one having this problems?

autoChargeAmount: auto charges everyone on the server every X minute even if they haven’t rented a car.
damageCharge: if you return a rented car and then take out a private car from a garage you’ll get charged for damaging that car too.

Hm… I will check later

I can fix that pretty quickly, I’ll check to see if the car is a rental(through checking the plate) before pulling up the menu.

And I’ll look into these two issues.

I’ve fixed the damageCharge issue but I don’t see why autoChargeAmount would be charging everyone on the server.

I’ve fixed both the return issue and the damage issue. I’m waiting for my tester to get online to test the autocharge system