I'm trying to implement TTT sprinting (sandbox style), so no stamina involved. I already have the buttons and everything working. The thing I need help with: The runspeed and maxspeed keep resetting every map change. So something is overwriting it as soon as it's loaded obviously. How do I prevent this from happening or how do I automatically re-load the player_ext.lua when the map changes so the speed is how I intended it?
One way I can get it to work is: I change the player_ext.lua and change it back. Then force upload it back into the server. Sprinting will then work. But after a map change it goes back to normal speed.
Thanks.
[CODE]
function plymeta:SetSpeed(slowed)
local mul = hook.Call("TTTPlayerSpeed", GAMEMODE, self, slowed) or 1
if slowed then
self:SetWalkSpeed(120 * mul) --default 120
self:SetRunSpeed(160 * mul) --default 120
self:SetMaxSpeed(160 * mul) --default 120
else
self:SetWalkSpeed(220 * mul) --default 220
self:SetRunSpeed(300 * mul) --default 220
self:SetMaxSpeed(300 * mul) --default 220
end
end
[/CODE]
There is a hook for this, no need to modify the gamemodes files.
[url]http://ttt.badking.net/guides/hooks[/url]
[quote]
TTTPlayerSpeed (ply, slowed)
Server
Called when a player's ("ply") walking speed is computed. The "slowed" parameter indicates if they are using ironsights. The value returned by this hook is used as a multiplier of the default speeds, so returning 1.5 will let all players move 50% faster. Note that maps may not expect players to be faster.
[/quote]
Ah... Awesome. Could you refresh my memory and tell me how to use that? I forgot...
EDIT: doesn't that change the overall walking speed? I'd like sprinting AND walking (hold shift to sprint)
[QUOTE=Sonichum;45808696]Ah... Awesome. Could you refresh my memory and tell me how to use that? I forgot...
EDIT: doesn't that change the overall walking speed? I'd like sprinting AND walking (hold shift to sprint)[/QUOTE]
Isn't shift traitor chat (voice)
It was. I moved the button. I said everything works properly, the only problem is that the values keep resetting to default, even though they're different in the code.
I think actually I might've fixed it myself. It might've been caused by Spectator DeathMatch or TTT events
EDIT: Yup that was it. So stupid I found it out the same day as I posted this
Sorry, you need to Log In to post a reply to this thread.