LielXD / xd_locksystem

Vehicle Keys System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to my release this version of the locksystem is much better from the previous one, by performance, gameplay and features.

This script is completely Free.

xd_locksystem_v2|690x388

This resource will upgrade your roleplay server with more features for players to use with vehicles, to make the roleplay experience better.


Features

  • Locking/Unlocking vehicles with animation and car key prop.
  • Lockpick locked vehicles with a cool minigame.
  • Hotwire vehicles to start the engine without keys.
  • Rob keys from npc driving around you.
  • Ability to give your keys to otherplayer.
  • Everything Synced with the server.
  • Many customizable configs to match your server prefrences.

Developers

Exports

To set owned vehicle keys you can use the exports below.

exports['xd_locksystem']:SetVehicleKey(plate, remove)
  • plate - the vehicle license plate.

  • remove - if true then it will remove the key from any player.

exports['xd_locksystem']:GetVehicleData(plate)
  • plate - the vehicle plate you want to check key for.

this will return 2 values:

  • keys - with these values

    • false - no one have keys to the vehicle.

    • true - someone have keys to the vehicle.

    • 'self' - current player have keys to vehicle.

  • lockpick - with these values

    • false - vehicle have not lockpicked.

    • true - vehicle lockpicked.

    • 'NPC' - used in the script to prevent from players to lockpick npc vehicles driving around.

Example
client script:

RegisterCommand('engine', function()
	local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
	if vehicle ~= 0 then
		local plate = GetVehicleNumberPlateText(vehicle)
		local VehicleData = exports['xd_locksystem']:GetVehicleData(plate)

		-- make sure here to check if the current player have keys ↓
		if VehicleData.keys == 'self' then
			local engineState = GetIsVehicleEngineRunning(vehicle)
			SetVehicleEngineOn(vehicle, not engineState, false, true)
		end
	end
end)

Give key to other player

You can use the command:

/givekey [player_id]

if there is no id specified then closest player will get the key.


Help! Please! if you need any help or found any bugs please open an issue at the resource github repository.


Video
Click Here for Video!


Download
Click Here to Download! make sure you download from the releases section.


My Scripts

About

Vehicle Keys System


Languages

Language:Lua 67.3%Language:JavaScript 19.8%Language:CSS 10.6%Language:HTML 2.2%