Skip to content

Commit

Permalink
added some things
Browse files Browse the repository at this point in the history
  • Loading branch information
L0stedMrlion committed May 14, 2024
1 parent abb33fc commit f1eadf4
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
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
35 changes: 35 additions & 0 deletions client/client.lua
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)
11 changes: 11 additions & 0 deletions config.lua
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},
}
19 changes: 19 additions & 0 deletions fxmanifest.lua
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/*"
}

0 comments on commit f1eadf4

Please sign in to comment.