-- LUA Script - precede every function and global member with lowercase name of script + '_main' function playerspeed_init(e) end local topSpeed = nil local tiredSpd = 0.3 local stamina = 100 function playerspeed_main(e) --- handle stamina --- if topSpeed == nil then topSpeed = GetGamePlayerControlTopspeed() end Prompt( math.modf( GetGamePlayerControlTopspeed() * 100 ) / 100 ) if g_KeyPressW == 1 and g_KeyPressSHIFT == 1 then stamina = stamina - 1 if stamina <= 0 then stamina = 0 SetGamePlayerControlTopspeed( tiredSpd ) end elseif stamina < 100 then stamina = stamina + 0.2 else SetGamePlayerControlTopspeed( topSpeed ) end Panel( 0, 8, 16, 28 ) TextColor( 1, 17, 1, "Stamina = " .. math.floor( stamina ), 160, 64, 0) end