This commit is contained in:
Nordi98 2025-08-09 11:32:44 +02:00
parent 1032235744
commit cb8b683d43
292 changed files with 15840 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,164 @@
local phoneProp = 0
local propCreated = false
local currentStatus = 'out'
local lastDict = nil
local lastAnim = nil
local lastProp = nil

local ANIMS = {
['cellphone@'] = {
['out'] = {
['text'] = 'cellphone_call_to_text',
['call'] = 'cellphone_call_listen_base'
},
['text'] = {
['out'] = 'cellphone_text_out',
['text'] = 'cellphone_text_in',
['call'] = 'cellphone_text_to_call'
},
['call'] = {
['out'] = 'cellphone_call_out',
['text'] = 'cellphone_call_to_text',
['call'] = 'cellphone_text_to_call'
}
},
['anim@cellphone@in_car@ps'] = {
['out'] = {
['text'] = 'cellphone_text_in',
['call'] = 'cellphone_call_in'
},
['text'] = {
['out'] = 'cellphone_text_out',
['text'] = 'cellphone_text_in',
['call'] = 'cellphone_text_to_call'
},
['call'] = {
['out'] = 'cellphone_horizontal_exit',
['text'] = 'cellphone_call_to_text',
['call'] = 'cellphone_text_to_call'
}
}
}

function newPhoneProp(prop)

local phoneModel = selectPhoneProp(prop)

deletePhone()

if not propCreated then
RequestModel(phoneModel)
while not HasModelLoaded(phoneModel) do
Wait(1)
end
local playerPed = PlayerPedId()
phoneProp = CreateObject(phoneModel, 1.0, 1.0, 1.0, 1, 1, 0)
local bone = GetPedBoneIndex(playerPed, 28422)
AttachEntityToEntity(phoneProp, playerPed, bone, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 0, 2, 1)
propCreated = true
end
end

function deletePhone()
if phoneProp ~= 0 then
DeleteEntity(phoneProp)
phoneProp = 0
propCreated = false
end
end

--[[
out || text || Call ||
--]]
function PhonePlayAnim(status, freeze, force, prop)
if currentStatus == status and force ~= true then
return
end

local myPedId = PlayerPedId()

GiveWeaponToPed(myPedId, 0xA2719263, 0, 0, 1)

local freeze = freeze or false

local dict = "cellphone@"
if IsPedInAnyVehicle(myPedId, false) then
dict = "anim@cellphone@in_car@ps"
end
loadAnimDict(dict)

local anim = ANIMS[dict][currentStatus][status]
if currentStatus ~= 'out' then
StopAnimTask(myPedId, lastDict, lastAnim, 1.0)
end
local flag = 50
if freeze == true then
flag = 14
end
TaskPlayAnim(myPedId, dict, anim, 3.0, -1, -1, flag, 0, false, false, false)

if status ~= 'out' and currentStatus == 'out' then
Wait(380)
newPhoneProp(prop)
end

lastDict = dict
lastAnim = anim
currentStatus = status

if status == 'out' then
Wait(180)
deletePhone()
StopAnimTask(myPedId, lastDict, lastAnim, 1.0)
end
end

function PhonePlayOut()
PhonePlayAnim('out')
end

function PhonePlayText(prop)
PhonePlayAnim('text', false, false, prop)
end

function PhonePlayCall(freeze)
PhonePlayAnim('call', freeze, false, "phone")
end

function PhonePlayIn(prop)
if currentStatus == 'out' then
PhonePlayText(prop)
end
end

function loadAnimDict(dict)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Wait(1)
end
end

function getAnimationStatus()
return currentStatus
end

