Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Groovy on Apr 12, 2020, 06:21 PM

Title: top killer not working.
Post by: Groovy on Apr 12, 2020, 06:21 PM
Hy bois.

function TopKillers()

local
query = "SELECT Name, Mato FROM Accounts ORDER BY Name DESC LIMIT 5", //Top 5
q,
Name1, Name2, Name3, Name4, Name5,
Top1, Top2, Top3, Top4, Top5, i = 1; 
q = QuerySQL( db, query );
while( GetSQLColumnData( q, 0 ) )
{
switch(i)
{
case 1:
Name1 = GetSQLColumnData( q, 0 );
Top1 = GetSQLColumnData( q, 1 );
break;
case 2:
Name2 = GetSQLColumnData( q, 0 );
Top2 = GetSQLColumnData( q, 1 );
break;
case 3:
Name3 = GetSQLColumnData( q, 0 );
Top3 = GetSQLColumnData( q, 1 );
break; 
case 4:
Name4 = GetSQLColumnData( q, 0 );
Top4 = GetSQLColumnData( q, 1 );
break;
case 5:
Name5 = GetSQLColumnData( q, 0 ); 
Top5 = GetSQLColumnData( q, 1 );
break; 
}
GetSQLNextRow( q );
i++;
}
FreeSQLQuery(q);
Message("[#00ffff]Top 5 Matadores | Killers[#000000]: [#00bfff]" + Name1 + " [#ffffff]: [#00ff00]" + Top1 + ", [#00bfff]" + Name2 + " [#ffffff]: [#00ff00]" + Top2 + ", [#00bfff]" + Name3 + " [#ffffff]: [#00ff00]" + Top3 + ", [#00bfff]" + Name4 + " [#ffffff]: [#00ff00]" + Top4 + ", [#00bfff]" + Name5 + " [#ffffff]: [#00ff00]" + Top5 + "");
}

else if (cmd =="topkiller")
{
TopKiller();
}

this ain't working. please help bois
Title: Re: top killer not working.
Post by: habi on Apr 13, 2020, 03:10 AM
what error you get in console?

Quote from: Groovy on Apr 12, 2020, 06:21 PMelse if (cmd =="topkiller")
{
TopKiller();
}
or is that you forgot s in 'TopKillers()'
Title: Re: top killer not working.
Post by: Groovy on Apr 13, 2020, 04:24 AM
i did still not working bruh.

(https://i.ibb.co/cCDMHKR/dffe.png) (https://imgbb.com/)

182th Line: q = QuerySQL( db, query );
28th Line: TopKillers();
Title: Re: top killer not working.
Post by: umar4911 on Apr 13, 2020, 12:15 PM
and what is the error being displayed?
Title: Re: top killer not working.
Post by: habi on Apr 13, 2020, 12:45 PM
see q is null.
I think I the  sqlite module failed to load, since there seems no error in query.

 Is there any error in the beginning when u start the server


Title: Re: top killer not working.
Post by: Groovy on Apr 13, 2020, 12:58 PM
Quote from: umar4911 on Apr 13, 2020, 12:15 PMand what is the error being displayed?
there is no error when i open the console.
Title: Re: top killer not working.
Post by: habi on Apr 13, 2020, 01:32 PM
ok Groovy. do you think this is correct?
Quote from: Groovy on Apr 12, 2020, 06:21 PMquery = "SELECT Name, Mato FROM Accounts ORDER BY Name DESC LIMIT 5",
It must be the other one here. ie. your 'Mato'
Title: Re: top killer not working.
Post by: Groovy on Apr 13, 2020, 02:07 PM
@habi thanks for finding out the bug.

but one problem that when i write /topkiller it shows players with low kills not high killers...
Title: Re: top killer not working.
Post by: habi on Apr 13, 2020, 03:05 PM
can u post onPlayerKill code? I think player and killer got twisted.
it should be
onPlayerKiller( killer, player, reason, body part)
so that killer killed theplayer.
Title: Re: top killer not working.
Post by: Groovy on Apr 13, 2020, 03:40 PM

Solved - The problem was in code. my friend fixed it.lock topic

habi brother thanks for your help.