I just basically want a script were when you hold down space you will constantly jump, eg as soon as you hit the ground you jump back up and so forth. Basically like a css bhoping script, thanks :D
[lua]
BHopSpeed = 0
function BHop(ucmd)
if (LocalPlayer and not(ShouldBHop:GetInt() == 0)) then
if LocalPlayer():OnGround() then
ucmd:SetButtons(ucmd:GetButtons() | IN_JUMP)
end
end
end
hook.Add("CreateMove" , "BHop", BHop)
ShouldBHop = CreateClientConVar("bunnyhop", 0, true, false)
concommand.Add("+bunnyhop" , function()
RunConsoleCommand("bunnyhop" , 1)
end)
concommand.Add("-bunnyhop" , function()
RunConsoleCommand("bunnyhop" , 0)
end)
[/lua]
Somewhat stolen from FapHack.
[lua]
concommand.Add("+c_bhop", function() Start = true end)
concommand.Add("-c_bhop", function() Start = false end)
hook.Add("Think", "bunnyhopz", function()
if Start then
if (LocalPlayer():IsOnGround()) then
RunConsoleCommand("+jump")
timer.Simple(.1, function() RunConsoleCommand("-jump") end)
end
end
end)[/lua]
[QUOTE=c-unit;26496785][lua]
concommand.Add("+c_bhop", function() Start = true end)
concommand.Add("-c_bhop", function() Start = false end)
hook.Add("Think", "bunnyhopz", function()
if Start then
if (LocalPlayer():IsOnGround()) then
RunConsoleCommand("+jump")
timer.Simple(.1, function() RunConsoleCommand("-jump") end)
end
end
end)[/lua][/QUOTE]
Wouldn't you need to bind +c_bhop to spacebar then?
yeah, that's just what I ues lol.
[editline]4th December 2010[/editline]
Use PortalGods
[lua]local BhopToggle = CreateClientConVar("bhop_enable", 0, true, false)
concommand.Add("+bhop", function()
hook.Add("Tick", "BunnyHop", function()
if not LocalPlayer():IsOnGround() then
RunConsoleCommand("-jump")
elseif LocalPlayer():IsOnGround() then
RunConsoleCommand("+jump")
end
end)
end)
concommand.Add("-bhop", function()
hook.Remove("Tick", "BunnyHop")
RunConsoleCommand("-jump")
end)[/lua]
that's dumb.
[QUOTE=.Kaleb;26515617][lua]local BhopToggle = CreateClientConVar("bhop_enable", 0, true, false)
concommand.Add("+bhop", function()
hook.Add("Tick", "BunnyHop", function()
if not LocalPlayer():IsOnGround() then
RunConsoleCommand("-jump")
elseif LocalPlayer():IsOnGround() then
RunConsoleCommand("+jump")
end
end)
end)
concommand.Add("-bhop", function()
hook.Remove("Tick", "BunnyHop")
RunConsoleCommand("-jump")
end)[/lua][/QUOTE]
Um, why would you create and remove a hook every time you do the + command? It doesn't make sense.
^
[lua]local bhop = false
hook.Add("Think", "Bunnyhop", function()
if bhop then
if (input.IsKeyDown( KEY_SPACE ) ) then
if LocalPlayer():IsOnGround() then
RunConsoleCommand("+jump")
HasJumped = 1
else
RunConsoleCommand("-jump")
HasJumped = 0
end
elseif bhop and LocalPlayer():IsOnGround() then
if HasJumped == 1 then
RunConsoleCommand("-jump")
HasJumped = 0
end
end
end
end)
concommand.Add("BhopToggle", function()
if bhop then
bhop = !bhop
LocalPlayer():ChatPrint("Bhop Disabled")
else
bhop = !bhop
LocalPlayer():ChatPrint("Bhop Enabled")
end
end)[/lua]
the reason I did what I did is because I've noticed that when using input.IsKeyDown makes it so that if yo are falling or something then it spams -jump, sass kicked me using that method :(
[QUOTE=c-unit;26579468]the reason I did what I did is because I've noticed that when using input.IsKeyDown makes it so that if yo are falling or something then it spams -jump, sass kicked me using that method :([/QUOTE]
It has nothing to do with input.IsKeyDown. It has to do with having a check to see if you are on the ground, which my script does.
[QUOTE=jeff223;26584872]It has nothing to do with input.IsKeyDown. It has to do with having a check to see if you are on the ground, which my script does.[/QUOTE]
-_- thats not what i mean.
Maybe tell me what you mean?
[QUOTE=jeff223;26595168]Maybe tell me what you mean?[/QUOTE]
Like if I don't use the timer then I end up getting spammed with -jump when im falling or jumping off tall things. so when i added the timer to just run -jump once that fixed it
C-Unit, his code has a variable so that -jump is only ran once. Either way, I don't see why we need more code when mine works fine.
Why is everyone fighting geez grow up, we don't need tuns of code you don't need to fight 1 is just enough if it's wrong then correct it.
[QUOTE=PortalGod;26600637]C-Unit, his code has a variable so that -jump is only ran once. Either way, I don't see why we need more code when mine works fine.[/QUOTE]
Oh. I see now.
[QUOTE=Fisheater;26517648]Um, why would you create and remove a hook every time you do the + command? It doesn't make sense.[/QUOTE]
Yes it does; It was just an example.
Sorry, you need to Log In to post a reply to this thread.