mysql server stats
#1

I wanted to make some server stats such as joins, quits kills etc. So i made in this way:

pawn Код:
enum serverStats
{
    TotalJoins,
    TotalQuits,
    TotalAccounts,
    TotalKills,
    TotalDeaths
};
pawn Код:
new ServerStats[serverStats];
To load them (Placed on OnGameModeInit):

pawn Код:
mysql_tquery(g_SQL, "SELECT * FROM `serverstats`", "Server_Stats_Load");
pawn Код:
function Server_Stats_Load()
{
    cache_get_value_int(0, "TotalJoins", ServerStats[TotalJoins]);
    cache_get_value_int(0, "TotalQuits", ServerStats[TotalQuits]);
    cache_get_value_int(0, "TotalAccounts", ServerStats[TotalAccounts]);
    cache_get_value_int(0, "TotalKills", ServerStats[TotalKills]);
    cache_get_value_int(0, "TotalDeaths", ServerStats[TotalDeaths]);
           
    print("* Server stats loaded successfully.");
   
    return 1;
}
NB: Function is just a macro of forward public.

But in mysql log i'm getting this when loading them:

Quote:

[09/20/18 09:18:48] [INFO] Executing callback 'Server_Stats_Load' with 0 parameter...
[09/20/18 09:18:48] [DEBUG] executing AMX callback with index '113'
[09/20/18 09:18:48] [DEBUG] cache_get_value_name_int(0, "TotalJoins", 0xB314FAF4) 4689)
[09/20/18 09:18:48] [ERROR] cache_get_value_name_int: invalid row index '0' (number of rows: '0') 4689)
[09/20/18 09:18:48] [DEBUG] cache_get_value_name_int(0, "TotalQuits", 0xB314FAF 4690)
[09/20/18 09:18:48] [ERROR] cache_get_value_name_int: invalid row index '0' (number of rows: '0') 4690)
[09/20/18 09:18:48] [DEBUG] cache_get_value_name_int(0, "TotalAccounts", 0xB314FAFC) 4691)
[09/20/18 09:18:48] [ERROR] cache_get_value_name_int: invalid row index '0' (number of rows: '0') 4691)
[09/20/18 09:18:48] [DEBUG] cache_get_value_name_int(0, "TotalKills", 0xB314FB00) 4692)
[09/20/18 09:18:48] [ERROR] cache_get_value_name_int: invalid row index '0' (number of rows: '0') 4692)
[09/20/18 09:18:48] [DEBUG] cache_get_value_name_int(0, "TotalDeaths", 0xB314FB04) 4693)
[09/20/18 09:18:48] [ERROR] cache_get_value_name_int: invalid row index '0' (number of rows: '0') 4693)

This is the serverstats table:

https://image.ibb.co/kmTBuz/Immagine.jpg

But if i save them (I have Server_Stats_Save on OnGameModeExit), it works:

Quote:

[09/20/18 09:22:08] [INFO] query "UPDATE `serverstats` SET `TotalJoins` = '0', `TotalQuits` = '0', `TotalAccounts` = '0', `TotalKills` = '0', `TotalDeaths` = '0'" successfully executed within 27.745 milliseconds
[09/20/18 09:22:08] [DEBUG] CResultSet::Create(connection=0x92fa258, query_str='UPDATE `serverstats` SET `TotalJoins` = '0', `TotalQuits` = '0', `TotalAccounts` = '0', `TotalKills` = '0', `TotalDeaths` = '0'')

I created a table called "serverstats" and i placed 5 column in it.

What's wrong?
Reply


Messages In This Thread
mysql server stats - by KinderClans - 20.09.2018, 13:23
Re: mysql server stats - by iLearner - 20.09.2018, 13:48
Re: mysql server stats - by KinderClans - 20.09.2018, 13:57
Re: mysql server stats - by NaS - 20.09.2018, 15:12
Re: mysql server stats - by KinderClans - 20.09.2018, 15:16
Re: mysql server stats - by NaS - 20.09.2018, 15:17
Re: mysql server stats - by KinderClans - 20.09.2018, 15:32
Re: mysql server stats - by ReD_HunTeR - 20.09.2018, 19:08
Re: mysql server stats - by KinderClans - 20.09.2018, 19:19
Re: mysql server stats - by NaS - 20.09.2018, 19:28

Forum Jump:


Users browsing this thread: 1 Guest(s)