Top Spree

Started by FinchDon, Sep 06, 2015, 06:49 AM

Previous topic - Next topic

FinchDon

I am trying to make topspree but failed i made a Table at sqliteDB

Spree and his Columns Name and Spree there is function

function SetSpree( player, amount )
{
      QuerySQL(sqliteDB, "UPDATE Spree SET Spree='" +  amount + "' WHERE Name='" + player.Name + "'");   
}

function GetSpree( player )
{
   local lvl11 =  GetSQLColumnData( QuerySQL( sqliteDB, "SELECT Spree FROM Spree WHERE Name='" + player.Name+"'" ), 0 );
   if ( lvl11 ) return lvl11;
   else return 0;
}

onPlayerKill
SetSpree(killer,GetSpree(killer)+1);

when someone kill i check out at sqliteDB there is everyone name but spree 0 when i do /topclans

its show all name nulls kills nulls
function topspree()
{local query = "SELECT Name,Spree FROM Spree ORDER BY Spree DESC LIMIT 5", //Top 5
q, name1, name2, name3, name4, name5, spree1, spree2, spree3, spree4, spree5, i = 1;
q = QuerySQL( sqliteDB, query );
while( GetSQLColumnData( q, 0 ) )
{switch(i)
{case 1:
name1 = GetSQLColumnData( q, 0 );
spree1 = GetSQLColumnData( q, 1 );
break;
case 2:
name2 = GetSQLColumnData( q, 0 );
spree2 = GetSQLColumnData( q, 1 );
break;
case 3:
name3 = GetSQLColumnData( q, 0 );
spree3 = GetSQLColumnData( q, 1 );
break;
case 4:
name4 = GetSQLColumnData( q, 0 );
spree4 = GetSQLColumnData( q, 1 );
break;
case 5:
name5 = GetSQLColumnData( q, 0 );
spree5 = GetSQLColumnData( q, 1 );
break;
}
GetSQLNextRow( q );
i++;}
FreeSQLQuery(q);
Message(MSG+" ** >> TOP 5 Highest Spree << **" );
Message(RED+"** >> First >> "+PINK+"Name:[ "+name1+" ] Kills:[ "+spree1+" ].");
Message(BLUE+"** >> Second >> "+WHITE+"Name:[ "+name2+" ] Kills:[ "+spree2+" ].");     
Message(GREEN+"** >> Third >> "+BROWN+"Name:[ "+name3+" ] Kills:[ "+spree3+" ]."); 
Message(YELLOW+"** >> Forth >> "+PURPLE+"Name:[ "+name4+" ] Kills:[ "+spree4+" ]."); 
Message(ORANGE+"** >> Fifth >> "+BLUE+"Name:[ "+name5+" ] Kills:[ "+spree5+" ].");
}
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Xmair

Seriously? Using a query for only a spree?

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

Spree should be in an array, which will be 0 when disconnected, why shall we make a query for it?
oh no

EK.IceFlake

Quote from: Xmair on Sep 06, 2015, 11:54 AMSeriously? Using a query for only a spree?
I executed 2 queries every second on my old server that increased the robbing value of pickups

KAKAN

oh no

FinchDon

i want to save that spree for all time for not one time
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )