View Single Post
Old 02/11/2010, 05:41 AM   #3
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Script Request Thread #5

Quote:
Originally Posted by willsuckformoney View Post
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
-------------------------
5 topics in 2-3 years isn't too bad...

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 ));
}

Just get the percent of the distance.

pawn Code:
new iPercent = (( floatround( GetPlayerDistanceToPoint( playerid, x, y, z )) / distance_to_destination ) * 100 );

Then do as I said, update it every percent, every 5th percent, every 10th percent... Anything that will fit you well.

pawn Code:
if( iPercent > 9 && iPercent < 20 )
{
    //update
}
else if( iPercent > 19 && iPercent < 30 )
//continue
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________



Last edited by LarzI; 02/11/2010 at 10:27 AM.
LarzI is offline