[Standalone] [Paid] Stungrenade/Flashbang

Stungrenade

Click here if the video above doesn’t work. (Youtube)

IMPORTANT NOTE: If you use an escrowed inventory that doesn’t support addon-throwing weapons then I can’t help you. It’s a problem with the inventory script, not with this script.

About

Stungrenade is a standalone stungrenade (flashbang) script that does just as its name says; adds stungrenades! The stungrenade is added in as an add-on weapon (with a weapon icon in the weapon wheel), that detonates after a configurable timer (1.5 seconds by default). Any person standing close and in direct sight of the stungrenade will then be flashed.

The model included is custom-made. The resmon varies between 0.0 and 0.03 ms at the most. (0.00 when you aren’t flashed nor have the stungrenade in your hand, 0.02 ms when the stungrenade is in your hand).

There are included inventory images with the script, however, you’ll have to add the stungrenade in as an item yourself. Here are two of the images as an example:

inventory_100x100_normalweapon_wheel

The script can be configured more or less however you want, and all of the code is accessible (note that the stungrenade model is escrowed, however, the texture is not), look below to see the config file.

Config.lua
Config = {}

-- This is the name that get's displayed in the weapons wheel ect. You can change this to "Flashbang" (or anything for that matter) if you want to.
-- Alternative names: "flash grenade", "flashbang", "thunderflash" or "sound bomb" (Yes I took these from wikipedia)
Config.WeaponName = "Stun Grenade"

Config.Timer = 1500 -- The time it takes for the stungrenade to detonates from it being thrown
Config.MaxDist = 30.0 -- The maximum distance (meters) the player can be from the stungrenade and still be effected by it

Config.MaxEffectTime = 15000 -- The max time in milliseconds that the effect will last
Config.ShowFlashEffect = true -- If true makes the screen white when flashed
Config.OnlyUseTimecycle = false -- If set to true, the script only uses timecycle effects to make the flash effects, if set to false, html will also be used along side a timecycle to make the flash effect.
Config.AllowEffectThroughGlass = true -- Makes the flash effect ignore glass materials when it does a raycast
Config.EffectCanBounce = true -- Allows the flash effect to bounce inside a room.

-- The particle effect that get's played when the stungrenade detonates
Config.Ptfx = { asset = "core", name = "exp_arc_stun_grenade" } -- Alternative: Config.Ptfx = { asset = "core", name = "exp_arc_grd_flashbang" }

Config.PlaySound = true -- Will play a ringing noise/sound
Config.Volume = 0.5 -- The volume the ringing will be played at.
Config.MaxVolume = 1.0 -- A safe guard to prevent 

Config.PlayAnim = false -- Plays the anim spesifed below. (Covers eyes)
Config.Anim = {
    dict = "anim@heists@ornate_bank@thermal_charge",
    name = "cover_eyes_loop"
}

Config.DisableShooting = false -- If true, shooting will be disabled while you are effected by the flash
Config.DisableAiming = false -- If true, aiming (a weapon) is disabled while ffected by the flash (should be used in combination with Config.DisableShooting)
Config.DisableWeaponWheel = true -- If true, the weapon wheel will be disabled while you are effected by the flash

Config.ApplyDamage = true -- If the stungrrenade should damage people who stand very close to it when it detonates. Note: even if you set this to false, you may still be damaged if Config.RagdollEnabled is set to true (fall damage)
Config.DamageArmourFirst = true
Config.MaxDamage = 15.0
Config.MaxDamageDist = 4.0

Config.HideMinimap = true -- Hides the minimap while blinded

Config.ApplyWalk = true -- Temporarily overwrites the players walkstyle to the one spesifed below, the walkstyle get's reverted back to the players's original one when the effect is over
Config.Walk = "move_m@hobo@a"

