What is worng with my GMX?
#1

Why every time i use /gmx i can't back to login in my server?

Код:
CMD:gmx(playerid) {
	new string[80];
	format(string, sizeof(string), "AdmCmd: %s started a GMX.", PlayerName(playerid) );
	SendClientMessageToAll(COLOR_LIGHTRED, string);
	SetTimer("OnGMX", 5000,1);
	return 1;
}
Код:
public OnGMX() {
    SaveHouses();
    SaveORGs();
    SaveServer();
    mysql_close(); // vai fechar a conexгo com o mysql (entгo nгo vai salvar os players qnd der o GMX)
    SendRconCommand("gmx");
}
Show my this errors in mysql.log
Код:
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_format - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_pquery - invalid connection handle (id: 1)
[23:56:36] [ERROR] mysql_close - invalid connection handle (id: 1)
[23:56:48] [ERROR] CMySQLConnection::Connect - (error #1226) User 'port_2538' has exceeded the 'max_user_connections' resource (current value: 5)
[23:56:48] [ERROR] CMySQLConnection::Connect - (error #1226) User 'port_2538' has exceeded the 'max_user_connections' resource (current value: 5)
I'm using ultra-h host...
Reply
#2

uppp
Reply
#3

You need to get connection handle when you connect to mysql-server and then use that every time you use any mysql funciton. Example:
PHP код:
new msqylHandle;// on top of script, global variable

mysqlHandle mysql_connect(...);// add this 'mysqlHandle =' part on mysql connect line

//then use it like this :
mysql_pquery(mysqlHandle, .....);
mysql_format(mysqlHandle, .....);
mysql_close(mysqlHandle); 
Reply
#4

If there is only 1 connection, it is by default 1.

The error about the invalid connection handle is given because you close the connection to the mysql server before server is restarted but when "gmx" is used, it calls OnGameModeExit which you most likely call mysql functions in there too to save. The plugin will wait until all queued queries are executed (R36+) so just let it save them in OnGameModeExit normally.

From what I see, you have reached the limit in "max_user_connections". Unless you willingly have multiple connections for whatever reasons, make sure you close the connection to the mysql server before creating a new one.
Reply
#5

Should use the native: https://sampwiki.blast.hk/wiki/GameModeExit
Reply
#6

Код:
public OnGMX() {
    SaveHouses();
    SaveORGs();
    SaveServer();
    mysql_close(); // vai fechar a conexгo com o mysql (entгo nгo vai salvar os players qnd der o GMX)
    SendRconCommand("gmx");
}
Replace that, with this:

Код:
public OnGMX() {
    SendRconCommand("gmx");
}
And add this under "OnGameModeExit":

Код:
    SaveHouses();
    SaveORGs();
    SaveServer();
    mysql_close(); // vai fechar a conexгo com o mysql (entгo nгo vai salvar os players qnd der o GMX)
Reply
#7

I had the same problem, so i removed gmx
Reply
#8

Quote:
Originally Posted by [cS]Owain
Посмотреть сообщение
You need to get connection handle when you connect to mysql-server and then use that every time you use any mysql funciton. Example:
PHP код:
new msqylHandle;// on top of script, global variable
mysqlHandle mysql_connect(...);// add this 'mysqlHandle =' part on mysql connect line
//then use it like this :
mysql_pquery(mysqlHandle, .....);
mysql_format(mysqlHandle, .....);
mysql_close(mysqlHandle); 
I writed worng here, srry

Thats is my close:
Код:
mysql_close(ConnectMYSQL);
My start:
Код:
ConnectMYSQL = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_DB,MYSQL_PASS);
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If there is only 1 connection, it is by default 1.

The error about the invalid connection handle is given because you close the connection to the mysql server before server is restarted but when "gmx" is used, it calls OnGameModeExit which you most likely call mysql functions in there too to save. The plugin will wait until all queued queries are executed (R36+) so just let it save them in OnGameModeExit normally.

From what I see, you have reached the limit in "max_user_connections". Unless you willingly have multiple connections for whatever reasons, make sure you close the connection to the mysql server before creating a new one.
But i'm closing '-'

Quote:
Originally Posted by Vince
Посмотреть сообщение
Like this \/ ?

Quote:
Originally Posted by Lenny_King
Посмотреть сообщение
Код:
public OnGMX() {
    SaveHouses();
    SaveORGs();
    SaveServer();
    mysql_close(); // vai fechar a conexгo com o mysql (entгo nгo vai salvar os players qnd der o GMX)
    SendRconCommand("gmx");
}
Replace that, with this:

Код:
public OnGMX() {
    SendRconCommand("gmx");
}
And add this under "OnGameModeExit":

Код:
    SaveHouses();
    SaveORGs();
    SaveServer();
    mysql_close(); // vai fechar a conexгo com o mysql (entгo nгo vai salvar os players qnd der o GMX)
I tried, but still the problem :@
Код:
[12:10:30] [ERROR] CMySQLConnection::Connect - (error #1226) User 'port_2538' has exceeded the 'max_user_connections' resource (current value: 5)
[12:10:30] [ERROR] CMySQLConnection::Connect - (error #1226) User 'port_2538' has exceeded the 'max_user_connections' resource (current value: 5)
I tried use
Код:
public OnGMX() {
    GameModeExit();
}
TOo, but same problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)