09.02.2012, 20:14
I'm having alot of troube on 'Heap Overflow's.
When the first player logs in, it's alright. But when the second comes in, all the shit begins to happen:
ALL public functions called get reported, by the crashdetect plugin.
As the bugs start to happen when someone logs in, Imma post my code:
When the first player logs in, it's alright. But when the second comes in, all the shit begins to happen:
ALL public functions called get reported, by the crashdetect plugin.
As the bugs start to happen when someone logs in, Imma post my code:
pawn Код:
public OnPlayerConnect(playerid)
{
SetPlayerCameraPos(playerid, -2321.0840, 1322.4452, 62.1136);
SetPlayerCameraLookAt(playerid, -2322.0059, 1322.8374, 61.9684);
Player_SetTextDraws(playerid);
GetPlayerName(playerid, query, MAX_PLAYER_NAME);
mysql_real_escape_string(query, gPlayerInfo[playerid][gPlayerName], MYSQL_GAME_CONNECTION);
Player_SetStatusLabel(playerid, "Checando a Existencia da conta...");
Player_CheckIfExists(playerid);
GetPlayerIp(playerid, gPlayerInfo[playerid][gPlayerIP], 16);
rdns(gPlayerInfo[playerid][gPlayerIP], playerid);
TextDrawShowForPlayer(playerid, TD_SERVER_LOGO);
Player_SetStatusLabel(playerid, "Checando a Existencia da conta...");
Player_CheckIfExists(playerid);
return 1;
}
pawn Код:
public Player_CheckIfExists(playerid)
{
mysql_format(MYSQL_GAME_CONNECTION, query, "SELECT * FROM `game_player` WHERE `name`='%s'", gPlayerInfo[playerid][gPlayerName]);
mysql_function_query(MYSQL_GAME_CONNECTION, query, true, "r@Player_CheckIfExists", "i", playerid);
return 1;
}
public r@Player_CheckIfExists(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
Player_SetStatusLabel(playerid, "Conta existente, digite a senha para prosseguir.");
gPlayerInfo[playerid][gPlayerStat] = PLAYER_STAT_LOGGING;
gPlayerInfo[playerid][gPlayerLoginTries] = 0;
format(query, 128, "Bem-vindo de volta, %s!\n\nInsira sua senha no campo a seguir para logar em sua conta.", gPlayerInfo[playerid][gPlayerName]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Bem-vindo ao " C_SERVERNAME, query, "Entrar", "Cancelar");
return 1;
}
Player_SetStatusLabel(playerid, "Registro:");
SendClientMessage(playerid, -1, "Prossiga com o registro para continuar:");
return 1;
}