Top Spree

FinchDon

  • Sr. Member
  • Posts: 252
Top Spree
« on September 6th, 2015, 07:49 AM »
I am trying to make topspree but failed i made a Table at sqliteDB

Spree and his Columns Name and Spree there is function

Code: [Select]
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
Code: [Select]
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
Code: [Select]
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

  • Wiki Contributor
  • Posts: 930
Re: Top Spree
« Reply #1, on September 6th, 2015, 12:54 PM »
Seriously? Using a query for only a spree?
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Top Spree
« Reply #2, on September 6th, 2015, 01:00 PM »
Spree should be in an array, which will be 0 when disconnected, why shall we make a query for it?
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761
Re: Top Spree
« Reply #3, on September 6th, 2015, 01:18 PM »
Quote from Xmair on September 6th, 2015, 12:54 PM
Seriously? 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

  • Wiki Contributor
  • Posts: 3,343
Re: Top Spree
« Reply #4, on September 6th, 2015, 01:30 PM »
and local i =?
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

FinchDon

  • Sr. Member
  • Posts: 252
Re: Top Spree
« Reply #5, on September 6th, 2015, 03:51 PM »
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 )