Skip to content

AradAshkan/FiveM-RentCar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Rent Car Script for FiveM

Description

This is a FiveM script that allows players to rent vehicles at specific locations in the game. The script includes a user-friendly menu for selecting vehicles, a timer-based rental system, and integration with the ESX framework. Players can rent vehicles for a set duration, with costs deducted from their in-game bank balance. The script also includes checks to ensure that there are not enough on-duty taxi drivers before allowing rentals.

Features

  • Vehicle Rental System: Players can rent vehicles from predefined locations marked with blips and markers.
  • Configurable Options: Customize vehicles, prices, rental duration, and marker locations in config.lua.
  • ESX Integration: Uses ESX framework for player management and bank transactions.
  • Random License Plates: Generates unique license plates for rented vehicles.
  • Timer System: Automatically removes rented vehicles after the rental period expires or if the player leaves the vehicle for too long.
  • Blip and Marker Support: Visual indicators for rental locations.
  • Notification System: In-game notifications for various actions (e.g., successful rental, insufficient funds).

Installation

  1. Ensure you have the ESX framework and NativeUI installed in your FiveM server.
  2. Copy the script folder to your server's resources directory.
  3. Add ensure rentcar to your server.cfg.
  4. Configure the config.lua file to adjust vehicle options, rental prices, and marker locations as needed.
  5. Restart your server or use the refresh and start rentcar commands.

Dependencies

  • ESX Framework: Required for player management and bank transactions.
  • NativeUI: Required for the menu interface.

Files

  • fxmanifest.lua: Resource manifest file.
  • config.lua: Configuration file for vehicles, prices, and rental locations.
  • client.lua: Client-side script handling the rental menu, vehicle spawning, and timers.
  • server.lua: Server-side script for ESX integration and money deduction logic.

