Stuck into this stupid calculation!
#3

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
Well to have reached that number, you must have a base valuable containing seconds or milliseconds, just use that...
The thing is, that I'm currently working on a restriction system, to restrict player for one how from doing xyz, I'm using SQLite and I'm saving DD|HH|MM and i use sscanf to format each date into a var then use the check.

pawn Код:
if ( db_num_rows( R2 ) )
                {
                    new
                        Field[ 64 ];
                       
                    db_get_field_assoc( R2, "TimePos", Field, sizeof (Field) );
                    SetPVarString( playerid, "OnTime", Field );
                   
                    db_free_result( R2 );
                   
                    sscanf( GPVSEx( playerid, "OnTime" ), "p<|>iii", Time[ 2 ], Time[ 0 ], Time[ 1 ] );

                    new
                        T2[ 3 ];


                    gettime( T2[ 0 ], T2[ 1 ] );
                    getdate( .day = T2[ 2 ] );

                    if ( Time[ 0 ] == 0 ) Time[ 0 ] = 24;
                    if ( T2[ 2 ] == Time[ 2 ] )
                    {
                        if ( T2[ 0 ] == Time[ 0 ] )
                        {
                            if ( T2[ 1 ] < Time[ 1 ] )
                            {
                                SendError( playerid, "You are allowed to give only one "GREE"+"GREY" respect per hour!");
                                FormatMSG( playerid, Color:GREY, "You can repeat the process after "BLUE"%d"GREY" minutes! Y", ( Time[ 1 ] - T2[ 1 ] ) );
                                return 1;
                            }
                        }
                        else if ( T2[ 0 ] < Time[ 0 ] )
                        {
                            SendError( playerid, "You are allowed to give only "GREE"+"GREY" respect per hour!");
                            FormatMSG( playerid, Color:GREY, "You can repeat the process after "BLUE"%d"GREY" minutes! X", (( Time[ 1 ] ) + ( T2[ 1 ] ) / 2 ) );
                            return 1;
                        }
                       
                    }
                }

The Y and X at the end of the strings is to see where the action takes place.
Also, don't laugh at this (( Time[ 1 ] ) + ( T2[ 1 ] ) / 2 ) , as i said, my maths are -1.

Inside the if ( T2[ 1 ] < Time[ 1 ] ) it works just great!
The system works great! But i want to let them know the time left..
If i can't find a solution to this i might give up on telling them the minutes.


E: I could actually tell them that they will be able to repeat the procces at HH:MM instead?
Reply


Messages In This Thread
Stuck into this stupid calculation! - by Zh3r0 - 21.04.2011, 18:18
Re: Stuck into this stupid calculation! - by Joe Staff - 21.04.2011, 18:34
Re: Stuck into this stupid calculation! - by Zh3r0 - 21.04.2011, 18:42
Re: Stuck into this stupid calculation! - by Joe Staff - 21.04.2011, 19:49
Re: Stuck into this stupid calculation! - by Zh3r0 - 21.04.2011, 20:20
Re: Stuck into this stupid calculation! - by Joe Staff - 21.04.2011, 20:31
Re: Stuck into this stupid calculation! - by Zh3r0 - 21.04.2011, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)