Top Spree

Started by gta5, Jan 24, 2021, 09:09 PM

Previous topic - Next topic

gta5

I made a top spree command. Hopefully it helps someone.

else if ( cmd == "topspree" || cmd == "maxspree" )
    {
        //Replace "DataBase", "Accounts", "MaxSpree" as needed
        local q = QuerySQL( DataBase, "SELECT * FROM Accounts ORDER BY MaxSpree DESC LIMIT 5");
        Message("[#07ff08] Players with top Spree" );
        for (local i = 0; i < 5; i++)
        {

            local Name = GetSQLColumnData( q, 0 ); //replace 0 if needed
            local K = GetSQLColumnData( q, 4 ); //replace 4 if needed
            local D = GetSQLColumnData( q, 5 ); //replace 5 if needed
            local S = GetSQLColumnData( q, 21 ); //replace 21 if needed
            local R = format( "%.2f", K.tofloat() / D.tofloat() );

            GetSQLNextRow( q );

            if ( i == 0 ) NewTimer( "Message", 1000, 1, "[#6897BB]" + Name + " with " + S + " Spree - Ratio: " +R );
            if ( i == 1 ) NewTimer( "Message", 2000, 1, "[#6897BB]" + Name + " with " + S + " Spree - Ratio: " +R );
    if ( i == 2 ) NewTimer( "Message", 3000, 1, "[#6897BB]" + Name + " with " + S + " Spree - Ratio: " +R );
    if ( i == 3 ) NewTimer( "Message", 4000, 1, "[#6897BB]" + Name + " with " + S + " Spree - Ratio: " +R );
    if ( i == 4 ) NewTimer( "Message", 5000, 1, "[#6897BB]" + Name + " with " + S + " Spree - Ratio: " +R );

        }
    }

Inferno

So many timers only to execute 1 function.
Viva la VU
VFS Developer
VCCNR Administrator