18.11.2011, 21:12
This bug is driving me nuts.
public OnPlayerConnect(playerid)
{
GetPlayerIp(playerid,String32_1,32);
format(String1024_1,1024,"INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (%d,'%s','%s')",playerid,PlayerName(playerid),Stri ng32_1);
mysql_query(String1024_1, 1, playerid);
WriteLog("temp_mysql_debug", String1024_1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
format(String1024_1,1024,"DELETE FROM `live_players` WHERE `id` = %d",playerid);
mysql_query(String1024_1, 2, playerid);
WriteLog("temp_mysql_debug", String1024_1);
return 1;
}
Text file log extract:
[23:08:00] DELETE FROM `live_players` WHERE `id` = 55
[23:08:07] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (55,'Toreno_Gangster','89.456.99.123')
[23:09:27] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (55,'Jay_Player','52.972.144.47')
[23:10:22] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (15,'Toreno_Gangster','89.456.99.123')
Player names / IPs modified to protect user privacy. As you can see, OnPlayerDisconnect isn't getting called. This happens about 0.5% of the time.
public OnPlayerConnect(playerid)
{
GetPlayerIp(playerid,String32_1,32);
format(String1024_1,1024,"INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (%d,'%s','%s')",playerid,PlayerName(playerid),Stri ng32_1);
mysql_query(String1024_1, 1, playerid);
WriteLog("temp_mysql_debug", String1024_1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
format(String1024_1,1024,"DELETE FROM `live_players` WHERE `id` = %d",playerid);
mysql_query(String1024_1, 2, playerid);
WriteLog("temp_mysql_debug", String1024_1);
return 1;
}
Text file log extract:
[23:08:00] DELETE FROM `live_players` WHERE `id` = 55
[23:08:07] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (55,'Toreno_Gangster','89.456.99.123')
[23:09:27] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (55,'Jay_Player','52.972.144.47')
[23:10:22] INSERT INTO `live_players` (`id`,`name`,`ip`) VALUES (15,'Toreno_Gangster','89.456.99.123')
Player names / IPs modified to protect user privacy. As you can see, OnPlayerDisconnect isn't getting called. This happens about 0.5% of the time.