PandaScriptZ | Knockout
Hello!
This knockout system gives your players the ability to attack people to make them unconscious. They can use an item that is followed by a synced attack animation that causes the victim to collapse and be unconscious for a specified time.
Features:
- Use multiple animations (randomly selected)
- Synced animations for attacker and victim
- Props bound to the attacking player during the animation
- Playing sounds while knocked out (Optional feature using interact sound)
- Camera effect after being knocked out (Possible to turn off in the config)
- Cooldown between attacks (editable in the config)
- Config to also knockout players when fighting (f.e Boxing)
- Running on 0.00 ms in idle and active
- Easily change the notification system
Config
Config = {}
Config.item = 'syringe' -- Which item is needed for usage
Config.interactRange = 2 -- What is the maximum distance to knock out a person
Config.knockoutTime = 5 -- How long the player should be knocked out | Time in seconds
Config.AnimsDict = 'melee@small_wpn@streamed_core' -- All anims need to be from the same dict!
Config.Anims = {
{attacker = 'plyr_stealth_kill', victim = 'victim_stealth_kill'},
{...}
}
Config.UseInteractsound = true -- set to true if using interact sound and want to have a sound playing during knockout
Config.Soundfile = 'heartbeatsound' -- The name of your sound file inside Interact-Sound
Config.Cooldown = true -- Should the player get a cooldown on usage
Config.CooldownTime = 1 -- Time until being able to knock out again | Time in minutes
Config.effectAfterKO = true -- Show visual effect after being Knockedout
Config.effectAfterKOTime = 30 -- Time in seconds
Config.KnockoutOnPunch = true -- If you want to enable the option that players are being knocked out when they get punched below a certain health threshold
Config.KnockoutOnPunchHealth = 40 -- The health threshold that players get knocked out when they get punched below this threshold (Value between 0 and 100 (0 NOT RECOMMENDED, may cause problems with ambulance job))
Config.KnockoutWeapons = {'WEAPON_UNARMED', 'WEAPON_KNUCKLE', 'WEAPON_NIGHTSTICK'} -- You can add any weapon hash here that should be able to knock out players.
Config.Messages = {
['no_player'] = 'There is no person near you',
['used_item'] = 'You used your syringe to knock out a person',
['got_ko'] = 'You have been knocked out by another person',
['recovered'] = 'You recovered from your knockout',
-- If cooldown enabled --
['on_cooldown'] = 'You need to wait until you can knock out again',
}
-- change the below functions to your notification system
-- Current example using standard ESX
function ShowInfoNotification(message)
ESX.ShowNotification("~y~"..message)
end
function ShowErrorNotification(message)
ESX.ShowNotification("~r~"..message)
end
function ShowSuccessNotification(message)
ESX.ShowNotification("~g~"..message)
end```
Preview
Packages
Plans for future updates:
- Option for item usage (Either use item or use option on proximity)
- Adapt for QB-Core (maybe also standalone)
- Option for choosing between different effects
- Ability to defend yourself from an attack (QuickTime event)
|-------------------------------------|----------------------------|
| Code is accessible | Yes (if opensource version)
| Subscription-based | No
| Lines (approximately) | ~ 230 Lines
| Requirements | ESX, interact-sound (optional)
| Support | No, unmaintained


