MySQL / Enumerator issue
#1

Hey, so I have been dealing with this issue for a pretty long time.
So basically, after restarting the server, infos do save in the MySQL Database but not on the enumerator. Here's an example:

My /stats looks like this before restarting:


And here's how it looks after restarting:


pawn Code:
format(string, sizeof(string), "{FFFFFF}Clan: {FF0000}[%s] - {FFFFFF}Clan Rank: {FF0000}[%d]", ClanInfo[PlayerInfo[giveplayerid][user_clan]][ClanName]
pawn Code:
format(ClanInfo[clanid][ClanName], 32, "%s", clanname);
^^ I call this when the clan gets created.

Here's how I save my data:

pawn Code:
SaveClan(clanid)
{
    new query[200];
    mysql_format(Database, query, sizeof(query), "UPDATE `clans` SET `ClanName` = '%e', `ClanLeader` = '%e', `ClanColor` = '%i', `ColorSet` = '%i', `ClanKills` = '%i', `ClanDeaths` = '%i', `ClanOfficial` = '%i' WHERE `ClanID` = '%i'",
    ClanInfo[clanid][ClanName], ClanInfo[clanid][ClanLeader], ClanInfo[clanid][ClanColor], ClanInfo[clanid][ColorSet], ClanInfo[clanid][ClanKills], ClanInfo[clanid][ClanDeaths], ClanInfo[clanid][ClanOfficial], clanid);
    mysql_query(Database, query);
    return 1;
}
And the enumerator:

pawn Code:
enum ClanData
{
    ClanID,
    ClanName[32],
    ClanLeader[24],
    ClanColor,
    ColorSet,
    ClanKills,
    ClanDeaths,
    ClanOfficial
};
new ClanInfo[MAX_CLANS][ClanData];
Loading clans:

pawn Code:
forward LoadClans();
public LoadClans()
{
    new query[150];

    mysql_format(Database, query, sizeof(query), "SELECT * FROM `clans`");
    mysql_tquery(Database, query, "OnClansLoad");
    return 1;
}

forward OnClansLoad();
public OnClansLoad()
{
    if(cache_num_rows())
    {
        for(new i = 0; i < cache_num_rows(); i ++)
        {
            cache_get_value_name_int(i, "ClanID", ClanInfo[i][ClanID]);
            cache_get_value_name(i, "ClanName", ClanInfo[i][ClanName]);
            cache_get_value_name(i, "ClanLeader", ClanInfo[i][ClanLeader]);
            cache_get_value_name_int(i, "ClanColor", ClanInfo[i][ClanColor]);
            cache_get_value_name_int(i, "ColorSet", ClanInfo[i][ColorSet]);
            cache_get_value_name_int(i, "ClanKills", ClanInfo[i][ClanKills]);
            cache_get_value_name_int(i, "ClanDeaths", ClanInfo[i][ClanDeaths]);
            cache_get_value_name_int(i, "ClanOfficial", ClanInfo[i][ClanOfficial]);
        }
        printf("[SERVER]: %d clans were loaded from the MySQL Database.", cache_num_rows());
    }
    else printf("[SERVER]: No clans were loaded from the MySQL Database.");
}
Under OnGameModeInit:

pawn Code:
LoadClans();
OnGameModeExit

pawn Code:
for (new i = 0; i < MAX_CLANS; i ++)
{
     SaveClan(i);
}
Still can't seem to fix it, some help would be really appreciated!
Reply


Messages In This Thread
MySQL / Enumerator issue - by solstice_ - 03.04.2019, 23:24
Re: MySQL / Enumerator issue - by TheToretto - 03.04.2019, 23:48
Re: MySQL / Enumerator issue - by solstice_ - 03.04.2019, 23:51
Re: MySQL / Enumerator issue - by Logic_ - 04.04.2019, 06:20
Re: MySQL / Enumerator issue - by rockys - 04.04.2019, 13:38
Re: MySQL / Enumerator issue - by TheToretto - 04.04.2019, 13:54
Re: MySQL / Enumerator issue - by solstice_ - 04.04.2019, 19:30

Forum Jump:


Users browsing this thread: 3 Guest(s)