SA-MP Forums Archive
Is this possible? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is this possible? (/showthread.php?tid=441974)



Is this possible? - Don_Cage - 05.06.2013

Well, My question is if it is possible to detect the stamina for example running and swimming like in single player?
So if you got low stamina and havent trained it you can't run fast as long as someone who have trained his stamina. Is this possible?


Re: Is this possible? - Kitten - 05.06.2013

No not yet x) Hopefully for the next SA:MP update.


Re: Is this possible? - Don_Cage - 05.06.2013

Aight, Would be cool though!


Re: Is this possible? - CrazyChoco - 05.06.2013

You could try with some other functions.

Quote:

stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
return floatround(ST[3]);
}

-Credits MB


Re: Is this possible? - Don_Cage - 05.06.2013

Quote:
Originally Posted by CrazyChoco
Посмотреть сообщение
You could try with some other functions.

-Credits MB
Thanks but I was just wondering


Re: Is this possible? - RajatPawar - 05.06.2013

You could use the above given stock to get the speed on a regular basis, save it somewhere, check using gettickcount the time passed and set your own stamina allowance. If it exceeds a particular value for some (max sprint allow time), set the velocity to (player - velocity) - 1 or 0!