Jump to content

how disable infinite run?


Kenix

Recommended Posts

Do you mean like Stamina? if so, i don't think there's a way to disable that, maybe make an script?

yes i mean Stamina.

  
addEventHandler("onPlayerJoin", root, 
function( ) 
   setPedStat(source,22,999) -- and 0 , 999 still a player runs indefinitely. 
end 
) 
  

I'm not sure this code please help who knows.

Link to comment

I don't think MTA has this included, i think the Stamina won't affect anything, i would use Karlis idea.

stamina = 100 
  
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), 
function () 
stamina = 100 
setTimer(checkKey,700,0) 
setTimer(updateStamina,1000,0) 
end) 
  
function checkKey() 
if ( getControlState ( "sprint" ) ) and stamina ~= 0 then 
stamina = stamina -1 
end 
if ( stamina == 0 ) then 
setControlState( "sprint", false ) 
  end 
end 
  
function updateStamina() 
if stamina ~= 100 and getControlState ( "sprint" ) == false then 
stamina = stamina +1 
  end 
end 

Works (tested).

Link to comment
I don't think MTA has this included, i think the Stamina won't affect anything, i would use Karlis idea.
stamina = 100 
  
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), 
function () 
stamina = 100 
setTimer(checkKey,700,0) 
setTimer(updateStamina,1000,0) 
end) 
  
function checkKey() 
if ( getControlState ( "sprint" ) ) and stamina ~= 0 then 
stamina = stamina -1 
end 
if ( stamina == 0 ) then 
setControlState( "sprint", false ) 
  end 
end 
  
function updateStamina() 
if stamina ~= 100 and getControlState ( "sprint" ) == false then 
stamina = stamina +1 
  end 
end 

Works (tested).

yep, thats exactly what i was going to write today(had to go yesterday)...i guess no more need

EDIT:i don't see a way that the button is enabled again?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...