mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
80
gamemodes/helix/plugins/autowalk.lua
Normal file
80
gamemodes/helix/plugins/autowalk.lua
Normal file
@@ -0,0 +1,80 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
local ix = ix
|
||||
local pairs = pairs
|
||||
|
||||
PLUGIN.name = "Autowalk"
|
||||
PLUGIN.author = "AleXXX_007"
|
||||
PLUGIN.description = "Permet aux joueurs d'activer la marche automatique."
|
||||
|
||||
ix.option.Add("enableAutoWalkBind", ix.type.bool, true, {
|
||||
bNetworked = true,
|
||||
category = "Général",
|
||||
})
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
optEnableAutoWalkBind = "Activer de marche automatique",
|
||||
optdEnableAutoWalkBind = "Activez la marche avant automatique en appuyant sur la touche 'n'.",
|
||||
})
|
||||
|
||||
ix.lang.AddTable("french", {
|
||||
optEnableAutoWalkBind = "Activer de marche automatique",
|
||||
optdEnableAutoWalkBind = "Activez la marche avant automatique en appuyant sur la touche 'n'.",
|
||||
})
|
||||
|
||||
PLUGIN.bind = KEY_N
|
||||
|
||||
local exitKeys = {
|
||||
IN_FORWARD,
|
||||
IN_BACK,
|
||||
IN_MOVELEFT,
|
||||
IN_MOVERIGHT
|
||||
}
|
||||
|
||||
function PLUGIN:GetOption(client)
|
||||
if (CLIENT) then
|
||||
return ix.option.Get("enableAutoWalkBind")
|
||||
else
|
||||
return ix.option.Get(client, "enableAutoWalkBind")
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:SetupMove(client, moveData, cmdData)
|
||||
if (!client.autowalk) then return end
|
||||
|
||||
if (ix.fights and client:GetFight()) then
|
||||
client.autowalk = nil
|
||||
return
|
||||
end
|
||||
|
||||
moveData:SetForwardSpeed(moveData:GetMaxSpeed())
|
||||
|
||||
for _, v in pairs(exitKeys) do
|
||||
if (cmdData:KeyDown(v)) then
|
||||
client.autowalk = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerButtonDown(client, button)
|
||||
if (!self:GetOption(client)) then
|
||||
client.autowalk = false
|
||||
return
|
||||
end
|
||||
local curTime = CurTime()
|
||||
|
||||
if (button == self.bind and (!client.nextBind or client.nextBind <= curTime)) then
|
||||
client.autowalk = !client.autowalk
|
||||
client.nextBind = curTime + 0.1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user