Config file
--[[
Client Event List
tgiann-hotwire:engineOnOff -- starts or stops the vehicle's engine
TriggerEvent('tgiann-hotwire:engineOnOff')
tgiann-hotwire:forceTurnOver -- starts the engine of the vehicle
TriggerEvent('tgiann-hotwire:forceTurnOver', GetVehiclePedIsIn(PlayerPedId()))
tgiann-hotwire:give-keys-with-plate -- gives the vehicle key to the player(with license plate)
TriggerEvent('tgiann-hotwire:give-keys-with-plate', GetVehicleNumberPlateText(GetVehiclePedIsIn(PlayerPedId())))
tgiann-hotwire:give-keys-with-carid -- gives the vehicle key to the player(with car id)
TriggerEvent('tgiann-hotwire:give-keys-with-carid', GetVehiclePedIsIn(PlayerPedId()))
tgiann-hotwire:giveCarKeys -- Gives the car key to the nearby player
TriggerEvent('tgiann-hotwire:giveCarKeys')
tgiann-hotwire:lockUnlock -- lock or unlock nearby vehicle
TriggerEvent('tgiann-hotwire:lockUnlock')
]]
Config = {}
Shared = {}
Config.framework = "esx" -- esx - qb
Config.mysql = "mysql" -- oxmysql - mysql [Don't forget to edit the fxmanifest file]
Config.test = true -- /testGiveKey
--Car lock unlock anim
Config.animDict = "anim@mp_player_intmenu@key_fob@"
Config.animName = "fob_click"
Config.giveCarKeysCommand = "givecarkeys" -- gives the vehicle key to the nearby player
Config.oneTimesHotwire = true -- can try once for each vehicle
Config.hotwireKey = 304 --H
Config.lockpickKey = 182 --L
Config.engineOnOffKeyActive = true
Config.engineOnOffKey = "k"
Config.engineOnOffdescription = "Start/stop the vehicle's engine"
--Car lock unlock key
Config.carlockKey = "u"
Config.carlockdescription = "Lock a Car"
Config.policeAlert = true -- send a report to the cops when you steal the car
Config.policeAlertPercent = 50
Config.removeLockPickPercent = 20 -- percent deleted when using a lockpick
Config.disableHotwireVehicleClass = {15, 16, 19, 13, 10, 11, 17} -- car types in the list cannot be hotwired
Config.lockPickItemName = "lockpick"
Config.enableSearch = true
Config.searchPolicePercent = 15 -- police alert ratio
Config.searchKey = 20 --Z
Config.searchMoney = {100, 200} --min, max
Config.searchItems = {
-- İtem Name, Amount
{"radio", 1},
{"chair1", 1},
{"lockpick", 1},
}
Config.lockpickSound = "lockpick"
Config.lockpickSoundDistance = 3.0
Config.lockpickSoundVolume = 0.4
Config.alarmSoundTime = {
outsideLockpick = 25,
lockpick = 35,
hotwire = 60,
}
Config.policeAlertFunction = function()
-- Your police alert code
end
--Config.text[""]
Config.text = {
["noLockpick"] = "You don't have lockpick",
["noHotwire"] = "the cables are tangled, you can't do anything",
["hotWireText"] = "[H] Hotwire",
["lockpickText"] = "[L] Lockpick",
["searchText"] = "[Z] Search",
["findKey"] = "You find Keys",
["notFound"] = "You couldn't find anything",
["notInCar"] = "You are not in the vehicle",
["noNear"] = "There is no one near",
["noKey"] = "You don't have the car key",
["giveKey"] = "someone gave you the car key",
["foundMoney"] = "You found money",
["foundItem"] = "You found something inside the car",
["vehOpen"] = "Doors unlocked",
["vehLocked"] = "Doors locked",
}
Shared.Trim = function(value)
if not value then return nil end
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
end
Shared.RequestAnimDict = function(animDict, cb)
if not HasAnimDictLoaded(animDict) then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Citizen.Wait(1)
end
end
if cb ~= nil then
cb()
end
end
Shared.GetClosestVehicle = function(coords)
local ped = PlayerPedId()
local vehicles = GetGamePool('CVehicle')
local closestDistance = -1
local closestVehicle = -1
if coords then
coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
else
coords = GetEntityCoords(ped)
end
for i = 1, #vehicles, 1 do
local vehicleCoords = GetEntityCoords(vehicles[i])
local distance = #(vehicleCoords - coords)
if closestDistance == -1 or closestDistance > distance then
closestVehicle = vehicles[i]
closestDistance = distance
end
end
return closestVehicle, closestDistance
end
Shared.GetClosestPlayer = function(coords)
local ped = PlayerPedId()
if coords then
coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
else
coords = GetEntityCoords(ped)
end
local closestPlayers = Shared.GetPlayersFromCoords(coords)
local closestDistance = -1
local closestPlayer = -1
for i = 1, #closestPlayers, 1 do
if closestPlayers[i] ~= PlayerId() and closestPlayers[i] ~= -1 then
local pos = GetEntityCoords(GetPlayerPed(closestPlayers[i]))
local distance = #(pos - coords)
if closestDistance == -1 or closestDistance > distance then
closestPlayer = closestPlayers[i]
closestDistance = distance
end
end
end
return closestPlayer, closestDistance
end
Shared.GetPlayersFromCoords = function(coords, distance)
local players = GetActivePlayers()
local ped = PlayerPedId()
if coords then
coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
else
coords = GetEntityCoords(ped)
end
distance = distance or 5
local closePlayers = {}
for _, player in pairs(players) do
local target = GetPlayerPed(player)
local targetCoords = GetEntityCoords(target)
local targetdistance = #(targetCoords - coords)
if targetdistance <= distance then
closePlayers[#closePlayers + 1] = player
end
end
return closePlayers
end
Last updated