SA-MP Forums Archive
Beating race best record problem. - 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: Beating race best record problem. (/showthread.php?tid=371107)



Beating race best record problem. - Edvin - 22.08.2012

Hi guys

I creating my own race system for my server. I made a mini-system for best racer, and best race time. When a player beats the old record with 3-4 minutes faster, the message what need to be showed to all people, aren't showing.

Here is my code:
pawn Код:
if ( p_Position[ r_IDEx ] < 2 )
            {
                new
                    r_TotalResult[ MAX_RACES ]
                ;
                if ( R_DATA[ r_IDEx ][ r_BestRacerTime_0 ] > rTime[ 0 ] )
                {
                    print( "minute" );
                    format( gsString, sizeof gsString, "RACE: {FFFF00}%s has broken the old record '%d:%d:%d' in '%s' race with %d minute(s) faster.", PlayerName( playerid ), R_DATA[ r_IDEx ][ r_BestRacerTime_0 ], R_DATA[ r_IDEx ][ r_BestRacerTime_1 ], R_DATA[ r_IDEx ][ r_BestRacerTime_2 ], R_DATA[ r_IDEx ][ r_Name ], R_DATA[ r_IDEx ][ r_BestRacerTime_0 ] - rTime[ 0 ] );
                    print( "minute" );
                }
                else if ( R_DATA[ r_IDEx ][ r_BestRacerTime_0 ] == R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] && R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] > rTime[ 1 ] && R_DATA[ r_IDEx ][ r_BestRacerTime_2 ] > rTime[ 2 ] || R_DATA[ r_IDEx ][ r_BestRacerTime_2 ] < rTime[ 2 ] )
                {
                    print( "secunde" );
                    format( gsString, sizeof gsString, "RACE: {FFFF00}%s has broken the old record '%d:%d:%d' in '%s' race with %d second(s) faster.", PlayerName( playerid ), R_DATA[ r_IDEx ][ r_BestRacerTime_0 ], R_DATA[ r_IDEx ][ r_BestRacerTime_1 ], R_DATA[ r_IDEx ][ r_BestRacerTime_2 ], R_DATA[ r_IDEx ][ r_Name ], R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] - rTime[ 1 ] );
                    print( "secunde" );
                }
                else if ( R_DATA[ r_IDEx ][ r_BestRacerTime_0 ] == R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] && R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] == rTime[ 1 ] && R_DATA[ r_IDEx ][ r_BestRacerTime_2 ] > rTime[ 2 ] )
                {
                    print( "milisecunde" );
                    format( gsString, sizeof gsString, "RACE: {FFFF00}%s has broken the old record '%d:%d:%d' in '%s' race with %d miliseconds faster.", PlayerName( playerid ), R_DATA[ r_IDEx ][ r_BestRacerTime_0 ], R_DATA[ r_IDEx ][ r_BestRacerTime_1 ], R_DATA[ r_IDEx ][ r_BestRacerTime_2 ], R_DATA[ r_IDEx ][ r_Name ], R_DATA[ r_IDEx ][ r_BestRacerTime_2 ] - rTime[ 2 ] );
                    print( "milisecunde" );
                }
                else print("unknown clause");
                SendClientMessageToAll( COLOR_ULTRARED, gsString );
                printf( "%s", gsString );
               
                R_DATA[ r_IDEx ][ r_BestRacerTime_0 ] = rTime[ 0 ];
                R_DATA[ r_IDEx ][ r_BestRacerTime_1 ] = rTime[ 1 ];
                R_DATA[ r_IDEx ][ r_BestRacerTime_2 ] = rTime[ 2 ];
                format( R_DATA[ r_IDEx ][ r_BestRacer ], 25, "%s", PlayerName( playerid ) );
            }
rTime[ 0 ] - Current racer minutes
rTime[ 1 ] - Current racer seconds
rTime[ 2 ] - Current racer miliseconds.

Can somebody fix these codes?

PS> Sorry for some expressions mistakes xD


Re: Beating race best record problem. - Edvin - 23.08.2012

Anyone?