GLUA - Jump Force Modifier (anti-bhop)

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üye
Katılım
22 Ara 2015
Mesajlar
7
Tepki puanı
0
Ödüller
7
10 HİZMET YILI
Here's a script that I've been working on, which introduces some gameplay enhancements to Garry's Mod servers. This script serves two main purposes: limiting bunnyhopping and creating a breathing sound effect for players who are "out of breath." Here are the details:

The main purpose of the script is to restrict bhopping. Bunnyhopping, while fun, can sometimes lead to unfair advantages in gameplay. To promote balanced gameplay and prevent bunnyhopping exploits. Script automatically limits the player's jump force after each jump. To add a touch of realism and immersion, this script creates a breathing sound effect when players are "out of breath." The sound is audible to nearby players, adding an element of suspense and creating a more immersive gaming experience.

Key Features:
  • Prevents players from excessively gaining speed through consecutive jumps.
  • Promotes tactical movement and strategy during combat and other game scenarios.
  • Produces a subtle breathing sound for players who have exhausted their stamina.

Lua:
-- CONFIG - START

-- how long should it take for the jump force to reset?
local jumpResetTime = 2

-- should the player hear a breathing sound when the jump force is low?
local playSound = true

-- the sound to play when the jump force is low, if playSound is false, this will be ignored
local breathingSound = Sound("breathing.wav")

-- CONFIG - END

-- variables to maintain the code, don't change if you don't know what you're doing
local jumpForce = 1
local lastJumpTime = 0
local hasPlayedBreathingSound = false

local function emitBreathing()
    if playSound then
        ply:EmitSound(breathingSound)
        hasPlayedBreathingSound = true
    end
end

local function stopBreathing()
    if playSound then
        ply:StopSound(breathingSound)
        hasPlayedBreathingSound = false
    end
end

hook.Add("KeyPress", "LowerJumpForce", function(ply, key)
    if key == IN_JUMP then
        local currentTime = CurTime()
        if currentTime - lastJumpTime > jumpResetTime then
            jumpForce = 1
            stopBreathing()
        else
            jumpForce = jumpForce - 0.15
            if jumpForce <= 0.25 then
                jumpForce = 0.25
                if not hasPlayedBreathingSound and not ply:IsPlayingTaunt() then
                    emitBreathing()
                end
            else
                stopBreathing()
            end
        end
        ply:SetJumpPower(jumpForce * 200)
        lastJumpTime = currentTime
    end
end)

Feel free to modify the script to better fit your server's gameplay requirements.
For any questions or feedback, please post them in the comments section below. I'll be happy to assist and make improvements based on your suggestions.
 
Make MG Great Again
Donator
Katılım
9 Eki 2020
Mesajlar
151
Tepki puanı
18
Ödüller
6
Yaş
43
5 HİZMET YILI
on the forum for cheaters, do you publish antibhop?!?
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst