How Do I Use This

Posts 1–2 of 2 · Page 1 of 1
How Do I Use This
I have this code which is a Auto strafe for gmod but I don't know how to use it... Can anyone help me?

local rdm = {};
local FW = true;
local BW = false;
local NONE = nil;

function rdm.AddHook(hk, name, fn)
hook.Add(hk, name, fn);
end

local function FWorBW(vel, ang)
local a = vel;
a:Rotate(-ang)
if(a.x > 0) then
return FW;
elseif(a.x < 0) then
return BW;
end
return NONE
end

local cd = 6;
local ccd = 0;
local lastc = 0;
local lp = LocalPlayer();

rdm.AddHook("CreateMove", "BHop", function(cmd)
if (cmd:KeyDown(IN_JUMP)) then
local mul = FWorBW(lp:GetVelocity(), lp:EyeAngles()) == BW and -1 or 1;
if(cmd:GetMouseX() < 0) then
cmd:SetSideMove(-10000 * mul);
ccd = -cd;
elseif(cmd:GetMouseX() > 0) then
cmd:SetSideMove(10000 * mul);
ccd = cd;
elseif(ccd < 0) then
cmd:SetSideMove(-10000 * mul);
ccd = ccd + 1;
elseif(ccd > 0) then
cmd:SetSideMove(10000 * mul);
ccd = ccd - 1;
end
if (lp:IsOnGround() and cmd:CommandNumber() ~= lastc + 1) then
cmd:SetButtons(bit.bor(cmd:GetButtons(), IN_JUMP));
if(cmd:CommandNumber() ~= 0) then lastc = cmd:CommandNumber(); end
return;
end
end
cmd:RemoveKey(IN_JUMP);
end);
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us