Nothing happens upon connecting. -
BigGroter - 15.07.2013
The picture shows what happens, which is basically nothing. This happened after trying to create a register system using MySQL.
MySQL log:
Код:
[15:05:55] [WARNING] 'mysql_debug' is deprecated, use 'mysql_log' instead.
[15:05:55] [DEBUG] >> mysql_query_callback(Connection handle: 1)
[15:05:55] [DEBUG] >> mysql_query_callback(Connection handle: 1)
[15:05:55] [DEBUG] >> mysql_query_callback(Connection handle: 1)
[15:05:55] [DEBUG] >> mysql_query_callback(Connection handle: 1)
[15:05:55] [DEBUG] ProcessQueryThread(thread_LoadFactions) - Executing query SELECT * FROM `Factions`...
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadFactions) - Query was successful.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadFactions) - Data caching enabled.
[15:05:56] [DEBUG] CMySQLHandler::StoreResult() - Result was stored.
[15:05:56] [DEBUG] CMySQLHandler::FreeResult() - Result was successfully freed.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadFactions) - Data being passed to ProcessTick().
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadSpraypoints) - Executing query SELECT * FROM `Spraypoints`...
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadSpraypoints) - Query was successful.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadSpraypoints) - Data caching enabled.
[15:05:56] [DEBUG] CMySQLHandler::StoreResult() - Result was stored.
[15:05:56] [DEBUG] CMySQLHandler::FreeResult() - Result was successfully freed.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadSpraypoints) - Data being passed to ProcessTick().
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadTeleports) - Executing query SELECT * FROM `Teleports`...
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadTeleports) - Query was successful.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadTeleports) - Data caching enabled.
[15:05:56] [DEBUG] CMySQLHandler::StoreResult() - Result was stored.
[15:05:56] [DEBUG] CMySQLHandler::FreeResult() - Result was successfully freed.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadTeleports) - Data being passed to ProcessTick().
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadHouses) - Executing query SELECT * FROM `Houses`...
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadHouses) - Query was successful.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadHouses) - Data caching enabled.
[15:05:56] [DEBUG] CMySQLHandler::StoreResult() - Result was stored.
[15:05:56] [DEBUG] CMySQLHandler::FreeResult() - Result was successfully freed.
[15:05:56] [DEBUG] ProcessQueryThread(thread_LoadHouses) - Data being passed to ProcessTick().
[15:06:55] [DEBUG] >> mysql_real_escape_string(Connection handle: 1)
[15:06:55] [DEBUG] CMySQLHandler::EscapeString(Test_Test) - Escaped 9 characters to Test_Test.
[15:06:55] [DEBUG] >> mysql_query_callback(Connection handle: 1)
[15:06:55] [DEBUG] ProcessQueryThread(thread_LoadAccount) - Executing query SELECT * FROM `Accounts` WHERE `Username` = 'Test_Test'...
[15:06:55] [DEBUG] ProcessQueryThread(thread_LoadAccount) - Query was successful.
[15:06:55] [DEBUG] ProcessQueryThread(thread_LoadAccount) - Data caching enabled.
[15:06:55] [DEBUG] CMySQLHandler::StoreResult() - Result was stored.
[15:06:55] [DEBUG] CMySQLHandler::FreeResult() - Result was successfully freed.
[15:06:55] [DEBUG] ProcessQueryThread(thread_LoadAccount) - Data being passed to ProcessTick().
[15:07:14] [DEBUG] >> mysql_close(Connection handle: 1)
[15:07:14] [DEBUG] CMySQLHandler::~CMySQLHandler() - deconstructor called.
[15:07:14] [WARNING] CMySQLHandler::FreeResult() - The result is already empty.
[15:07:14] [DEBUG] CMySQLHandler::Disconnect() - Connection was closed.
[15:07:14] [DEBUG] Unloading Plugin
It seems like nothing is loading, since it is supposed to print eg. "x factions loaded."
What's wrong?
Re: Nothing happens upon connecting. -
BigGroter - 16.07.2013
Bump.
Re: Nothing happens upon connecting. -
gtakillerIV - 16.07.2013
Show us the register part.
Re: Nothing happens upon connecting. -
BigGroter - 16.07.2013
I don't think it's the register part, nothing using MySQL is actually loading.
pawn Код:
public OnPlayerConnect(playerid)
{
TogglePlayerSpectating(playerid, true);
loginTries[playerid] = 3;
new szName[MAX_PLAYER_NAME+1], szQuery[400], pName[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pName, sizeof(pName));
mysql_real_escape_string(pName, szName);
format(szQuery, sizeof(szQuery), "SELECT * FROM `Accounts` WHERE `Username` = '%s'", szName);
mysql_function_query(dbHandle, szQuery, true, "thread_checkAccount", "d", playerid);
return 1;
}
pawn Код:
forward thread_checkAccount(playerid);
public thread_checkAccount(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back. This account {00FF22}is {FFFFFF}registered. \nInsert your password to log back in game!","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","{FFFFFF}Welcome! This account is {F81414}not {FFFFFF}registered.\nEnter your desired password to register!","Register","Quit");
}
return 1;
}
pawn Код:
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","{FFFFFF}Welcome! This account is {F81414}not {FFFFFF}registered.\nEnter your desired password to register!\n{F81414}ERROR: {FFFFFF}You have to actually enter a password!","Register","Quit");
return 1;
}
new escapeString[MAX_PLAYER_NAME+1], szQuery[400], pName[MAX_PLAYER_NAME], buffer[129];
WP_Hash(buffer, sizeof(buffer), inputtext);
GetPlayerName(playerid, pName, sizeof(pName));
SendClientMessage(playerid,-1,"You have been {00FF22}successfully {FFFFFF}registered.");
format(pInfo[playerid][pPassword], 129, "%s", buffer);
mysql_real_escape_string(pName, escapeString);
format(szQuery, sizeof(szQuery), "INSERT INTO `Accounts` (`Password`, `Username`, `pIP`) VALUES ('%s', '%s', '%s')", pInfo[playerid][pPassword], escapeString, pInfo[playerid][pIP]);
mysql_function_query(dbHandle, szQuery, false, "thread_Login", "");
pInfo[playerid][pTimeOnline] = 0;
logged[playerid] = true;
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, 52, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
}
if(dialogid == DIALOG_LOGIN)
{
if(!response) return Kick(playerid);
if(response)
{
if(isnull(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back. This account is {00FF22}registered. \n{FFFFFF}Insert your password to log back in game!\n{F81414}Incorrect {FFFFFF}password!","Login","Quit");
}
new buffer[129], string[128];
WP_Hash(buffer, sizeof(buffer), inputtext);
if(!strcmp(buffer,pInfo[playerid][pPassword], false))
{
rGivePlayerMoney(playerid, pInfo[playerid][Money]);
SendClientMessage(playerid,-1,"{FFFFFF}Welcome back! You have {00FF22}successfully{FFFFFF} logged in.");
TogglePlayerSpectating(playerid, false);
logged[playerid] = true;
loadAccount(playerid);
SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], pInfo[playerid][pLastx], pInfo[playerid][pLasty], pInfo[playerid][pLastz],0,0,0,0,0,0,0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back. This account is {00FF22}registered. \n{FFFFFF}Insert your password to log back in game!\n{F81414}Incorrect {FFFFFF}password!","Login","Quit");
loginTries[playerid]--;
if(loginTries[playerid] == 0) return Kick(playerid);
format(string, sizeof(string), "You have "#COL_RED#"%d "#COL_WHITE#"tries left.", loginTries[playerid]);
SCM(playerid, -1, string);
}
}
}
Re: Nothing happens upon connecting. -
gtakillerIV - 16.07.2013
Then make sure that you start your mysql connection when the server starts. Hmmm, from what I see in the log it seems that it did connect.
Re: Nothing happens upon connecting. -
BigGroter - 16.07.2013
pawn Код:
public OnGameModeInit()
{
mysql_connect(MYSQLIP, MYSQLUSER, MYSQLDB, MYSQLPASSWORD);
}
In the first post, you can see what's printed in the mysql_log.