MySQL account issue
#1

Hey,

Well I have a problem, With my sql gamemode. Sometimes when you connect even if you are registered it thinks your not and makes you re-register, causing the database to have multiple tables for the same person.

Here is some of the relevant code:

pawn Код:
public OnGameModeInit()
{
    //===> MySQL CONNECTION <===
    mysql_debug(1); //1 if you want to have log of all mysql actions; 0 if you don't want it
    new connection = mysql_connect(DB_IP,DB_USER,DB_NAME,DB_PASS);
    if(connection)
    {
      new stats[256];
      mysql_stat(stats);
      print(stats);
      print("[mysql] MySQL connection successfull!");
    }
    else
    {
      print("[mysql] MySQL connection un-successfull; server closed ...");
      return GameModeExit();
    }
    //===========================
    for(new x=0; x<MAX_VEHICLES; x++)
    {
      vInfo[x][vBuyAble] = 0;
    }
pawn Код:
public OnPlayerConnect(playerid)
{
    new
  string[128],
  PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));


  TextDrawShowForPlayer(playerid, Wesbite);
  TextDrawShowForPlayer(playerid, Logo);
  TextDrawShowForPlayer(playerid, Name);
    new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(string, sizeof(string), "%s has joined the server.", pName);
  SendClientMessageToAll(COLOR_LIGHTRED, string);

  SendClientMessage(playerid, LIGHTGREEN, "[NotimeBot(v1.1)]: Starting up Notime Defense System...");
  SetTimerEx("NTDSstart", 10000, 0, "i", playerid);
  Report[playerid] = 0;

    SetWeather(10);

    //===> MySQL CHECK <===
    PlayerInfo[playerid][pSQLId] = INVALID_SQL_ID;
    FindPlayerSQL(playerid);
    if(PlayerInfo[playerid][pSQLId] > INVALID_SQL_ID)
    {
        gPlayerAccount[playerid] = 1;
        ShowLoginDialog(playerid);
    }
    else
    {
        gPlayerAccount[playerid] = 0;
        ShowRegDialog(playerid);
    }
    //====================
Anyone got ideas why it's doing this?
pawn Код:
public CheckSQL()
{
  if(mysql_ping() == (-1))
    {
        mysql_connect(DB_IP,DB_USER,DB_NAME,DB_PASS);
        print("[mysql] MySQL connection lost! Reconnecting ...");
    }
    return 1;
}
Reply


Messages In This Thread
MySQL account issue - by jamesb93 - 05.12.2009, 19:59
Re: MySQL account issue - by Grim_ - 05.12.2009, 21:17
Re: MySQL account issue - by jamesb93 - 05.12.2009, 21:25
Re: MySQL account issue - by Grim_ - 05.12.2009, 21:30
Re: MySQL account issue - by jamesb93 - 05.12.2009, 23:39
Re: MySQL account issue - by Grim_ - 05.12.2009, 23:44
Re: MySQL account issue - by jamesb93 - 06.12.2009, 00:11
Re: MySQL account issue - by jamesb93 - 06.12.2009, 08:58
Re: MySQL account issue - by Sergei - 06.12.2009, 09:06

Forum Jump:


Users browsing this thread: 1 Guest(s)