player:isRunning

This function (player:isRunning) does not seem to be returning propperly or not at all, though I have no errors coming off of it. Has an update made this break / changed it? if so how would I fix it?

Because IsRunning() is not valid.

Just do
[lua]if ( input.IsKeyDown( IN_RUN ) ) then

--stuff

end[/lua]

I believe input.IsKeyDown on works with KEY_* enums – IN_* should be used with **[Player.KeyDown

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.KeyDown)**.

You could always do a velocity check coupled with a IsOnGround check.

[lua]
local MPlayer = FindMetaTable(“Player”)

function MPlayer:IsRunning()
if ( self:KeyDown( IN_RUN ) ) then
return true
end
end
[/lua]

Something like that.

this could be useful to me, so I just use pl:IsRunning?

Yes
[lua]
function Running(ply)
if ply:IsRunning() then
ply:Kill()
end
end
concommand.Add(“IsPlayerRunning”, Running)
[/lua]

You can do other ways too like in a

[lua]
Hook.Add(“Think”, “IrRunning”, function()
for k,v in pairs(player.GetAll()) do
if v:IsRunning() then
v:Kill() – kills the player running
end
end
end)
[/lua]

Hope that helps. :wink:

Or just more simply…

[lua]function _R.Player:IsRunning() return self:KeyDown(IN_RUN) end[/lua]

You should make sure to return false if they aren’t running. Although in Lua nil is evaluated as false in expressions, it’s good practice.

Is there any way to create a function this one, for any variable before the :isPlayer?

[lua]local MPlayer = FindMetaTable(“Player”)

function MPlayer:IsRunning()
if ( self:KeyDown( IN_RUN ) ) then
return true
end
end [/lua]

That does it.

[lua]for k,v in pairs(player.GetAll()) do
if v:ISRunning() then v:Kick(“No running!”)
end
[/lua]

Do this instead:
ply:KeyDown( IN_RUN ) and ply:GetVelocity():Length() > 300 and ply:OnGround()

you might want to adjust the values, th

hmm this may not be my problem then… The stamina mount I have for my nexus game mode is not working but I can not figure out what is causing it, I thought it was this but maybe not, is there another solution I could try?

IN_RUN isnt valid, its IN_SPEED

SHARED | 0000000000004096 | 00000000000001000000000000 | RUN

How strange… Never the less, sprinting is IN_SPEED.

It’s the same.

Use IN_SPEED, probably some moron put IN_RUN on the wiki without knowing what he was doing