SA-MP Forums Archive
Not sure why weapons and armour won't load for players. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not sure why weapons and armour won't load for players. (/showthread.php?tid=457905)



Not sure why weapons and armour won't load for players. - Dokins - 13.08.2013

pawn Код:
SaveWeapons()
{
    foreach(Player, p)
    {
        if(LoggedIn[p] == 1)
        {
            for(new w = 0; w < 13; w++)
            {
                GetPlayerWeaponData(p, w, PlayerWeapons[p][w], PlayerWeaponAmmo[p][w]);

                new fieldname[50];
                format(fieldname, sizeof(fieldname), "Weapon%d", w);
                MySQL_SetInteger(PlayerSQLID[p], fieldname, PlayerWeapons[p][w], "accounts");
                format(fieldname, sizeof(fieldname), "Weapon%dAmmo", w);
                MySQL_SetInteger(PlayerSQLID[p], fieldname, PlayerWeaponAmmo[p][w], "accounts");

                    GetPlayerArmour(p, armour);
                            MySQL_SetFloat(PlayerSQLID[p], "Armour", armour, "accounts");
            }
        }
    }
    return 1;
}
This is under a OneMinuteTimer.

OnDialogResponse

DIALOG_LOGIN

pawn Код:
PlayerArmour[playerid] = MySQL_GetFloat(PlayerSQLID[playerid], "Armour", "accounts");
                printf("ARMOUR %f", PlayerArmour[playerid]);
                SetPlayerArmour(playerid, PlayerArmour[playerid]);

                new fieldname[50];
                for(new w = 0; w < 13; w++)
                {
                    PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
                    format(fieldname, sizeof(fieldname), "Weapon%d", w);
                    PlayerWeapons[playerid][w] = MySQL_GetValue(PlayerSQLID[playerid], fieldname, "accounts");
                    format(fieldname, sizeof(fieldname), "Weapon%dAmmo", w);
                    PlayerWeaponAmmo[playerid][w] = MySQL_GetValue(PlayerSQLID[playerid], fieldname, "accounts");

                    if(PlayerWeapons[playerid][w] > 0) GivePlayerWeapon(playerid, PlayerWeapons[playerid][w], PlayerWeaponAmmo[playerid][w]);

                }
               

                SetSpawnInfo(playerid, -1, PlayerSkin[playerid],-2381.5684,2332.7764,4.9844, 90.0, 0,0,0,0,0,0);
                SpawnPlayer(playerid);

ANY and all suggestions would be helpful. My Functions GetFloat etc are working correctly as they're used elsewhere!


Re: Not sure why weapons and armour won't load for players. - Dokins - 14.08.2013

BUMP.