Castillo Posted May 17, 2011 Posted May 17, 2011 Do you mean like Stamina? if so, i don't think there's a way to disable that, maybe make an script?
Kenix Posted May 17, 2011 Author Posted May 17, 2011 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.
MX_Master Posted May 17, 2011 Posted May 17, 2011 setPedStat(source,22,0) can't help i think (: may be 'onPlayerSpawn'?
Kenix Posted May 17, 2011 Author Posted May 17, 2011 setPedStat(source,22,0) can't help i think (: may be 'onPlayerSpawn'? still infinite run
karlis Posted May 17, 2011 Posted May 17, 2011 i guess you could just disable sprint button for few secs after it is held for longer then X ammount of seconds.
Try Posted May 17, 2011 Posted May 17, 2011 Try this: function stats() setPedStat(source,22,999) setTimer(stats,2000,1) end addEventHandler("onPlayerJoin",getRootElement(),stats) Omg Im crazy i started help all
Castillo Posted May 18, 2011 Posted May 18, 2011 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).
karlis Posted May 18, 2011 Posted May 18, 2011 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now