Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Race Progress

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

PHP Code:

function 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 Code:

Loop(iTotalCP)
{    
    if(
!= TotalCP 1DistAllCP DistAllCP GetDistance(CPCoords[i][0], CPCoords[i][1], CPCoords[i][2], CPCoords[1][0], CPCoords[1][1], CPCoords[1][2]);


PHP Code:

#define     GetDistance(%1,%2,%3,%4,%5,%6)     floatsqroot((%1-%4)*(%1-%4) + (%2-%5)*(%2-%5) + (%3-%6)*(%3-%6)) 


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>