1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-14 22:58:10 +02:00
parent cc98b55498
commit 1f0be22e69
8 changed files with 432 additions and 567 deletions

View file

@ -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)

View file

@ -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'
}

View file

@ -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

View file

@ -1,411 +1,411 @@
local lockKey = Config.LockKey
local breathing = false
local stamina = false
local staminaval = Config.Stamina
local sniperRifle = 100416529
local heavySniper = 205991906
local heavySniperMk2 = 177293209
local marksmanRifle = -952879014
local grenade = -1813897027
local stickybomb = 741814745
local proxmine = -1420407917
local pipebomb = -1169823560
function notify(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(true, false)
end
if Config.UseLindenInventory == false then
if Config.AutoReload then
SetWeaponsNoAutoreload(false)
else
SetWeaponsNoAutoreload(true)
end
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local playerPed = GetPlayerPed(-1)
local player = PlayerId()
hasWeapon,pedWeapon = GetCurrentPedWeapon(playerPed)
if hasWeapon ~= false and pedWeapon ~= 0 then
while hasWeapon ~= false do
Citizen.Wait(1)
local hasWeapon, pedWeapon = GetCurrentPedWeapon(playerPed)
local weaponType = GetWeaponDamageType(pedWeapon)
local weaponShootingType = GetWeapontypeGroup(pedWeapon)
while not HasAnimDictLoaded("mp_arresting") do
Citizen.Wait(1)
RequestAnimDict("mp_arresting")
end
if pedWeapon == grenade or pedWeapon == stickybomb or pedWeapon == proxmine or pedWeapon == pipebomb then
break
end
if weaponType == 1 or weaponType == 2 or weaponType == 12 or weaponType == 6 or weaponType == 14 or weaponType == 13 then
break
else
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
if pedWeapon == sniperRifle or pedWeapon == heavySniper or pedWeapon == heavySniperMk2 or pedWeapon == marksmanRifle then
ShowHudComponentThisFrame(14)
end
end
if Config.UseWeaponLock == true then
if Config.WeaponLock[pedWeapon] == 0 then
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 1
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_weapon_locked)
else
notify(str_weapon_locked)
end
end
end
else
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 1
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_weapon_locked)
else
notify(str_weapon_locked)
end
end
RequestAnimDict("mp_arresting")
TaskPlayAnim(playerPed, "mp_arresting", "a_uncuff", 2.0, 2.0, 1000, 52, 0, false, false, false)
end
end
else
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 0
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('adm', str_weapon_unlocked)
else
notify(str_weapon_unlocked)
end
end
end
else
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 0
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('adm', str_weapon_unlocked)
else
notify(str_weapon_unlocked)
end
end
RequestAnimDict("mp_arresting")
TaskPlayAnim(playerPed, "mp_arresting", "a_uncuff", 2.0, 2.0, 1000, 52, 0, false, false, false)
end
end
end
else
end
if Config.UseWeaponLock == false or Config.WeaponLock[pedWeapon] == 0 or Config.WeaponsNoLock[pedWeapon] then
if IsPedShooting(playerPed) then
local _,pedWeapon = GetCurrentPedWeapon(playerPed)
local pedCamPitch = GetGameplayCamRelativePitch()
local weaponRecoil = Config.WeaponRecoil[pedWeapon]
if weaponRecoil == nil then
weaponRecoil = Config.StandardWerte.Recoil
end
local weaponShake = Config.WeaponShake[pedWeapon]
if weaponShake == nil then
weaponShake = Config.StandardWerte.Shake
end
local recoilSpeed = Config.WeaponRecoilSpeed
ViewMode = GetFollowPedCamViewMode()
if ViewMode == 4 then
newWeaponRecoil = weaponRecoil * Config.FirstPersonRecoilFactor
SetGameplayCamRelativePitch(pedCamPitch + newWeaponRecoil, recoilSpeed)
else
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil, recoilSpeed)
end
if Config.WeaponShake and stamina == false then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake)
end
if Config.UseCustomDamage then
SetWeaponDamageModifierThisFrame(pedWeapon, Config.WeaponDamage[pedWeapon] or Config.StandardWerte.Damage)
end
if Config.UseScreenEffect then
AnimpostfxPlay(Config.ScreenEffect, Config.ScreenEffectLength, Config.ScreenEffectLoop)
end
if IsPedInAnyVehicle(playerPed, true) then
Citizen.Wait(0)
PedVehicle = GetVehiclePedIsIn(playerPed, false)
PedVehicleType = GetVehicleClass(PedVehicle)
for class, allowed in pairs(Config.VehicleWhitelist) do
if class == PedVehicleType and allowed == true then
local vehRecoilVal = Config.VehicleRecoilValue
local vehShakeVal = Config.VehicleShakeValue
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
if Config.VehicleRecoil then
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil + vehRecoilVal, recoilSpeed)
if Config.VehicleShake then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake + vehShakeVal)
end
end
end
end
end
shooting = true
end
if hasWeapon == false then
break
end
else
DisablePlayerFiring(player, true)
if IsControlJustPressed(0, 237) then
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('false', str_weapon_still_locked)
else
notify(str_weapon_still_locked)
end
end
end
if hasWeapon == false then
break
end
end
--[[STAMINA SYSTEM]]--
if Config.UseStaminaSystem then
if shooting and IsControlPressed(0, 25) and staminaval > 0 then
if stamina then
shooting = false
else
shooting = false
end
end
if not IsGameplayCamShaking() and IsControlPressed(0, 25) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
end
if IsControlJustPressed(0, 25) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
local player = GetPlayerServerId(PlayerId())
if IsControlPressed(0, 25) then
if IsPedShooting(playerPed) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
end
end
breathing = true
end
if IsControlJustReleased(0, 25) then
StopGameplayCamShaking(true)
breathing = false
stamina = false
end
if IsControlJustPressed(0, 21) and breathing == true and staminaval ~= 0 then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueHoldBreath)
stamina = true
end
if stamina and staminaval >= 0 then
staminaval = staminaval -1
if staminaval == 0 then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal + Config.BreathingValueNoStamina)
DisableControlAction(0, 21, true)
AnimpostfxPlay("SwitchHUDIn", 0, false)
end
else
if staminaval < Config.Stamina then
staminaval = staminaval + 1
if IsControlJustPressed(0, 24) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal + Config.BreathingValueNoStamina)
end
if staminaval > Config.StaminaTreshold then
AnimpostfxStopAll()
DisableControlAction(0, 21, false)
stamina = false
end
end
end
end
--[[FIRING MODES]]--
if Config.UseWeaponFiringMode then
if weaponShootingType == -957766203 or weaponShootingType == 970310034 then
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, Config.WeaponFiringModeKey) then
if Config.WeaponFiringMode[pedWeapon] == 1 then
Config.WeaponFiringMode[pedWeapon] = 0
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_auto)
else
notify(str_firing_mode_auto)
end
else
Config.WeaponFiringMode[pedWeapon] = 1
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_single)
else
notify(str_firing_mode_single)
end
end
end
if Config.WeaponFiringMode[pedWeapon] == 1 then
if IsPedDoingDriveby(playerPed) then
local _,pedWeapon = GetCurrentPedWeapon(playerPed)
local pedCamPitch = GetGameplayCamRelativePitch()
local weaponRecoil = Config.WeaponRecoil[pedWeapon]
local weaponShake = Config.WeaponShake[pedWeapon]
local recoilSpeed = Config.WeaponRecoilSpeed
local vehRecoilVal = Config.VehicleRecoilValue
local vehShakeVal = Config.VehicleShakeValue
while IsControlPressed(0, 24) or IsDisabledControlPressed(0, 24) do
Citizen.Wait(5)
DisablePlayerFiring(player, true)
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
if Config.VehicleRecoil then
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil + vehRecoilVal, recoilSpeed)
if Config.VehicleShake then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake + vehShakeVal)
end
end
end
end
end
else
if IsControlJustPressed(0, Config.WeaponFiringModeKey) then
if Config.WeaponFiringMode[pedWeapon] == 1 then
Config.WeaponFiringMode[pedWeapon] = 0
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_auto)
else
notify(str_firing_mode_auto)
end
else
Config.WeaponFiringMode[pedWeapon] = 1
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_single)
else
notify(str_firing_mode_single)
end
end
end
if Config.WeaponFiringMode[pedWeapon] == 1 then
if IsPedShooting(playerPed) then
while IsControlPressed(0, 24) or IsDisabledControlPressed(0, 24) do
Citizen.Wait(0)
DisablePlayerFiring(player, true)
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
end
end
end
end
end
end
end
end
else
hasWeapon = false
end
end
end)
Citizen.CreateThread(function()
while true do
Wait(0)
local playerPed = PlayerPedId()
if IsPedShooting(playerPed) then
local weapon = GetSelectedPedWeapon(playerPed)
if Config.rubberBulletWeapons[weapon] then
local hit, entity = GetEntityPlayerIsAimingAt()
if hit and IsEntityAPed(entity) and not IsPedAPlayer(entity) == false then
TriggerServerEvent('cavok_weapon_handling:hitPlayer', GetPlayerServerId(NetworkGetPlayerIndexFromPed(entity)))
end
end
end
end
end)
function GetEntityPlayerIsAimingAt()
local result, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
return result, entity
end
RegisterNetEvent('cavok_weapon_handling:makeRagdoll')
AddEventHandler('cavok_weapon_handling:makeRagdoll', function()
local ped = PlayerPedId()
local boneHit = 0
local success, bone = GetPedLastDamageBone(ped)
if success then
boneHit = bone
end
local racdollTime = 1000
for k, v in pairs(Config.RagdollTime) do
if boneHit == k then
racdollTime = v
end
end
SetPedToRagdoll(ped, racdollTime, racdollTime, 0, false, false, false)
local lockKey = Config.LockKey
local breathing = false
local stamina = false
local staminaval = Config.Stamina
local sniperRifle = 100416529
local heavySniper = 205991906
local heavySniperMk2 = 177293209
local marksmanRifle = -952879014
local grenade = -1813897027
local stickybomb = 741814745
local proxmine = -1420407917
local pipebomb = -1169823560
function notify(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(true, false)
end
if Config.UseLindenInventory == false then
if Config.AutoReload then
SetWeaponsNoAutoreload(false)
else
SetWeaponsNoAutoreload(true)
end
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local playerPed = GetPlayerPed(-1)
local player = PlayerId()
hasWeapon,pedWeapon = GetCurrentPedWeapon(playerPed)
if hasWeapon ~= false and pedWeapon ~= 0 then
while hasWeapon ~= false do
Citizen.Wait(1)
local hasWeapon, pedWeapon = GetCurrentPedWeapon(playerPed)
local weaponType = GetWeaponDamageType(pedWeapon)
local weaponShootingType = GetWeapontypeGroup(pedWeapon)
while not HasAnimDictLoaded("mp_arresting") do
Citizen.Wait(1)
RequestAnimDict("mp_arresting")
end
if pedWeapon == grenade or pedWeapon == stickybomb or pedWeapon == proxmine or pedWeapon == pipebomb then
break
end
if weaponType == 1 or weaponType == 2 or weaponType == 12 or weaponType == 6 or weaponType == 14 or weaponType == 13 then
break
else
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
if pedWeapon == sniperRifle or pedWeapon == heavySniper or pedWeapon == heavySniperMk2 or pedWeapon == marksmanRifle then
ShowHudComponentThisFrame(14)
end
end
if Config.UseWeaponLock == true then
if Config.WeaponLock[pedWeapon] == 0 then
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 1
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_weapon_locked)
else
notify(str_weapon_locked)
end
end
end
else
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 1
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_weapon_locked)
else
notify(str_weapon_locked)
end
end
RequestAnimDict("mp_arresting")
TaskPlayAnim(playerPed, "mp_arresting", "a_uncuff", 2.0, 2.0, 1000, 52, 0, false, false, false)
end
end
else
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 0
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('adm', str_weapon_unlocked)
else
notify(str_weapon_unlocked)
end
end
end
else
if IsControlJustPressed(0, lockKey) and Config.WeaponsNoLock[pedWeapon] == false then
Config.WeaponLock[pedWeapon] = 0
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('adm', str_weapon_unlocked)
else
notify(str_weapon_unlocked)
end
end
RequestAnimDict("mp_arresting")
TaskPlayAnim(playerPed, "mp_arresting", "a_uncuff", 2.0, 2.0, 1000, 52, 0, false, false, false)
end
end
end
else
end
if Config.UseWeaponLock == false or Config.WeaponLock[pedWeapon] == 0 or Config.WeaponsNoLock[pedWeapon] then
if IsPedShooting(playerPed) then
local _,pedWeapon = GetCurrentPedWeapon(playerPed)
local pedCamPitch = GetGameplayCamRelativePitch()
local weaponRecoil = Config.WeaponRecoil[pedWeapon]
if weaponRecoil == nil then
weaponRecoil = Config.StandardWerte.Recoil
end
local weaponShake = Config.WeaponShake[pedWeapon]
if weaponShake == nil then
weaponShake = Config.StandardWerte.Shake
end
local recoilSpeed = Config.WeaponRecoilSpeed
ViewMode = GetFollowPedCamViewMode()
if ViewMode == 4 then
newWeaponRecoil = weaponRecoil * Config.FirstPersonRecoilFactor
SetGameplayCamRelativePitch(pedCamPitch + newWeaponRecoil, recoilSpeed)
else
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil, recoilSpeed)
end
if Config.WeaponShake and stamina == false then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake)
end
if Config.UseCustomDamage then
SetWeaponDamageModifierThisFrame(pedWeapon, Config.WeaponDamage[pedWeapon] or Config.StandardWerte.Damage)
end
if Config.UseScreenEffect then
AnimpostfxPlay(Config.ScreenEffect, Config.ScreenEffectLength, Config.ScreenEffectLoop)
end
if IsPedInAnyVehicle(playerPed, true) then
Citizen.Wait(0)
PedVehicle = GetVehiclePedIsIn(playerPed, false)
PedVehicleType = GetVehicleClass(PedVehicle)
for class, allowed in pairs(Config.VehicleWhitelist) do
if class == PedVehicleType and allowed == true then
local vehRecoilVal = Config.VehicleRecoilValue
local vehShakeVal = Config.VehicleShakeValue
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
if Config.VehicleRecoil then
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil + vehRecoilVal, recoilSpeed)
if Config.VehicleShake then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake + vehShakeVal)
end
end
end
end
end
shooting = true
end
if hasWeapon == false then
break
end
else
DisablePlayerFiring(player, true)
if IsControlJustPressed(0, 237) then
if Config.WeaponLockMessage then
if Config.UseBigNotify then
exports['b1g_notify']:Notify('false', str_weapon_still_locked)
else
notify(str_weapon_still_locked)
end
end
end
if hasWeapon == false then
break
end
end
--[[STAMINA SYSTEM]]--
if Config.UseStaminaSystem then
if shooting and IsControlPressed(0, 25) and staminaval > 0 then
if stamina then
shooting = false
else
shooting = false
end
end
if not IsGameplayCamShaking() and IsControlPressed(0, 25) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
end
if IsControlJustPressed(0, 25) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
local player = GetPlayerServerId(PlayerId())
if IsControlPressed(0, 25) then
if IsPedShooting(playerPed) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal)
end
end
breathing = true
end
if IsControlJustReleased(0, 25) then
StopGameplayCamShaking(true)
breathing = false
stamina = false
end
if IsControlJustPressed(0, 21) and breathing == true and staminaval ~= 0 then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueHoldBreath)
stamina = true
end
if stamina and staminaval >= 0 then
staminaval = staminaval -1
if staminaval == 0 then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal + Config.BreathingValueNoStamina)
DisableControlAction(0, 21, true)
AnimpostfxPlay("SwitchHUDIn", 0, false)
end
else
if staminaval < Config.Stamina then
staminaval = staminaval + 1
if IsControlJustPressed(0, 24) then
ShakeGameplayCam("HAND_SHAKE", Config.BreathingValueNormal + Config.BreathingValueNoStamina)
end
if staminaval > Config.StaminaTreshold then
AnimpostfxStopAll()
DisableControlAction(0, 21, false)
stamina = false
end
end
end
end
--[[FIRING MODES]]--
if Config.UseWeaponFiringMode then
if weaponShootingType == -957766203 or weaponShootingType == 970310034 then
if IsPedInAnyVehicle(playerPed, true) then
if IsControlJustPressed(0, Config.WeaponFiringModeKey) then
if Config.WeaponFiringMode[pedWeapon] == 1 then
Config.WeaponFiringMode[pedWeapon] = 0
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_auto)
else
notify(str_firing_mode_auto)
end
else
Config.WeaponFiringMode[pedWeapon] = 1
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_single)
else
notify(str_firing_mode_single)
end
end
end
if Config.WeaponFiringMode[pedWeapon] == 1 then
if IsPedDoingDriveby(playerPed) then
local _,pedWeapon = GetCurrentPedWeapon(playerPed)
local pedCamPitch = GetGameplayCamRelativePitch()
local weaponRecoil = Config.WeaponRecoil[pedWeapon]
local weaponShake = Config.WeaponShake[pedWeapon]
local recoilSpeed = Config.WeaponRecoilSpeed
local vehRecoilVal = Config.VehicleRecoilValue
local vehShakeVal = Config.VehicleShakeValue
while IsControlPressed(0, 24) or IsDisabledControlPressed(0, 24) do
Citizen.Wait(5)
DisablePlayerFiring(player, true)
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
if Config.VehicleRecoil then
SetGameplayCamRelativePitch(pedCamPitch + weaponRecoil + vehRecoilVal, recoilSpeed)
if Config.VehicleShake then
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", weaponShake + vehShakeVal)
end
end
end
end
end
else
if IsControlJustPressed(0, Config.WeaponFiringModeKey) then
if Config.WeaponFiringMode[pedWeapon] == 1 then
Config.WeaponFiringMode[pedWeapon] = 0
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_auto)
else
notify(str_firing_mode_auto)
end
else
Config.WeaponFiringMode[pedWeapon] = 1
if Config.UseBigNotify then
exports['b1g_notify']:Notify('true', str_firing_mode_single)
else
notify(str_firing_mode_single)
end
end
end
if Config.WeaponFiringMode[pedWeapon] == 1 then
if IsPedShooting(playerPed) then
while IsControlPressed(0, 24) or IsDisabledControlPressed(0, 24) do
Citizen.Wait(0)
DisablePlayerFiring(player, true)
if not Config.UseCrosshair then
HideHudComponentThisFrame(14)
end
end
end
end
end
end
end
end
end
else
hasWeapon = false
end
end
end)
Citizen.CreateThread(function()
while true do
Wait(0)
local playerPed = PlayerPedId()
if IsPedShooting(playerPed) then
local weapon = GetSelectedPedWeapon(playerPed)
if Config.rubberBulletWeapons[weapon] then
local hit, entity = GetEntityPlayerIsAimingAt()
if hit and IsEntityAPed(entity) and not IsPedAPlayer(entity) == false then
TriggerServerEvent('cavok_weapon_handling:hitPlayer', GetPlayerServerId(NetworkGetPlayerIndexFromPed(entity)))
end
end
end
end
end)
function GetEntityPlayerIsAimingAt()
local result, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
return result, entity
end
RegisterNetEvent('cavok_weapon_handling:makeRagdoll')
AddEventHandler('cavok_weapon_handling:makeRagdoll', function()
local ped = PlayerPedId()
local boneHit = 0
local success, bone = GetPedLastDamageBone(ped)
if success then
boneHit = bone
end
local racdollTime = 1000
for k, v in pairs(Config.RagdollTime) do
if boneHit == k then
racdollTime = v
end
end
SetPedToRagdoll(ped, racdollTime, racdollTime, 0, false, false, false)
end)