function selectPhoneProp(propname)
local phoneModel = "prop_phone_ing_03"
if Config.UsePhoneProps then
local phoneModels = {
["phone"] = "phonesilver",
["purple_phone"] = "phonepurple",
["green_phone"] = "phonegreen",
["blue_phone"] = "phonelightblue",
["red_phone"] = "phonered",
['black_phone'] = "phoneblack"
}
phoneModel = phoneModels[propname] or phoneModels[lastProp] or phoneModel
end
return phoneModel
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,368 @@
if Config.RegisterKeyMapping then
RegisterKeyMapping('TogglePhone', Lang:t('info.openphone'), 'keyboard', Config.OpenKey)
else
CreateThread(function()
while true do
if IsControlJustReleased(0, Config.OpenKeyNumber) then
openPhone()
end
Wait(0)
end
end)
end

local isInFocus = false
local isBlocked = false

function sendNotification(text)

TriggerEvent('QBCore:Notify', text) --You can edit this event to any Notification System you want

end

function blockPhone()

if isBlocked then
return true
end

return false --return true if you want to block that anyone can open the phone
end

function GiveCarKeys(plate, model)

TriggerEvent("qb-vehiclekeys:client:AddKeys", plate)

end
CreateThread(function()
while true do
if getHandyActive() then
if not getFlashLight() then
DisableControlAction(0, 1, true)
DisableControlAction(0, 2, true)
end
DisableControlAction(0, 304, true)
DisableControlAction(0, 101, true)
DisableControlAction(0, 74, true)
DisableControlAction(0, 303, true)
DisableControlAction(0, 311, true)
DisableControlAction(0, 24, true)
DisableControlAction(0, 25, true)
DisableControlAction(0, 29, true)
DisableControlAction(0, 322, true)
DisableControlAction(0, 200, true)
DisableControlAction(0, 202, true)
DisableControlAction(0, 177, true)
DisableControlAction(0, 37, true)
DisableControlAction(0, 245, true)
DisableControlAction(0, 263, true)
DisableControlAction(0, 45, true)
DisableControlAction(0, 80, true)
DisableControlAction(0, 140, true)
DisableControlAction(0, 0, true)
DisableControlAction(0, 69, true)
DisableControlAction(0, 70, true)
DisableControlAction(0, 36, true)
DisableControlAction(0, 326, true)
DisableControlAction(0, 341, true)
DisableControlAction(0, 343, true)
DisableControlAction(0, 257, true)
DisableControlAction(0, 22, true)
DisableControlAction(0, 44, true)
DisableControlAction(0, 288, true)
DisableControlAction(0, 289, true)
DisableControlAction(0, 170, true)
DisableControlAction(0, 167, true)
DisableControlAction(0, 26, true)
DisableControlAction(0, 73, true)
DisableControlAction(2, 199, true)
DisableControlAction(0, 47, true)
DisableControlAction(0, 264, true)
DisableControlAction(0, 257, true)
DisableControlAction(0, 140, true)
DisableControlAction(0, 121, true)
DisableControlAction(0, 114, true)
DisableControlAction(0, 81, true)
DisableControlAction(0, 82, true)
DisableControlAction(0, 99, true)
DisableControlAction(0, 330, true)
DisableControlAction(0, 331, true)
DisableControlAction(0, 100, true)
DisableControlAction(0, 141, true)
DisableControlAction(0, 142, true)
DisableControlAction(0, 143, true)
DisableControlAction(0, 106, true)
DisableControlAction(0, 115, true)
DisableControlAction(0, 91, true)
DisableControlAction(0, 92, true)
DisableControlAction(0, 245, true)
DisableControlAction(0, 44, true)
DisableControlAction(0, 157, true)
DisableControlAction(0, 158, true)
DisableControlAction(0, 160, true)
DisableControlAction(0, 164, true)
DisableControlAction(0, 165, true)
DisableControlAction(0, 159, true)
DisableControlAction(0, 161, true)
DisableControlAction(0, 162, true)
DisableControlAction(0, 163, true)
DisableControlAction(0, 182, true)
end
Wait(0)
end
end)

function checkPlayerDead()
local PlayerData = QBCore.Functions.GetPlayerData()

if Config.VisnAre then
local dead = exports['visn_are']:GetHealthBuffer().unconscious

return dead
end

if not PlayerData or not PlayerData.metadata then
return false
end
return PlayerData.metadata['isdead']
end

