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