10.03.2009, 15:47
Hey, when i try to start my server, it says File or function not found, the only thing i changed is the mysql samp plugin and putting the connect function into my script // by Luk0r
pawn Код:
public MySQLConnect(sqlhost[], sqluser[], sqlpass[], sqldb[]) // by Luk0r
{
print("MYSQL: Attempting to connect to server...");
samp_mysql_connect(sqlhost, sqluser, sqlpass);
samp_mysql_select_db(sqldb);
if(samp_mysql_ping()==0)
{
print("MYSQL: Database connection established.");
return 1;
}
else
{
print("MYSQL: Connection error, retrying...");
samp_mysql_connect(sqlhost, sqluser, sqlpass);
samp_mysql_select_db(sqldb);
if(samp_mysql_ping()==0)
{
print("MYSQL: Reconnection successful. We can continue as normal.");
return 1;
}
else
{
print("MYSQL: Could not reconnect to server, terminating server...");
SendRconCommand("exit");
return 0;
}
}
}
public MySQLDisconnect() // by Luk0r
{
samp_mysql_close();
return 1;
}
public MySQLCheckConnection() // by Luk0r
{
if(samp_mysql_ping()==0)
{
print("MYSQL: Connected!");
return 1;
}
else
{
print("MYSQL: Connection seems dead, retrying...");
MySQLDisconnect();
MySQLConnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
if(samp_mysql_ping()==0)
{
print("MYSQL: Reconnection successful. We can continue as normal.");
return 1;
}
else
{
print("MYSQL: Could not reconnect to server, terminating server...");
SendRconCommand("exit");
return 0;
}
}
}