forked from Simnation/Main
ed
This commit is contained in:
parent
f8e8411e7e
commit
19a5a1d158
4 changed files with 0 additions and 0 deletions
53
resources/[Developer]/[Max]/Carplate/client.lua
Normal file
53
resources/[Developer]/[Max]/Carplate/client.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
RegisterNetEvent("kennzeichen:useTool", function()
|
||||
local playerPed = PlayerPedId()
|
||||
local veh = QBCore.Functions.GetClosestVehicle(GetEntityCoords(playerPed))
|
||||
if veh and veh ~= 0 then
|
||||
local input = lib.inputDialog("Kennzeichen ändern", {
|
||||
{type = "input", label = "Neues Kennzeichen", required = true}
|
||||
})
|
||||
if input and input[1] then
|
||||
local plate = input[1]
|
||||
TriggerServerEvent("kennzeichen:updatePlate", VehToNet(veh), plate)
|
||||
end
|
||||
else
|
||||
QBCore.Functions.Notify("Kein Fahrzeug in der Nähe", "error")
|
||||
end
|
||||
end)
|
||||
|
||||
local plateBackup = {}
|
||||
|
||||
RegisterNetEvent("kennzeichen:useTuch", function()
|
||||
local playerPed = PlayerPedId()
|
||||
local veh = QBCore.Functions.GetClosestVehicle(GetEntityCoords(playerPed))
|
||||
if veh and veh ~= 0 then
|
||||
local covered = plateBackup[veh] ~= nil
|
||||
if covered then
|
||||
SetVehicleNumberPlateText(veh, plateBackup[veh])
|
||||
plateBackup[veh] = nil
|
||||
else
|
||||
plateBackup[veh] = GetVehicleNumberPlateText(veh)
|
||||
SetVehicleNumberPlateText(veh, "-----")
|
||||
end
|
||||
TriggerServerEvent("kennzeichen:syncCover", VehToNet(veh), not covered)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("kennzeichen:applyPlate", function(netVeh, plate)
|
||||
local veh = NetToVeh(netVeh)
|
||||
if veh ~= 0 then
|
||||
SetVehicleNumberPlateText(veh, plate)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("kennzeichen:applyCover", function(netVeh, state)
|
||||
local veh = NetToVeh(netVeh)
|
||||
if veh ~= 0 then
|
||||
if state then
|
||||
SetVehicleNumberPlateText(veh, "-----")
|
||||
else
|
||||
-- Wenn Enttarnung erfolgt, müsste der Spieler es neu setzen
|
||||
end
|
||||
end
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue