Having issues loading ammo. MYSQL.
#1

First off, I use my own system of saving and loading my weapons, I save them like you would save vehicles etc.

pawn Код:
for(new w = 0; w < 13; w++)
        {
            format(fieldname, sizeof(fieldname), "Weapon%d", w);
            MySQL_SetInteger(PlayerSQLID[playerid], fieldname, PlayerWeapons[playerid][w], "accounts");
            ammo = WepAmmo[PlayerWeapons[playerid][w]];
            MySQL_SetInteger(PlayerWeapons[playerid][w], "WepAmmo", ammo, "weapons");
        }
PlayerWeapons[playerid][w] is the ID of the weapon in the database, not the actual weaponid like Desert Eagle or anything, but the row id.

WepAmmo Is the same thing, it should get the ammo from the ID in the PlayerWeapons, but it won't and I can't figure it out.

Here is where I load the weapons.

pawn Код:
mysql_get_field( "WepAmmo", QueryString);
            WepAmmo[x] = strval( QueryString);
Here is where the player SHOULD get them, but it won't set the ammo correctly.

pawn Код:
for(new w = 0; w < 13; w++)
                {

                        new ammo = WepAmmo[PlayerWeapons[playerid][w]];
                        printf("Ammo: %d", ammo);
                        new weapon = WepModel[PlayerWeapons[playerid][w]];
                        printf("WepModel :%d", WepModel[PlayerWeapons[playerid][w]]);
                        GivePlayerWeapon(playerid,weapon,ammo);

                }
it gets the ID correctly, but not the weapon ammo from WepAmmo.
Reply


Messages In This Thread
Having issues loading ammo. MYSQL. - by Dokins - 06.04.2014, 09:08
Re: Having issues loading ammo. MYSQL. - by Vince - 06.04.2014, 10:23
Re: Having issues loading ammo. MYSQL. - by Dokins - 06.04.2014, 14:26

Forum Jump:


Users browsing this thread: 4 Guest(s)