function ShowHelpNotification(msg, thisFrame, beep, duration)
AddTextEntry('HelpNotification', msg)

if thisFrame then
DisplayHelpTextThisFrame('HelpNotification', false)
else
if beep == nil then
beep = true
end
BeginTextCommandDisplayHelp('HelpNotification')
EndTextCommandDisplayHelp(0, false, beep, duration or -1)
end
end

CreateThread(function()
while true do
Wait(500)
if NetworkIsPlayerActive(PlayerId()) then
TriggerServerEvent('roadphone:playerLoad', GetPlayerServerId(PlayerId()))
break
end
end
end)


RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()

CreateThread(function()
if Config.RemoveFromRadioWhenDead then
while true do
Wait(2000)
if checkPlayerDead() and isInRadio() then
TriggerEvent("roadphone:client:leaveradio")
end
end
end
end)
end)

RegisterNUICallback('inputfocus', function(data, cb) -- Do not change anything here!

isInFocus = data.focus
if isInFocus then
SetNuiFocusKeepInput(false)
else
SetNuiFocusKeepInput(true)
end

cb('ok')
end)

function setRadioChannel(frequenz, playername)
if Config.UseMumbleVoip then
exports[Config.MumbleExport]:addPlayerToRadio(frequenz)
exports[Config.MumbleExport]:SetMumbleProperty("radioEnabled", true)
elseif Config.UseTokoVoip then
local radiochannel = exports.tokovoip_script:getPlayerData(playername, "radio:channel")
exports.tokovoip_script:removePlayerFromRadio(radiochannel)
exports.tokovoip_script:setPlayerData(playername, "radio:channel", frequenz, true)
exports.tokovoip_script:addPlayerToRadio(frequenz)
elseif Config.UseSaltyChat then
exports['saltychat']:SetRadioChannel(frequenz, true)
elseif Config.UsePmaVoice then
exports[Config.PMAVoiceExport]:addPlayerToRadio(frequenz)
exports[Config.PMAVoiceExport]:setVoiceProperty('radioEnabled', true)
exports[Config.PMAVoiceExport]:setVoiceProperty('micClicks', true)
elseif Config.UseYacaVoice then
exports['yaca-voice']:enableRadio(true)
exports['yaca-voice']:changeRadioFrequency(frequenz)
end

TriggerEvent("roadphone:sendNotification", {
apptitle = "APP_RADIO_NAME",
title = Lang:t('info.radiojoined', { value = frequenz }),
message = nil,
img = "/public/img/Apps/light_mode/radio.webp"
})

setInRadio(true)
end

AddEventHandler("roadphone:client:call:eventnumber", function(number)

if tostring(number) == "77777" then --CHECK WHICH NUMBER IS CALLED
--YOUR CODE

end

end)

RegisterNUICallback('sendDispatch', function(data, cb)
TriggerServerEvent("roadphone:sendDispatch", GetPlayerServerId(PlayerId()), data.text, data.job, nil, false, data.image)
cb('ok')
end)

function clientSideInventoryValidation() -- DONT USE THIS FUNCTION IF YOU DONT KNOW WHAT YOU ARE DOING

--YOUR CODE

return 'PHONEITEM' --needs to return colored phone items name from config.lua = phone will open | false = phone will not open
end


function testMail()
local data = {
sender = 'RoadShop',
subject = "RoadShop TEST",
message = "Mails from scripts come back even better than before now even with <span style='color: red'>Color</span> support. <br> <br> + Support for line breaks and button support ^^",
button = {
buttonEvent = "qb-drugs:client:setLocation",
buttonData = "test",
buttonname = "test"
}
}

TriggerServerEvent("roadphone:receiveMail", data)
end

function playRoadSound(type)

if type == 'message' then
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)

elseif type == 'dispatch' then
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)

end
end



RegisterNUICallback('app_custom_event', function(data, cb)

local app = data.app

if app == "APPNAME" then

--Your Code
end


cb('ok')
end)

exports('isBlocked', function()

return blockPhone()
end)


