Race Progress
#1

How do I calculate the percentage of player progress in a race? I tried with TotalCP - 1, but it does not work properly ._.

PHP код:
forward Float:GetCPPercentage(playerid);
public 
Float:GetCPPercentage(playerid)
{
    if(
CPProgress[playerid] != 0)
    {
        new 
Float:Dist;
        
Dist = ((GetPlayerDistanceFromPoint(playeridCPCoords[TotalCP 1][0], CPCoords[TotalCP 1][1], CPCoords[TotalCP 1][2]) * 100.0) / DistAllCP);
        
CPPercentage[playerid] = 100.0 Dist;
    }
    return 
CPPercentage[playerid];

PHP код:
for(new 0!= TotalCPi++)
{    
    if(
!= TotalCP 1DistAllCP DistAllCP GetDistance(CPCoords[i][0], CPCoords[i][1], CPCoords[i][2], CPCoords[1][0], CPCoords[1][1], CPCoords[1][2]);

PHP код:
#define     GetDistance(%1,%2,%3,%4,%5,%6)     floatsqroot((%1-%4)*(%1-%4) + (%2-%5)*(%2-%5) + (%3-%6)*(%3-%6)) 
Reply


Messages In This Thread
Race Progress - by GSFBart - 25.06.2017, 20:11
Re: Race Progress - by GSFBart - 26.06.2017, 15:38
Re: Race Progress - by Jefff - 26.06.2017, 23:36
Re: Race Progress - by GSFBart - 01.07.2017, 13:26

Forum Jump:


Users browsing this thread: 2 Guest(s)