-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abb33fc
commit f1eadf4
Showing
4 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# lion_recoil | ||
🔫 Lightweight FiveM script for recoil and weapon damage | ||
# 🦁 Lion Recoil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local weapons = Config.Weapons | ||
|
||
local function applyRecoil(ped, weapon) | ||
local tv = 0 | ||
local startTime = GetGameTimer() | ||
while tv < weapons[weapon].recoil do | ||
Citizen.Wait(0) | ||
local p = GetGameplayCamRelativePitch() | ||
if GetFollowPedCamViewMode() ~= 4 then | ||
SetGameplayCamRelativePitch(p + 0.1, 0.2) | ||
end | ||
tv = (GetGameTimer() - startTime) / 1000 | ||
end | ||
end | ||
|
||
Citizen.CreateThread(function() | ||
while true do | ||
Citizen.Wait(0) | ||
local ped = PlayerPedId() | ||
local weapon = GetSelectedPedWeapon(ped) | ||
|
||
if IsPedShooting(ped) then | ||
if weapons[weapon] then | ||
ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', weapons[weapon].shake) | ||
if weapons[weapon].recoil ~= 0 and not IsPedDoingDriveby(ped) then | ||
applyRecoil(ped, weapon) | ||
end | ||
end | ||
end | ||
|
||
if Config.DisableCrosshair and IsPedArmed(ped, 6) then | ||
HideHudComponentThisFrame(14) | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Config = {} | ||
Config.DisableCrosshair = false | ||
Config.Weapons = { | ||
[GetHashKey('WEAPON_COMBATPISTOL')] = {recoil = 0.0, shake = 0.08, damage = 0.45}, | ||
[GetHashKey('WEAPON_STUNGUN')] = {recoil = 0.0, shake = 0.0, damage = 0.0}, | ||
[GetHashKey('WEAPON_M6IC')] = {recoil = 0.0, shake = 0.055, damage = 0.65}, | ||
[GetHashKey('WEAPON_FM1_M16A4')] = {recoil = 0.0, shake = 0.01, damage = 0.6}, | ||
[GetHashKey('WEAPON_PUMPSHOTGUN')] = {recoil = 0.2, shake = 0.07, damage = 1.0}, | ||
[GetHashKey('WEAPON_SMG')] = {recoil = 0.0, shake = 0.045, damage = 0.6}, | ||
[GetHashKey('WEAPON_SMG_MK2')] = {recoil = 0.0, shake = 0.055, damage = 0.6}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
fx_version 'cerulean' | ||
game 'gta5' | ||
lua54 "true" | ||
|
||
author "Mrlion" | ||
version "1.0" | ||
|
||
shared_scripts { | ||
"config.lua", | ||
"@ox_lib/init.lua" | ||
} | ||
|
||
client_scripts { | ||
"client/*" | ||
} | ||
|
||
server_scripts { | ||
"server/*" | ||
} |