//OnGameModeInIt
SetTimer("RandBotMsgs", 8000, 1);
new bmsgTDswitch;
function RandBotMsgs()
{
bmsgTDswitch ++;
switch(bmsgTDswitch)
{
case 1: Topscore();
}
bmsgTDswitch = 0;
return true;
}
function Topscore()
{
new query[1303];
format(query, sizeof(query), "SELECT Username,Score FROM players WHERE ID ORDER BY Score DESC LIMIT 1;");
mysql_tquery(mysql , "ShowBestScore", "", "");
return true;
}
new g_SQL_handle = 1;
#define MySQL_getInt(%0,%1) cache_get_value_index_int(%0,%1,g_SQL_handle)
function ShowBestScore()
{
new rows;
cache_get_row_count(rows);
if(rows)
{
new playername[35];
new playerscore;
new str[1303];
cache_get_value_index(0, 0, playername);
playerscore = MySQL_getInt(0, 1);
format(str, sizeof(str), "Player with the most score is %s with %d score!", playername, playerscore);
SendClientMessageToAll(0xFF0000FF,str);
}
return 1;
}
You didn't pass query varaible but just an empty string...(also that much size is also needed for that variable)
Also the variable bmsgTDswitch will have 1 as value on each call because you resetting it to 0. |
You didn't pass query varaible but just an empty string...(also that much size is also needed for that variable)
Also the variable bmsgTDswitch will have 1 as value on each call because you resetting it to 0. |
SetTimer("ShowARandomMessage", RANDOM_MESSAGETIMEINMINUTES*60000, true);