Usage

  1. Approach a rental location (marked by a blip and marker).
  2. Press the interaction key (default: E) to open the rental menu.
  3. Select a vehicle and confirm the rental (cost will be deducted from the player's bank).
  4. Drive the vehicle for the rental duration. A per-minute fee will be deducted if configured.
  5. If the player exits the vehicle for more than 60 seconds, it will be deleted.
  6. The vehicle will also be deleted when the rental duration expires.

Commands

  • /kirtotaxi: Opens the rental menu if the player is eligible to rent (based on taxi driver availability).

Configuration

Edit config.lua to:

  • Set the required number of online taxi drivers (Config.RequiredTaxiOnline).
  • Adjust the rental duration (Config.RentDuration) in minutes.
  • Set the per-minute rental fee (Config.PricePerMinute).
  • Define available vehicles and their prices (Config.RentVehicles).
  • Specify rental locations (Config.RentMarkers).

Notes

  • Ensure that the vehicle models listed in config.lua are available in your server.
  • The script checks for online taxi drivers to prevent rentals if enough taxis are available.
  • Players must have sufficient funds in their bank to rent a vehicle or continue the rental.

Credits

  • Author: Arad | github.com/aradashkan
  • Version: 1.0.0

اسکریپت اجاره خودرو برای FiveM

توضیحات

این اسکریپت برای FiveM طراحی شده است و به بازیکنان امکان می‌دهد تا در مکان‌های مشخصی در بازی خودرو اجاره کنند. این اسکریپت شامل یک منوی کاربرپسند برای انتخاب خودروها، سیستم اجاره مبتنی بر زمان، و ادغام با فریم‌ورک ESX است. بازیکنان می‌توانند خودروها را برای مدت زمان مشخصی اجاره کنند و هزینه‌ها از موجودی بانکی آن‌ها در بازی کسر می‌شود. همچنین، اسکریپت بررسی می‌کند که تعداد رانندگان تاکسی آنلاین کافی نباشد تا اجاره امکان‌پذیر شود.

ویژگی‌ها

  • سیستم اجاره خودرو: بازیکنان می‌توانند از مکان‌های مشخص‌شده با نشانگرها و بلیپ‌ها خودرو اجاره کنند.
  • گزینه‌های قابل تنظیم: امکان سفارشی‌سازی خودروها، قیمت‌ها، مدت زمان اجاره، و مکان‌های نشانگر در فایل config.lua.
  • ادغام با ESX: استفاده از فریم‌ورک ESX برای مدیریت بازیکنان و تراکنش‌های بانکی.
  • پلاک تصادفی: تولید پلاک‌های منحصربه‌فرد برای خودروهای اجاره‌ای.
  • سیستم تایمر: حذف خودکار خودروهای اجاره‌ای پس از اتمام دوره اجاره یا در صورت خروج طولانی‌مدت بازیکن از خودرو.
  • پشتیبانی از بلیپ و نشانگر: نشانه‌های بصری برای مکان‌های اجاره.
  • سیستم اعلان: اعلان‌های داخل بازی برای اقدامات مختلف (مانند اجاره موفق، کمبود موجودی).

نصب

  1. اطمینان حاصل کنید که فریم‌ورک ESX و NativeUI روی سرور FiveM شما نصب شده‌اند.
  2. پوشه اسکریپت را در پوشه resources سرور کپی کنید.
  3. در فایل server.cfg خط ensure rentcar را اضافه کنید.
  4. فایل config.lua را برای تنظیم گزینه‌های خودرو، قیمت‌ها، و مکان‌های اجاره ویرایش کنید.
  5. سرور را ری‌استارت کنید یا از دستورات refresh و start rentcar استفاده کنید.

پیش‌نیازها

  • فریم‌ورک ESX: برای مدیریت بازیکنان و تراکنش‌های بانکی ضروری است.
  • NativeUI: برای رابط کاربری منو مورد نیاز است.

فایل‌ها

  • fxmanifest.lua: فایل مانیفست منبع.
  • config.lua: فایل تنظیمات برای خودروها، قیمت‌ها، و مکان‌های اجاره.
  • client.lua: اسکریپت سمت کلاینت برای مدیریت منوی اجاره، تولید خودرو، و تایمرها.
  • server.lua: اسکریپت سمت سرور برای ادغام با ESX و منطق کسر پول.

استفاده

  1. به یک مکان اجاره (مشخص‌شده با بلیپ و نشانگر) نزدیک شوید.
  2. کلید تعامل (پیش‌فرض: E) را فشار دهید تا منوی اجاره باز شود.
  3. یک خودرو انتخاب کنید و اجاره را تأیید کنید (هزینه از حساب بانکی بازیکن کسر می‌شود).
  4. خودرو را در طول مدت اجاره رانندگی کنید. در صورت تنظیم، هزینه‌ای به‌صورت دقیقه‌ای کسر می‌شود.
  5. اگر بازیکن بیش از 60 ثانیه از خودرو خارج شود، خودرو حذف خواهد شد.
  6. خودرو همچنین پس از اتمام مدت زمان اجاره حذف می‌شود.

دستورات

  • /kirtotaxi: اگر بازیکن واجد شرایط اجاره باشد (بر اساس تعداد رانندگان تاکسی آنلاین)، منوی اجاره را باز می‌کند.

تنظیمات

فایل config.lua را ویرایش کنید تا:

  • تعداد رانندگان تاکسی آنلاین مورد نیاز (Config.RequiredTaxiOnline) را تنظیم کنید.
  • مدت زمان اجاره (Config.RentDuration) را به دقیقه تنظیم کنید.
  • هزینه اجاره به‌صورت دقیقه‌ای (Config.PricePerMinute) را تعیین کنید.
  • خودروهای موجود و قیمت‌های آن‌ها (Config.RentVehicles) را تعریف کنید.
  • مکان‌های اجاره (Config.RentMarkers) را مشخص کنید.

نکات

  • اطمینان حاصل کنید که مدل‌های خودرو ذکرشده در config.lua در سرور شما موجود باشند.
  • اسکریپت بررسی می‌کند که تعداد رانندگان تاکسی آنلاین کافی نباشد تا اجاره امکان‌پذیر شود.
  • بازیکنان باید موجودی کافی در بانک خود داشته باشند تا بتوانند خودرو اجاره کنند یا اجاره را ادامه دهند.

اعتبار

  • نویسنده: آراد | github.com/aradashkan
  • نسخه: 1.0.0

Releases

No releases published

Packages

No packages published

Languages