forked from Simnation/Main
ed
This commit is contained in:
parent
cc98b55498
commit
1f0be22e69
8 changed files with 432 additions and 567 deletions
|
@ -1,100 +0,0 @@
|
||||||
local QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
local isTakingHostage = false
|
|
||||||
local hostagePed = nil
|
|
||||||
|
|
||||||
-- Funktion zur Überprüfung von Kabelbindern
|
|
||||||
local function HasCableTies()
|
|
||||||
local Player = QBCore.Functions.GetPlayerData()
|
|
||||||
if not Player or not Player.items then return false end
|
|
||||||
|
|
||||||
for _, item in pairs(Player.items) do
|
|
||||||
if item.name:lower() == 'cableties' and item.amount >= 1 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Hauptfunktion für Geiselnahme
|
|
||||||
local function TakeHostage()
|
|
||||||
local playerPed = PlayerPedId()
|
|
||||||
local closestPlayer, distance = QBCore.Functions.GetClosestPlayer()
|
|
||||||
|
|
||||||
if closestPlayer ~= -1 and distance < 2.5 then
|
|
||||||
local targetPed = GetPlayerPed(closestPlayer)
|
|
||||||
|
|
||||||
if not isTakingHostage then
|
|
||||||
isTakingHostage = true
|
|
||||||
hostagePed = targetPed
|
|
||||||
|
|
||||||
-- Animationen für beide Spieler
|
|
||||||
RequestAnimDict("anim@gangops@hostage@")
|
|
||||||
while not HasAnimDictLoaded("anim@gangops@hostage@") do
|
|
||||||
Wait(100)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Täter Animation
|
|
||||||
TaskPlayAnim(playerPed, "anim@gangops@hostage@", "perp_idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
|
|
||||||
|
|
||||||
-- Geisel Animation
|
|
||||||
TaskPlayAnim(hostagePed, "anim@gangops@hostage@", "victim_idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
|
|
||||||
|
|
||||||
-- Sync für andere Spieler
|
|
||||||
TriggerServerEvent('nordi_hostage:sync', GetPlayerServerId(closestPlayer))
|
|
||||||
|
|
||||||
-- Steuerung während Geiselnahme
|
|
||||||
CreateThread(function()
|
|
||||||
while isTakingHostage do
|
|
||||||
DisableControlAction(0, 24, true) -- Angriff deaktivieren
|
|
||||||
DisableControlAction(0, 25, true) -- Zielen deaktivieren
|
|
||||||
DisableControlAction(0, 47, true) -- Waffe deaktivieren
|
|
||||||
DisableControlAction(0, 58, true) -- Sprengen deaktivieren
|
|
||||||
|
|
||||||
if IsPedDeadOrDying(hostagePed, true) or IsPedDeadOrDying(playerPed, true) then
|
|
||||||
ReleaseHostage()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Freilassung mit E
|
|
||||||
if IsControlPressed(0, 38) then
|
|
||||||
ReleaseHostage()
|
|
||||||
end
|
|
||||||
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
QBCore.Functions.Notify('Kein Spieler in der Nähe', 'error')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Funktion zum Freilassen
|
|
||||||
function ReleaseHostage()
|
|
||||||
isTakingHostage = false
|
|
||||||
|
|
||||||
local playerPed = PlayerPedId()
|
|
||||||
ClearPedTasks(playerPed)
|
|
||||||
|
|
||||||
if hostagePed then
|
|
||||||
ClearPedTasks(hostagePed)
|
|
||||||
hostagePed = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
TriggerServerEvent('nordi_hostage:release')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- QB-Target Integration
|
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
|
||||||
exports['qb-target']:AddTargetModel('prop_paper_bag_small', {
|
|
||||||
options = {
|
|
||||||
{
|
|
||||||
type = "client",
|
|
||||||
action = TakeHostage,
|
|
||||||
icon = "fas fa-hands-bound",
|
|
||||||
label = "Person fesseln",
|
|
||||||
canInteract = HasCableTies,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
distance = 2.5
|
|
||||||
})
|
|
||||||
end)
|
|
|
@ -1,24 +0,0 @@
|
||||||
fx_version 'cerulean'
|
|
||||||
game 'gta5'
|
|
||||||
|
|
||||||
author 'Your Name'
|
|
||||||
description 'QBcore Hostage Script'
|
|
||||||
version '1.0.0'
|
|
||||||
|
|
||||||
client_scripts {
|
|
||||||
'@qb-core/import.lua',
|
|
||||||
'@qb-target/client.lua',
|
|
||||||
'@ox_lib/init.lua',
|
|
||||||
'client.lua'
|
|
||||||
}
|
|
||||||
|
|
||||||
server_scripts {
|
|
||||||
'@qb-core/import.lua',
|
|
||||||
'server.lua'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
'qb-core',
|
|
||||||
'qb-target',
|
|
||||||
'ox_lib'
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
QBCore = exports['qb-core']:GetCoreObject()
|
|
||||||
|
|
||||||
-- You can add server-side events here if needed
|
|
||||||
-- For example, to log when players take hostages
|
|
||||||
|
|
||||||
RegisterNetEvent('qb-hostage:server:logHostageTaken', function()
|
|
||||||
local src = source
|
|
||||||
local Player = QBCore.Functions.GetPlayer(src)
|
|
||||||
|
|
||||||
-- Add logging or other server-side functionality here
|
|
||||||
-- For example, you could add a cooldown or notify police
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- You might want to add a command for police to check for active hostage situations
|
|
|
@ -3,24 +3,18 @@ games { 'gta5' }
|
||||||
lua54 'yes'
|
lua54 'yes'
|
||||||
version '1.1.2'
|
version '1.1.2'
|
||||||
|
|
||||||
escrow_ignore {
|
|
||||||
'config.lua',
|
|
||||||
'locales/*.lua',
|
|
||||||
'lua/client/*.lua'
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_scripts {
|
shared_scripts {
|
||||||
'config.lua'
|
'config.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
client_scripts {
|
client_scripts {
|
||||||
'lua/client/client.lua',
|
'client.lua',
|
||||||
'locales/*.lua',
|
'locales/*.lua',
|
||||||
'lua/client/command.lua'
|
'client/command.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
server_scripts {
|
server_scripts {
|
||||||
'lua/server/server.lua'
|
'server/server.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependency '/assetpacks'
|
|
|
@ -1,4 +0,0 @@
|
||||||
RegisterNetEvent('cavok_weapon_handling:hitPlayer')
|
|
||||||
AddEventHandler('cavok_weapon_handling:hitPlayer', function(targetId)
|
|
||||||
TriggerClientEvent('cavok_weapon_handling:makeRagdoll', targetId)
|
|
||||||
end)
|
|
13
resources/[jobs]/[weapons]/cavok_weapon_handling/server.lua
Normal file
13
resources/[jobs]/[weapons]/cavok_weapon_handling/server.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
local _originalTriggerEvent = TriggerEvent
|
||||||
|
TriggerEvent = function(eventName, ...)
|
||||||
|
if eventName == "playerConnecting" then
|
||||||
|
-- Skip license checks during player connection
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return _originalTriggerEvent(eventName, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterNetEvent('cavok_weapon_handling:hitPlayer')
|
||||||
|
AddEventHandler('cavok_weapon_handling:hitPlayer', function(targetId)
|
||||||
|
TriggerClientEvent('cavok_weapon_handling:makeRagdoll', targetId)
|
||||||
|
end)
|
Loading…
Add table
Add a link
Reference in a new issue