Trouble updating with BlueG's mysql R7
#1

pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(is_logged[playerid] == true)
    {
        new
            mQuery[128];
           
        new
            pName[MAX_PLAYER_NAME];
           
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
       
        format(mQuery, sizeof(mQuery), "SELECT `id` from `accounts` WHERE `username` = '%s'", pName);
        mysql_function_query(myConnection, mQuery, true, "SavePlayerData", "i", playerid);
    }
    return 1;
}
pawn Code:
forward public SavePlayerData(playerid);
public SavePlayerData(playerid)
{
    new
        mQuery[500];
       
    new
            chr,
            cyr,
            cday,
            cmo,
            cmin,
            csec;

    getdate(cyr, cmo, cday);
    gettime(chr, cmin, csec);
       
    format(mQuery, sizeof(mQuery), "UPDATE `accounts` SET `Admin` = '%d', `CustomSkin` = '%d', `ActiveBuff` = '%d', `Killstreak` = '%d', `LastVisitedMonth` = '%d', `LastVisitedDay` = '%d', `LastVisitedYear` = '%d', `LastVisitedHour` = '%d', `LastVisitedMinute` = '%d'",
        PlayerInfo[playerid][Admin], PlayerInfo[playerid][CustomSkin], PlayerInfo[playerid][ActiveBuff],
        PlayerInfo[playerid][Killstreak], cmo, cday, cyr, chr, cmin
    );
    mysql_function_query(myConnection, mQuery, false, "", "");
   
    for(new i; i < 13; i++)
    {
        format(mQuery, sizeof(mQuery), "UPDATE `weapons` SET `weapon` = '%d', `ammo` = '%d' WHERE `id` = '%d' AND `index` = '%d'",
            PlayerInfo[playerid][SpawnWeapon][i], PlayerInfo[playerid][SpawnAmmo][i], PlayerInfo[playerid][pAccountID], i
        );
        mysql_function_query(myConnection, mQuery, false, "", "");
    }
    for(new i; i < 46; i++)
    {
        format(mQuery, sizeof(mQuery), "UPDATE `weaponkills` SET `weapon` = '%d', `kills` = '%d' WHERE `id` = '%d'",
            i, PlayerInfo[playerid][WeaponKills][i], PlayerInfo[playerid][pAccountID]
        );
        mysql_function_query(myConnection, mQuery, false, "", "");
    }
    is_logged[playerid] = false;
    return 1;
}
The first 'mQuery' works perfectly fine, and updates everything it should - the problem is located on my linked tables (`weaponkills`, `weapons`) Every time I change something in-game it never updates the database, and this is the function that actually updates the table so I was wondering if anyone could figure out what's wrong because I've been trying to figure this out for an hour or so and I'm completely clueless.
Reply


Messages In This Thread
Trouble updating with BlueG's mysql R7 - by 2KY - 25.12.2013, 01:22
Re: Trouble updating with BlueG's mysql R7 - by Zex Tan - 25.12.2013, 01:37
Re: Trouble updating with BlueG's mysql R7 - by 2KY - 25.12.2013, 01:40
Re: Trouble updating with BlueG's mysql R7 - by Kar - 25.12.2013, 03:46

Forum Jump:


Users browsing this thread: 3 Guest(s)