SA-MP Forums Archive
What am I doing wrong here, Armour Saving. - 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: What am I doing wrong here, Armour Saving. (/showthread.php?tid=395233)



What am I doing wrong here, Armour Saving. - Dokins - 25.11.2012

pawn Код:
if(!strcmp(item, "armour", true))
            {
                new armour;
                PlayerArmour[playerid] = GetPlayerArmour(playerid, PlayerArmour[playerid]);
                if(sscanf(params, "s[24]s[32]d",usage,item,armour))
                {
                    SendClientMessage(playerid, COLOUR_GREY, "Usage: /house store armour [amount]");
                    return 1;

                }
                if(armour > PlayerArmour[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much armour");
                HouseArmour[houseid] = HouseArmour[playerid] += armour;
                PlayerArmour[playerid] = PlayerArmour[playerid] -= armour;
                SetPlayerArmour(playerid, PlayerArmour[playerid]);
                MySQL_SetFloat(houseid, "HouseArmour", HouseArmour[houseid], "houses");
                MySQL_SetFloat(PlayerSQLID[playerid], "Armour", PlayerArmour[playerid], "accounts");
                format(string, sizeof(string), "You have stored %f of armour, you now have a total of: %f armour in your house", armour, HouseArmour[houseid]);
                SendClientMessage(playerid, COLOUR_BLUE, string);
                format(string, sizeof(string), "* %s has stored some armour in their house.", GetNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
            }



Re: What am I doing wrong here, Armour Saving. - RenSoprano - 25.11.2012

Change this

Код:
SetPlayerArmour(playerid, PlayerArmour[playerid]);
to this

Код:
SetPlayerArmour(playerid, -PlayerArmour[playerid]);



Re: What am I doing wrong here, Armour Saving. - XtremeR - 25.11.2012

try this:
pawn Код:
if(!strcmp(item, "armour", true))
            {
                new armour;
                PlayerArmour[playerid] = GetPlayerArmour(playerid, PlayerArmour[playerid]);
                if(sscanf(params, "s[24]s[32]d",usage,item,armour))
                {
                    SendClientMessage(playerid, COLOUR_GREY, "Usage: /house store armour [amount]");
                    return 1;

                }
                if(armour > PlayerArmour[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much armour");
                HouseArmour[houseid] = HouseArmour[playerid] += armour;
                PlayerArmour[playerid] = PlayerArmour[playerid] -= armour;
                SetPlayerArmour(playerid, -PlayerArmour[playerid]);
                MySQL_SetFloat(houseid, "HouseArmour", HouseArmour[houseid], "houses");
                MySQL_SetFloat(PlayerSQLID[playerid], "Armour", PlayerArmour[playerid], "accounts");
                format(string, sizeof(string), "You have stored %f of armour, you now have a total of: %f armour in your house", armour, HouseArmour[houseid]);
                SendClientMessage(playerid, COLOUR_BLUE, string);
                format(string, sizeof(string), "* %s has stored some armour in their house.", GetNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
            }



Re: What am I doing wrong here, Armour Saving. - Dokins - 25.11.2012

Checking it, Thanks!


Re: What am I doing wrong here, Armour Saving. - Vince - 25.11.2012

Aren't you getting a tag mismatch anywhere?


Re: What am I doing wrong here, Armour Saving. - Dokins - 25.11.2012

I'm not, PlayerArmour is a Float. I'm not sure why it will not store.