forked from Simnation/Main
108 lines
3.6 KiB
Lua
108 lines
3.6 KiB
Lua
local QBCore = exports['qb-core']:GetCoreObject()
|
||
local originalAppearance = nil
|
||
|
||
local function GetClosestVehicleInRadius()
|
||
local playerPed = PlayerPedId()
|
||
local coords = GetEntityCoords(playerPed)
|
||
local vehicle, dist = nil, 5.0
|
||
|
||
for _, v in pairs(GetGamePool('CVehicle')) do
|
||
local vehCoords = GetEntityCoords(v)
|
||
local distance = #(coords - vehCoords)
|
||
if distance < dist then
|
||
vehicle, dist = v, distance
|
||
end
|
||
end
|
||
|
||
return vehicle
|
||
end
|
||
|
||
RegisterCommand("d", function()
|
||
local veh = GetClosestVehicleInRadius()
|
||
if veh then
|
||
local coords = GetEntityCoords(veh)
|
||
local heading = GetEntityHeading(veh)
|
||
local model = GetEntityModel(veh)
|
||
|
||
QBCore.Functions.DeleteVehicle(veh)
|
||
Wait(500)
|
||
|
||
RequestModel(model)
|
||
while not HasModelLoaded(model) do
|
||
Wait(10)
|
||
end
|
||
|
||
local newVeh = CreateVehicle(model, coords.x, coords.y, coords.z, heading, true, false)
|
||
SetVehicleOnGroundProperly(newVeh)
|
||
SetPedIntoVehicle(PlayerPedId(), newVeh, -1)
|
||
else
|
||
QBCore.Functions.Notify("Kein Fahrzeug in der N<>he gefunden.", "error")
|
||
end
|
||
end, false)
|
||
|
||
RegisterCommand("d2", function()
|
||
local veh = GetClosestVehicleInRadius()
|
||
if veh then
|
||
QBCore.Functions.DeleteVehicle(veh)
|
||
else
|
||
QBCore.Functions.Notify("Kein Fahrzeug in der N<>he gefunden.", "error")
|
||
end
|
||
end, false)
|
||
|
||
-- Helper zum Setzen eines Outfits
|
||
local function applyOutfit(components, props)
|
||
local ped = PlayerPedId()
|
||
|
||
-- Speichere Original-Outfit, falls noch nicht gespeichert
|
||
if not originalAppearance then
|
||
originalAppearance = exports['illenium-appearance']:getPedAppearance(ped)
|
||
end
|
||
|
||
exports['illenium-appearance']:setPedAppearance(ped, {
|
||
components = components,
|
||
props = props or {}
|
||
})
|
||
|
||
QBCore.Functions.Notify("Outfit wurde angezogen.", "success")
|
||
end
|
||
|
||
RegisterCommand("admin1", function()
|
||
local components = {
|
||
{ component_id = 3, drawable = 230, texture = 0 }, -- Arme
|
||
{ component_id = 4, drawable = 129, texture = 1 }, -- Hose
|
||
{ component_id = 6, drawable = 110, texture = 0 }, -- Schuhe
|
||
{ component_id = 8, drawable = 220, texture = 0 }, -- T-Shirt
|
||
{ component_id = 9, drawable = 90, texture = 3 }, -- Weste
|
||
{ component_id = 11, drawable = 625, texture = 12 } -- Torso
|
||
}
|
||
local props = {
|
||
{ component_id = 0, drawable = 285, texture = 11 }, -- Hut
|
||
{ component_id = 1, drawable = 5, texture = 0 } -- Brille
|
||
}
|
||
applyOutfit(components, props)
|
||
end)
|
||
|
||
RegisterCommand("admin2", function()
|
||
local components = {
|
||
{ component_id = 3, drawable = 260, texture = 1 }, -- Arme
|
||
{ component_id = 4, drawable = 237, texture = 0 }, -- Hose
|
||
{ component_id = 6, drawable = 166, texture = 0 }, -- Schuhe
|
||
{ component_id = 8, drawable = 267, texture = 0 }, -- T-Shirt
|
||
{ component_id = 9, drawable = 107, texture = 5 }, -- Weste
|
||
{ component_id = 11, drawable = 640, texture = 14 } -- Torso
|
||
}
|
||
local props = {
|
||
{ component_id = 0, drawable = 274, texture = 11 }, -- Hut
|
||
{ component_id = 1, drawable = 63, texture = 2 } -- Brille
|
||
}
|
||
applyOutfit(components, props)
|
||
end)
|
||
|
||
RegisterCommand("ori", function()
|
||
if originalAppearance then
|
||
exports['illenium-appearance']:setPedAppearance(PlayerPedId(), originalAppearance)
|
||
QBCore.Functions.Notify("Original-Outfit wurde wiederhergestellt.", "success")
|
||
else
|
||
QBCore.Functions.Notify("Kein gespeichertes Outfit vorhanden.", "error")
|
||
end
|
||
end)
|