20.09.2018, 13:23
I wanted to make some server stats such as joins, quits kills etc. So i made in this way:
To load them (Placed on OnGameModeInit):
NB: Function is just a macro of forward public.
But in mysql log i'm getting this when loading them:
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:
I created a table called "serverstats" and i placed 5 column in it.
What's wrong?
pawn Код:
enum serverStats
{
TotalJoins,
TotalQuits,
TotalAccounts,
TotalKills,
TotalDeaths
};
pawn Код:
new ServerStats[serverStats];
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;
}
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) |
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'') |
What's wrong?