SA-MP Forums Archive
Weapon Saving/Loading, Help please. - 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: Weapon Saving/Loading, Help please. (/showthread.php?tid=285008)



Weapon Saving/Loading, Help please. - Dokins - 21.09.2011

I know I post a lot, but I need help with this:

pawn Code:
if(strcmp(password, inputtext, false) == 0)
            {
                LoggedIn[playerid] = true;
                for(new w = 0; w < 13; w++)
                {
                    new fieldname[50];
                    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]);
                }


yes, I did code this, but cannot figure out why it wont work. It won\'t give the player weapon when they login and it doesn\'t appear to save either, here is the saving:

pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    for(new w = 0; w < 13; w++)
    {
        GetPlayerWeaponData(playerid, w, PlayerWeapons[playerid][w], PlayerWeaponAmmo[playerid][w]);

        new fieldname[50], Float: armour;
        PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "Accounts");
        format(fieldname, sizeof(fieldname), "Weapon%d", w);
        MySQL_SetInteger(PlayerSQLID[playerid], fieldname, PlayerWeapons[playerid][w], "Accounts");
        format(fieldname, sizeof(fieldname), "Weapon%dAmmo", w);
        MySQL_SetInteger(PlayerSQLID[playerid], fieldname, PlayerWeaponAmmo[playerid][w], "Accounts");
       
        GetPlayerArmour(playerid, armour);
        MySQL_SetFloat(PlayerSQLID[playerid], "Armour", armour, "Accounts");
    }
    return 1;
}


Just wont load or save, yes it connect\'s to database.


Re: Weapon Saving/Loading, Help please. - Dokins - 21.09.2011

Anyone?


Re: Weapon Saving/Loading, Help please. - BladesGlory - 21.09.2011

Use pawno, and open up main script file. Then press f5 which will save everything.