I've been trying to lower the run and walk speed for my server for the past 4 hours, but no success. I have tried a hook conflict finder, decompiling all my addons for my server and checking for any function in there that might mess with something. I've looked in all my lua files in my server and nothing. I have tried setting the speed in jobs, in the config for DarkRP, still nothing. I tried this code:
function playerSetSpeed(ply)
timer.Simple(4, function()
print("speed changed")
if ply:IsValid() then
if ply:GetRunSpeed() > 200 then
ply:SetRunSpeed( 200 )
end
if ply:GetWalkSpeed() > 130 then
ply:SetWalkSpeed( 130 )
end
end
GAMEMODE:SetPlayerSpeed(ply, 130, 200)
ply:SetWalkSpeed( 130 )
ply:SetRunSpeed( 200 )
end)
end
hook.Add( "PlayerSpawn", "playerSetSpeedtest", playerSetSpeed )
--[[
if pl:GetRunSpeed() > 200 then
pl:SetRunSpeed(200)
end
if pl:GetWalkSpeed() > 130 then
pl:SetWalkSpeed(130)
end
--]]
and still nothing.
My walk is hard locked for some reason to 150 and sprint is locked to 300. The only time this value ever changes if a certain weapon is being held or if a player has an active entity on them (in my case a type of juggernaut entity)
I honestly cannot find the issue, unless I'm missing some sort of fucked up base function or an addon on my server is causing it (which I can't see as I have been searching the functions for ages in server and shared lua files)
Use Notepad++ or Sublime "find in files" function to search all of your addons/gamemode files at once.
Look for "SetWalkSpeed" and "SetPlayerSpeed"
ps. Use IsValid( obj ) not obj:IsValid() :P
obj:IsValid() is fine if the object is guaranteed to be an entity, which it is in this case.
Ahh. Found it. Thanks for the tip for looking for some Think functions mate. Solved the problem.
Cheers.
Sorry, you need to Log In to post a reply to this thread.