[CODE]if SERVER then
hook.Add("KeyPress","Sprint",function(ply,key)
if key != IN_FORWARD then return end
if ply.lastPress then
if ply.lastPress+0.5 > CurTime() then
chat.AddText(tostring(ply:GetNWBool("Sprinting")) .. "Double-tapped")
ply.lastPress = nil --end the 'timer' (it will start again when they press W next time)
if ply:KeyDown(IN_FORWARD) then
chat.AddText(tostring(ply:GetNWBool("Sprinting")) .. "Key Still down!")
ply:SetNWBool("Sprinting", true)
else
chat.AddText(tostring(ply:GetNWBool("Sprinting")) .. "No longer down!")
end
else
ply.lastPress = CurTime() --they didnt tap the second time fast enough so we reset the 'timer'
ply:SetNWBool("Sprinting", false)
chat.AddText("No longer down!")
end
else
ply.lastPress = CurTime() --start the tap 'timer'
end
end)
end[/CODE]
[CODE]function plymeta:SetSpeed(slowed)
local mul = hook.Call("TTTPlayerSpeed", GAMEMODE, self, slowed) or 1
if slowed then
self:SetWalkSpeed(120 * mul)
self:SetRunSpeed(120 * mul)
self:SetMaxSpeed(120 * mul)
else
if self:GetNWBool("Sprinting") then
if self:GetNWInt( "FStamina" ) <= 0 then
self:SetWalkSpeed(220 * mul)
self:SetRunSpeed(220 * mul)
self:SetMaxSpeed(220 * mul)
else
self:SetWalkSpeed(350 * mul)
self:SetRunSpeed(350 * mul)
self:SetMaxSpeed(350 * mul)
end
else
self:SetWalkSpeed(220 * mul)
self:SetRunSpeed(220 * mul)
self:SetMaxSpeed(220 * mul)
end
end
end[/CODE]
I'm hoping someone could tell me what I'm missing here. As far as I can tell ,the proper checks are there? However, it won't change my Speed :c
This is in TTT, just so you know. These are the only two changes I have for now. (I'm not getting any lua errors, however, I'm not sprinting either)
This's the stamina code from coderhire? 2 guys asked me to fix that before talk to the addon author...
It is not actually, It's something I'm writing myself.
Sorry, you need to Log In to post a reply to this thread.