exports('blockPhone', function()

isBlocked = true
return true
end)

exports('unblockPhone', function()

isBlocked = false
return false
end)

exports('inputFocus', function(boolean)

isInFocus = boolean

if isInFocus then
SetNuiFocusKeepInput(false)
else
SetNuiFocusKeepInput(true)
end
end)


function temperatureRanges(weatherType)
local temperatureRanges = {
ExtraSunny = {90, 110},
Clear = {80, 95},
Neutral = {80, 95},
Smog = {90, 95},
Foggy = {80, 90},
Clouds = {80, 90},
Overcast = {80, 80},
Clearing = {75, 85},
Raining = {75, 90},
ThunderStorm = {75, 90},
Blizzard = {-15, 10},
Snowing = {0, 32},
Snowlight = {0, 32},
Christmas = {-5, 15},
Halloween = {50, 80}
}

-- Fetch the range and get a random temperature within that range
local minTemp, maxTemp = table.unpack(temperatureRanges[weatherType])
local randomTemperature = getRandomInt(minTemp, maxTemp)

-- Convert to Celsius if necessary
if not Config.Fahrenheit then
randomTemperature = (randomTemperature - 32) * 5 / 9
end

-- Format and return temperature with unit
return string.format('%.0f°%s', randomTemperature, Config.Fahrenheit and 'F' or 'C')
end

CreateThread(function()
while true do
Wait(3000)

TriggerEvent('roadphone:checkWeather')

Wait(120000)
end
end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,243 @@
local inVehicle = false
local fizzPed = nil
local spawnRadius = Config.ValetRadius
local mechBlip = nil

RegisterNUICallback('searchCar', function(data, cb)
QBCore.Functions.TriggerCallback("roadphone:valet:loadVehicle", function(vehicle, coords)

if not vehicle and not coords then
return
end

if vehicle == false then
if coords then
SetNewWaypoint(coords.x, coords.y)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
})

end
return;
end

local plate = vehicle[1].plate

local gameVehicles = GetGamePool('CVehicle')

for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]

if DoesEntityExist(vehicle) then
if GetVehicleNumberPlateText(vehicle) == plate then
local vehicleCoords = GetEntityCoords(vehicle)
SetNewWaypoint(vehicleCoords.x, vehicleCoords.y)

TriggerEvent("roadphone:sendNotification", {
apptitle = "APP_VALET_NAME",
title = "APP_VALET_TITLE_WAYPOINT",
img = "/public/img/Apps/light_mode/valet.webp"
})
cb('ok')
return
end
end
end

TriggerEvent("roadphone:sendNotification", {
apptitle = "APP_VALET_NAME",
title = "APP_VALET_TITLE_CARNOTOUT",
img = "/public/img/Apps/light_mode/valet.webp"
})
end, data.plate)

cb('ok')
end)

RegisterNUICallback("deliverormarkcar", function(data, cb)
QBCore.Functions.TriggerCallback("roadphone:valet:loadVehicle", function(vehicle, coords)

if not vehicle and not coords then
return
end

if vehicle == false then
if coords then
SetNewWaypoint(coords.x, coords.y)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
})

end
return;
end

local plate = vehicle[1].plate

local gameVehicles = GetGamePool('CVehicle')

for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]

if DoesEntityExist(vehicle) then
if GetVehicleNumberPlateText(vehicle) == plate then
local vehicleCoords = GetEntityCoords(vehicle)
SetNewWaypoint(vehicleCoords.x, vehicleCoords.y)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
})
cb('ok')
return
end
end
end

QBCore.Functions.TriggerCallback("roadphone:valet:checkMoney", function(cb)

if cb then
SpawnVehicle(vehicle[1].vehicle, plate, json.decode(vehicle[1].mods))
end
end)

end, data.plate)

cb('ok')

end)

function SpawnVehicle(vehicle, plate, mods)

local player = PlayerPedId()
local playerPos = GetEntityCoords(player)
local found, spawnPos, spawnHeading = GetClosestVehicleNodeWithHeading(playerPos.x + math.random(-100, 100),
playerPos.y + math.random(-100, 100), playerPos.z, 0, 3, 0)

