MySQL crash help
#1

Hello !
Need little help about SQL this time!
My SQL account and stats is working great but I found one bug. After player is alt. tabbed and he lost connection from server / server crash he lost all his stats. Any help? How to fix? This stats loosing is really annoying. Thanks!
Reply
#2

Are you saving under OnGameModeExit or OnPlayerDisconnect?
Reply
#3

OnPlayerDisconnect
Reply
#4

Use OnGameModeExit too...
Reply
#5

Thanks
Reply
#6

Код:
public OnGameModeExit()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
 		if(Info[i][logged]==1)
		{
		  new sqlquery[1052];
		  new ip[256];
		  GetPlayerIp(i, ip, sizeof(ip));
			format(sqlquery, sizeof(sqlquery), "UPDATE `Users` SET `IP` = '%s',`Logged` = '%d',`Level` = '%d',`Kills` = '%d',`Deaths` = '%d',`Money` = '%d',`Score` = '%d',`Jailed` = '%d',`Onlinetime` = '%d' WHERE `Username` = '%s' LIMIT 1 ;",
			ip,Info[i][logged],Info[i][AdminLevel],Info[i][Kills],Info[i][Deaths],GetPlayerMoney(i),GetPlayerScore(i),Info[playerid][i],Info[i][Online],Name(i));
			if(!query(sqlquery)) printf("[error] Cannot save account data for user: %s",Name(i));
		}
	}
	return 1;
}
and got only 1 error

Код:
C:\DOCUME~1\Damir\Desktop\TEAMWA~1\FILTER~1\hadmin.pwn(258 -- 259) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

You need to make a loop.
Reply
#8

how to? D:
Sorry I am just nub.
Reply
#9

Replace 'Info[playerid][i]' with 'Info[i][i]'
Reply
#10

Ohh, so stupid error.

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)