-- Mutes the game sounds (and voices if you use fivem's inbuild mumble) while flashed
Config.UseSubmix = true

-- The type of explision that is triggered
Config.ExplosionType = 0

Config.RagdollEnabled = true -- If the explosion should ragdoll players that stand really close to the grenade when it explodes
Config.MaxRagdollDist = 4.0 -- The maximum distance from the explosion you can be ragdolled

-- If true, npc's will be directyl effected by the stungrenade (ragdoll) (NOTE: they will flee regardless of what this is set to)
Config.EffectNPCs = true
Config.MaxNPCEffectRadius = 5.0 -- The maximum distance away from the blast the npc ped will be directly effected
Config.NPCEffectModifer = 2.5

Config.AllowVehicleTint = true -- If true, then window tint will reduce the flash effect
Config.TintReduction = { -- Reduce by %
    [-1] = false, -- Stock
    [0] = false,  -- None
    [1] = 50.0,   -- Pure Black
    [2] = 30.0,   -- Dark Smoke
    [3] = 10.0,   -- Light Smoke
    [4] = false,  -- Stock
    [5] = false,  -- Limo
    [6] = false   -- Green
}

-- These were made for the default clothes, you might want to go trough this list if you have custom hats and glasses (EUP for example) to ensure that they are appropriate.
Config.EyeProtectionEnabled = true -- If set to true, some hats and glasses will reduce the flash effect (in %)
Config.EyeProtection = {
    -- Hats / Helmets
    [0] = {
        [18] = 15.0,
        [38] = 20.0,
        [47] = 20.0,
        [50] = 35.0,
        [51] = 35.0,
        [52] = 35.0,
        [53] = 35.0,
        [62] = 20.0,
        [73] = 15.0,
        [78] = 15.0,
        [80] = 15.0,
        [82] = 15.0,
        [91] = 35.0,
        [111] = 35.0,
        [115] = 35.0,
        [123] = 15.0,
        [125] = 15.0,
        [144] = 17.5,
    },
    -- Glasses
    [1] = {
        [24] = 30.0,
        [25] = 30.0
    }
}

Config.EarProtectionEnabled = true -- If set to true, some hats will reduce the audio/ringing effect (in %)
Config.EarProtection = {
    [0] = {
        -- Hats/helmets (prop cat. 0)
        [0] = 100.0, -- Hearing Protection
        [15] = 10.0, -- Ear muffs
        [16] = 20.0,
        [17] = 20.0,
        [18] = 20.0,
        [19] = 100.0, -- Pilot Hearing Protection
        [38] = 20.0,
        [47] = 20.0,
        [48] = 20.0, -- Crosser Bike Helmet
        [49] = 20.0, -- Crosser Bike Helmet
        [50] = 20.0, -- Bike Helmet
        [51] = 20.0, -- Bike Helmet
        [52] = 20.0, -- Bike Helmet
        [53] = 20.0, -- Bike Helmet
        [62] = 20.0, -- Coloured Bike Helmet
        [67] = 20.0, -- Bike Helmet
        [68] = 20.0, -- Bike Helmet
        [69] = 20.0, -- Bike Helmet
        [70] = 20.0, -- Bike Helmet
        [71] = 20.0, -- Bike Helmet
        [72] = 20.0, -- Bike Helmet
        [73] = 20.0, -- Stunt Bike Helmet
        [74] = 20.0, -- Stunt Bike Helmet
        [75] = 20.0, -- Scooter Helmet
        [78] = 20.0, -- Stunt Bike Helmet
        [79] = 20.0, -- Stunt Bike Helmet
        [80] = 20.0, -- Bike Helmet
        [81] = 20.0, -- Bike Helmet
        [82] = 20.0, -- Bike Helmet
        [91] = 20.0, -- Bike Helmet
        [92] = 20.0, -- Bike Helmet
        [93] = 20.0, -- Bike Helmet
        [111] = 20.0, -- Coloured Pilot Helmet
        [115] = 40.0,
        [116] = 100.0,
        [117] = 100.0,
        [118] = 100.0,
        [119] = 100.0,
        [123] = 30.0,
        [124] = 30.0,
        [125] = 10.0,
        [126] = 10.0,
        [127] = 20.0, -- Bike Helmet
        [128] = 20.0, -- Bike Helmet
        [144] = 10.0,
        [150] = 100.0
    }
}

If you have any questions please leave a comment and I’ll answer them ASAP!

Purchase on Tebex

You can purchase it here through Tebex. (8.00 USD + tax)

Code is accessible Yes (model is escrowed)
Subscription-based No
Lines (approximately) 800
Requirements Game build 2060 or higher
Support Yes
12 Likes

Great job on this!

1 Like

Thanks a lot!

2 Likes

nice script!

1 Like

Looks pretty good :smiley:

1 Like

What’s the resmon on this?

The resmon varies between 0.0 and 0.03 ms at the most.

It’s 0.0 when idling (when you aren’t flashed and don’t have a stungrenade equipped), 0.02 ms when you have a stungrenade equipped (aka. in your hands) and up to 0.03 ms when you are flashed/affected by a stungrenade.

1 Like

Can you add in a config option for people that have sensitive eyes, so the screen turns black, that it checked with the licence’s

1 Like

Can I ask if the flash bomb is supported as an item

Is there a way to limit how many someone can get in their loadout? Say, 2 max that they can carry?

Good job.

1 Like

Yes, you could edit the ammo limit in the meta files (if you set AmmoMax, AmmoMax50, AmmoMax100, AmmoMaxMP, AmmoMax50MP and AmmoMax100MP to 2 in the weapons.meta file it will limit the ammo to 2).

1 Like

The script does not add it as an item, however, you can add it in by modifying the framework you use, it would essentially just be another weapon item. There are some inventory images included in the script.

I’ll add an option later today!

Thanks! (This also goes to the kind comments I haven’t directly answered!)

1 Like

Update 1.0.1

Added flash-sensitive mode making the screen go black instead of white, and using a blur (“hud_def_blur”) timecycle instead of a bright white blur (“BarryFadeOut”) timecycle. Anyone can enable this mode by simply doing /flashsensitive, the mode will save via kvp. To enable the feature simply download the new version of the script from the keymaster.

1 Like

Update 1.0.2

Added compatibility with ox_inventory, it does some weird things when it comes to equipping weapons that my script did not take into account. This issue should now be resolved, all you need to do is to download the newest update from the keymaster and set Config.OxInventory to true.

When I use ox_ Inventory takes out the stungrenade,the game will crash(Game crashed: Failed to call inflate() for streaming file compcache:/stungrenade/w_ex_stungrenade.ydr.),but I have set Config.OxInventory to true.

I don’t know why, this issue was resolved after restarting the server. This script is great! Thank you for your work

1 Like

Update 1.0.5

Small fix that hopefully solves issues for people who use inventories like lj-inventory etc. So if you’ve been experiencing issues then please download the script again, and then make sure that Config.UseGameEvent is set to false!