-- Simple realistic recoil script
-- made for fivem standalone / esx / qb
local recoil = {
["WEAPON_PISTOL"] = {up = 0.15, side = 0.02},
["WEAPON_COMBATPISTOL"] = {up = 0.18, side = 0.03},
["WEAPON_PISTOL_MK2"] = {up = 0.22, side = 0.025},
["WEAPON_SNSPISTOL"] = {up = 0.14, side = 0.02},
["WEAPON_HEAVYPISTOL"] = {up = 0.28, side = 0.04},
["WEAPON_MICROSMG"] = {up = 0.3, side = 0.05},
["WEAPON_SMG"] = {up = 0.35, side = 0.06},
["WEAPON_ASSAULTRIFLE"] = {up = 0.5, side = 0.07},
["WEAPON_CARBINERIFLE"] = {up = 0.45, side = 0.06},
["WEAPON_COMPACTRIFLE"] = {up = 0.55, side = 0.065},
["WEAPON_PUMPSHOTGUN"] = {up = 0.4, side = 0.03},
["WEAPON_SAWNOFFSHOTGUN"] = {up = 0.48, side = 0.04},
}
local function doRecoil(weapon)
local ped = PlayerPedId()
local camPitch = GetGameplayCamRelativePitch()
local camHead = GetGameplayCamRelativeHeading()
local data = recoil[weapon]
if not data then return end
local up = data.up + math.random(-5,5)/100.0
local side = data.side * (math.random(-100,100)/100.0)
SetGameplayCamRelativePitch(camPitch - up * 100.0, 0.2)
SetGameplayCamRelativeHeading(camHead + side * 100.0)
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", 0.02)
end
CreateThread(function()
while true do
local ped = PlayerPedId()
if IsPedArmed(ped, 6) then
if IsPedShooting(ped) then
local wep = GetSelectedPedWeapon(ped)
doRecoil(wep)
end
end
Wait(0)
end
end)
zal deze werken deze heb ik gekregen van mn vriend en wat moet ik doen om het meer realistic te maken[/weapon]
-- made for fivem standalone / esx / qb
local recoil = {
["WEAPON_PISTOL"] = {up = 0.15, side = 0.02},
["WEAPON_COMBATPISTOL"] = {up = 0.18, side = 0.03},
["WEAPON_PISTOL_MK2"] = {up = 0.22, side = 0.025},
["WEAPON_SNSPISTOL"] = {up = 0.14, side = 0.02},
["WEAPON_HEAVYPISTOL"] = {up = 0.28, side = 0.04},
["WEAPON_MICROSMG"] = {up = 0.3, side = 0.05},
["WEAPON_SMG"] = {up = 0.35, side = 0.06},
["WEAPON_ASSAULTRIFLE"] = {up = 0.5, side = 0.07},
["WEAPON_CARBINERIFLE"] = {up = 0.45, side = 0.06},
["WEAPON_COMPACTRIFLE"] = {up = 0.55, side = 0.065},
["WEAPON_PUMPSHOTGUN"] = {up = 0.4, side = 0.03},
["WEAPON_SAWNOFFSHOTGUN"] = {up = 0.48, side = 0.04},
}
local function doRecoil(weapon)
local ped = PlayerPedId()
local camPitch = GetGameplayCamRelativePitch()
local camHead = GetGameplayCamRelativeHeading()
local data = recoil[weapon]
if not data then return end
local up = data.up + math.random(-5,5)/100.0
local side = data.side * (math.random(-100,100)/100.0)
SetGameplayCamRelativePitch(camPitch - up * 100.0, 0.2)
SetGameplayCamRelativeHeading(camHead + side * 100.0)
ShakeGameplayCam("SMALL_EXPLOSION_SHAKE", 0.02)
end
CreateThread(function()
while true do
local ped = PlayerPedId()
if IsPedArmed(ped, 6) then
if IsPedShooting(ped) then
local wep = GetSelectedPedWeapon(ped)
doRecoil(wep)
end
end
Wait(0)
end
end)
zal deze werken deze heb ik gekregen van mn vriend en wat moet ik doen om het meer realistic te maken[/weapon]
Reactions are only available for posts