View file

@ -1,6 +1,6 @@
RegisterCommand("getweaponhash", function()
local playerPed = GetPlayerPed(-1)
local hasWeapon,pedWeapon = GetCurrentPedWeapon(playerPed)
print("Weapon Hash: " ..pedWeapon)
RegisterCommand("getweaponhash", function()
local playerPed = GetPlayerPed(-1)
local hasWeapon,pedWeapon = GetCurrentPedWeapon(playerPed)
print("Weapon Hash: " ..pedWeapon)
end)

View file

@ -3,24 +3,18 @@ games { 'gta5' }
lua54 'yes'
version '1.1.2'
escrow_ignore {
'config.lua',
'locales/*.lua',
'lua/client/*.lua'
}
shared_scripts {
'config.lua'
}
client_scripts {
'lua/client/client.lua',
'client.lua',
'locales/*.lua',
'lua/client/command.lua'
'client/command.lua'
}
server_scripts {
'lua/server/server.lua'
'server/server.lua'
}
dependency '/assetpacks'

View file

@ -1,4 +0,0 @@
RegisterNetEvent('cavok_weapon_handling:hitPlayer')
AddEventHandler('cavok_weapon_handling:hitPlayer', function(targetId)
TriggerClientEvent('cavok_weapon_handling:makeRagdoll', targetId)
end)

View 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)