02.11.2010, 05:41
(
Last edited by LarzI; 02/11/2010 at 10:27 AM.
)
Quote:
5 already, spammers! Wonder is someone can make like updating textdraw for distance ran like this kinda....
Code:
Distance Ran: ------------------------- | | | Orange for where your at now ------------------------- |
About your question: It should be pretty simple actually.
All you need is an updating timer (or OnPlayerUpdate) to get the player's distance to the point, then take the percent of that distance, and update the textdraw each percent (or each 5th percent, 10th etc..)
So let's say the distance is 100 yards (easiest example)
You run 10 yards, and that spot for where are you now moves one "spot" to the right.
You could use GetPlayerDistanceToPoint to make this work easily.
pawn Code:
stock Float:GetPlayerDistanceToPoint(playerid, Float:x, Float:y, Float:z)
{
new
Float:pX,
Float:pY,
Float:pZ;
GetPlayerPos(playerid, px, py, pz);
return floatsqroot(( floatpower( x-pX, 2 ) + floatpower( y-pY, 2 )) + floatpower( z-pZ, 2 ));
}
pawn Code:
new iPercent = (( floatround( GetPlayerDistanceToPoint( playerid, x, y, z )) / distance_to_destination ) * 100 );
pawn Code:
if( iPercent > 9 && iPercent < 20 )
{
//update
}
else if( iPercent > 19 && iPercent < 30 )
//continue