It adds up now
R7-2 fixes, + Zeex's fix, has anyone compiled that yet? |
R7-2 is always crashing: Heap underflow
Zeex made a fix for this, BlueG can you apply this? https://gist.github.com/2960412 I applied the patch, and compiled it on Debian 6 - http://************/bpuddoa |
I have a problem with loading last player connect date and last player connected IP. It is always null! But the values in PMA is not null :3 Tried to print, everything is fine.
OnPlayerConnect:
[pawn] format(szQuery, 77, "SELECT `Name` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerConnectEx", "ds", playerid, szName[playerid]);
PUB::OnPlayerConnectEx(playerid, Name[])
{
new iFields, iRows;
cache_get_data(iRows, iFields);
if (iRows)
{
// login check
}
else
{
// register
}
return true;
}
format(szQuery, 77, "SELECT `Name` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 1);
PUB::OnPlayerLogin(playerid, Name[], ResultID)
{
new szQuery[213], iFields, iRows;
switch (ResultID)
{
case 1:
{
cache_get_data(iRows, iFields);
format(szQuery, 61, "SELECT `IP` FROM `players` WHERE `IP` = '%s'", GetPlayerIpEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), (iRows) ? (2) : (3));
}
case 2:
{
cache_get_data(iRows, iFields);
if (iRows)
{
format(szQuery, 125, "SELECT `LastSeen`, `LastIP` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 5);
}
else
{
// The IP doesnt match with registration IP, let's open login dialog
}
}
case 3:
{
cache_get_data(iRows, iFields);
if (iRows >= MAX_ACCOUNTS_PER_IP)
{
// Player haves 3 accounts already, kick him.
Kick(playerid);
}
else
{
// Player doesnt have more than three accounts, open registration dialog
}
}
case 4:
{
cache_get_data(iRows, iFields);
if (iRows)
{
format(szQuery, 125, "SELECT `LastSeen`, `LastIP` FROM `players` WHERE `Name` = '%s'", GetPlayerNameEx(playerid));
mysql_function_query(iHandle, szQuery, true, "OnPlayerLogin", "dsd", playerid, GetPlayerNameEx(playerid), 5);
}
else
{
if (iBadPassword[playerid] == MAX_PASSWORD_WARNS - 1)
{
// Player entered wrong password three times. Kick him
Kick(playerid);
return true;
}
// Player havent entered wrong password three times, lets open login dialog.
iBadPassword[playerid] += 1;
}
}
case 5:
{
cache_get_row(0, 0, pInfo[playerid][statsLastSeen]);
cache_get_row(0, 1, pInfo[playerid][statsLastIP]);
printf("Last Seen: %s\nLast IP: %s", date(pInfo[playerid][statsLastSeen]), pInfo[playerid][statslastIP]);
strcpy(pInfo[playerid][statsLastIP], GetPlayerIpEx(playerid), 17);
pInfo[playerid][statsLastSeen] = GetCurrentDateInUnix();
iLoggedIn[playerid] = true;
}
}
return true;
}
// same callback mysql_function_query( 1, "SELECT * FROM `Accounts` WHERE `Name` = 'Parrot'", false, "OnPlayerLogin", "i", playerid ); mysql_function_query( 1, "SELECT * FROM `Houses` WHERE `Owner` = 'Parrot'", false, "OnHouseDetect", "i", playerid );
Can you test this version (http://www.egaming.ro/MySQL/R7-2/windows-untested/) on windows, please ?
|
[12:34:08] [debug] Server crashed while executing newegDB.amx [12:34:08] [debug] AMX backtrace: [12:34:08] [debug] #0 native mysql_format () [007fc5e0] from mysql.so [12:34:08] [debug] #1 000909c0 in MySQLConnectAccount (playerid=14) at I:\_eGaming\samp\_new_mysql-0.3d\__CORECTAT0.3c\pawno-3\include\eG_functii/eG_xan_mysql_func.inc:130
stock MySQLConnectAccount(playerid)
{
new query[220], plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
line130 ---> mysql_format(connectionHandle, query, "SELECT players.id,coalesce(players_logins.time ,UNIX_TIMESTAMP(NOW())) FROM players LEFT JOIN players_logins ON players.id=players_logins.userid WHERE LOWER(players.Name) = LOWER('%e')", plname);
mysql_function_query(connectionHandle, query, true, "ConnectThread", "d", playerid);
return 1;
}
Ok, static-v4 is almost perfectly fine! but theres still a few problems.
My server used to crash almost 8 times a day, since static-v3 it crashed once every day, IDK what else can be crashing it, crashdetect is not saying anything, it must be this plugin. dugi said that you said that cache could probably cause it, idk. All my queries are using cache expect the registration query, it still uses the old mysql_store_result, idk why I never changed over that query. If you need any more information..just tell me what |
[20:01:42] Error: Function not registered: 'mysql_query'
[20:01:42] Script[gamemodes/GameGate.amx]: Run time error 19: "File or function is not found" How fix on r7? |