Is there a posible way to add [B]speed[/B] to the player?
[CODE]
local isNoclip = false
local wasAuto = false
hook.Add("Think", "BHOP_AutoJump", function()
if(GetConVar("sbox_noclip"):GetInt() == 0) then
isNoclip = false
end
if(input.IsKeyDown(KEY_SPACE) && !LocalPlayer():IsTyping() && isNoclip == false) then
if(LocalPlayer():IsOnGround()) then
RunConsoleCommand("+jump")
else
RunConsoleCommand("-jump")
end
end
end)
hook.Add("PlayerNoClip", "BHOP_CheckNoclip", function(ply, is)
print(is)
if(ply == LocalPlayer()) then
isNoclip = is
end
print("i: "..tostring(isNoclip))
end)
[/CODE]
I'd like to do when the player touchs the ground it gets a bit of speed.
I've tryed [B]SetWalkSpeed [/B]and [B]SetRunSpeed [/B]but don't works.
[I](Sorry about the bad english)[/I]
[QUOTE=Coffeee;50424112][URL="https://wiki.garrysmod.com/page/Entity/SetVelocity"]Entity:SetVelocity[/URL][/QUOTE]
Did not work.
if(LocalPlayer():IsOnGround()) then
print("OnGroud!")
LocalPlayer():SetVelocity( Vector( 500, 0, 0 ) )
RunConsoleCommand("+jump")
else
print("Not OnGroud!")
RunConsoleCommand("-jump")
end
I tested it and did not work. :\
Because you're running it clientside
That won't give them speed in the right direction either
[QUOTE=Coffeee;50424504]Because you're running it clientside
That won't give them speed in the right direction either[/QUOTE]
So I need to make the script run in server side to work?
You need to use [URL="http://wiki.garrysmod.com/page/CUserCmd/SetForwardMove"]CUserCmd:SetForwardMove[/URL].
Also use [URL="http://wiki.garrysmod.com/page/CUserCmd/KeyDown"]CUserCmd:KeyDown[/URL] and [URL="http://wiki.garrysmod.com/page/CUserCmd/RemoveKey"]CUserCmd:RemoveKey[/URL] to bhop instead of using input.IsKeyDown and RunConsoleCommand.
Sorry, you need to Log In to post a reply to this thread.