Mads' Resource Documentation
  • 📺Youtube
  • 🤝Discord
  • ⭐Tebex
  • 👨‍💻GitHub
  • 👋Welcome!
  • General Info
    • ❓Questions and Answers
      • Is X script locked/encrypted?
      • I need support, where can I reach out?
      • How do I update my server artifacts?
      • How do I transfer a script from one account to another?
      • How do I set my game build?
    • ⚠️Common Problems
      • You lack the required entitlement
      • Failed to verify protected resource
      • Could not find dependency /assetpacks for resource
  • Resources
    • 🪑Sit Anywhere
      • Adding Custom Models
      • Falling Through the Map
      • Exports
      • Events
    • 🚁Helicopter Camera
      • Adding custom helicopters
      • Moving the UI above the minimap
      • Adding controller inputs
      • Controls
      • Exports
      • Events
    • 🚙Slash Tires
      • Exports
      • Events
    • 🕶️Stungrenade
      • Adding the Stungrenade as an item
      • Measures Against Cheaters
      • Exports
      • Events
    • 🪖CS Styled Killfeed
      • General Information
      • Exports - Client Side
      • Exports - Server Side
      • Examples
      • Adding Messages to the feed
      • Weapons List / Death Reasons
      • Changing the position if the killfeed
    • Crouch & Crawl
      • Exports
    • 🔫Taser Effect
    • 🔭Telescopes
    • 🩺Crutches
      • How to make the script compatible with ps-walkstyle
    • ⛽No Exploding Pumps
    • 👠Hookers
Powered by GitBook
On this page
  • Client
  • Examples
  • Server
  • Examples
  1. Resources
  2. Stungrenade

Events

Client

There are 3 client events intended to be used by external scripts, these are stungrenade:flashed, stungrenade:flashFading and stungrenade:fadedOut. stungrenade:flashed is triggered when a stungrenade flashes the player, it has 4 parameters, strength (0.0-1.0), duration (ms), position (vector3) and distance (meters). A few things to notice are that the strength is the strength added by this flash, not the total and that the duration is the time this flash will last (any new or older flashes might make it longer).

stungrenade:flashFading is triggered when the flash starts to fade out, this is when the weapon wheel is accessible again and when the minimap appears (if those configs are enabled). It has 2 parameters, strength (0.0-1.0) and duration (ms), these are the same as the parameters for stungrenade:flashed.

stungrenade:fadedOut is triggered when the flash has completely faded out, it has no parameters.

Examples

AddEventHandler('stungrenade:flashed', function(strength, duration, position, distance)
    print(string.format("Local player was flashed by a stungrenade at %s, at a distance of %s meters for %s milliseconds with strength %s", position, string.format("%.2f", distance), string.format("%.0f", duration), string.format("%.1f", strength)))
end)

AddEventHandler('stungrenade:flashFading', function(strength, duration)
    print(string.format("Local player flash is starting to fade, the player was flashed at strength %s for %s milliseconds", string.format("%.1f", strength), string.format("%.0f", duration)))
end)

AddEventHandler('stungrenade:fadedOut', function()
    print("Local player flash has completely faded out")
end)

Server

Examples

RegisterServerEvent('stungrenade:explosion', function(coords)
    print(string.format("A stungrenade explosion was fired at %s by player with server id %s", coords, source))
end)
PreviousExportsNextCS Styled Killfeed

Last updated 11 months ago

There is also 1 internal server event named stungrenade:explosion, it has one parameter coords, it is triggered by the client. For more information on its usage see .

🕶️
Measures Against Cheaters