forked from Simnation/Main
109 lines
3.6 KiB
Lua
109 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 = 235, texture = 1 }, -- Hose
|
|||
|
{ component_id = 6, drawable = 165, texture = 0 }, -- Schuhe
|
|||
|
{ component_id = 8, drawable = 224, texture = 0 }, -- T-Shirt
|
|||
|
{ component_id = 9, drawable = 99, texture = 3 }, -- Weste
|
|||
|
{ component_id = 11, drawable = 693, texture = 0 } -- Torso
|
|||
|
}
|
|||
|
local props = {
|
|||
|
{ component_id = 0, drawable = 276, texture = 11 }, -- Hut
|
|||
|
{ component_id = 1, drawable = 5, texture = 0 } -- Brille
|
|||
|
}
|
|||
|
applyOutfit(components, props)
|
|||
|
end)
|
|||
|
|
|||
|
RegisterCommand("admin2", function()
|
|||
|
local components = {
|
|||
|
{ component_id = 3, drawable = 262, texture = 1 }, -- Arme
|
|||
|
{ component_id = 4, drawable = 237, texture = 0 }, -- Hose
|
|||
|
{ component_id = 6, drawable = 100, texture = 0 }, -- Schuhe
|
|||
|
{ component_id = 8, drawable = 299, texture = 0 }, -- T-Shirt
|
|||
|
{ component_id = 9, drawable = 109, texture = 7 }, -- Weste
|
|||
|
{ component_id = 11, drawable = 643, texture = 20 } -- Torso
|
|||
|
}
|
|||
|
local props = {
|
|||
|
{ component_id = 0, drawable = 274, texture = 11 }, -- Hut
|
|||
|
{ component_id = 1, drawable = 5, texture = 0 } -- 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)
|