local driverhash = GetHashKey(Config.ValetPedModel)
local vehhash = GetHashKey(vehicle)

while not HasModelLoaded(driverhash) and RequestModel(driverhash) or not HasModelLoaded(vehhash) and
RequestModel(vehhash) do
RequestModel(driverhash)
RequestModel(vehhash)
Wait(0)
end

Wait(500)

QBCore.Functions.SpawnVehicle(vehicle, function(callback_vehicle)

QBCore.Functions.SetVehicleProperties(callback_vehicle, mods)
SetVehicleEngineOn(callback_vehicle, true)

fizzPed = CreatePedInsideVehicle(callback_vehicle, 26, driverhash, -1, true, false)
mechBlip = AddBlipForEntity(callback_vehicle)
SetBlipSprite(mechBlip, 225) -- Blip Spawning.
SetBlipFlashes(mechBlip, true)
SetBlipColour(mechBlip, 0)
SetBlipFlashes(mechBlip, false)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(plate)
EndTextCommandSetBlipName(mechBlip)

inVehicle = true
GiveCarKeys(GetVehicleNumberPlateText(callback_vehicle), vehicle.model)
TriggerServerEvent("roadphone:valetCarSetOutside", plate, vehicle)
TaskVehicle(callback_vehicle)
end, spawnPos, true)

end

function TaskVehicle(vehicle)
while inVehicle do
Wait(750)
local pedcoords = GetEntityCoords(PlayerPedId())
local plycoords = GetEntityCoords(fizzPed)
local dist = GetDistanceBetweenCoords(plycoords, pedcoords.x, pedcoords.y, pedcoords.z, false)

if dist <= 25.0 then
TaskVehicleDriveToCoord(fizzPed, vehicle, pedcoords.x, pedcoords.y, pedcoords.z, 10.0, 1, vehhash, 786475,
5.0, 1)
SetVehicleFixed(vehicle)
if dist <= 7.5 then
LeaveIt(vehicle)
break
else
Wait(500)
end
else
TaskVehicleDriveToCoord(fizzPed, vehicle, pedcoords.x, pedcoords.y, pedcoords.z, 15.0, 1, vehhash, 786475,
5.0, 1)
Wait(500)
end
end
end

function LeaveIt(vehicle)
TaskLeaveVehicle(fizzPed, vehicle, 14)
inVehicle = false
while IsPedInAnyVehicle(fizzPed, false) do
Wait(0)
end

Wait(500)
TaskWanderStandard(fizzPed, 10.0, 10)
Wait(10000)
DeleteEntity(fizzPed)
RemoveBlip(mechBlip)
mechBlip = nil
fizzPed = nil
end


RegisterNUICallback("getCars", function(data, cb)
QBCore.Functions.TriggerCallback("roadphone:valet:getCars", function(data)

for i = 1, #data do
if(data[i]) then
local vehiclename = data[i].vehicle

local vehiclemodelnames = getVehicleNames()

for k, v in pairs(vehiclemodelnames) do
if v[1] == model then
vehiclename = v[2]
end
end
data[i].vehicle = {}
data[i].vehicle.model = vehiclename
end
end

SendNUIMessage({
event = "setValetCars",
cars = data
})
end)
cb('ok')
end)


if Config.CarDebug then
CreateThread(function()

while true do

Wait(8000)

if IsPedInAnyVehicle(PlayerPedId(), false) then
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)

print("[DEBUG] Car Name: " .. GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
end

end

end)
end

View file

@ -0,0 +1,10 @@
--https://forum.cfx.re/t/help-creating-a-addtextentry-script/230504/5

local vehicle_names = {
{'vehicle_spawnname', 'displayed_name'}, --spawnName = vehicle.meta carname. displayed_name = displayed name in the menu
--example: {'pista', 'Ferrari 458 Pista'},
}

function getVehicleNames()
return vehicle_names
end

Binary file not shown.