Simple Mistakes, Could someone tell me why?
#1

This is a silly mistake, I tried to take out $1,000 and it set the money to -$1000 in the house.


pawn Код:
if(!(strcmp(item, "money", true)))
            {
                PlayerMoney[playerid] = GetPlayerMoney(playerid);
                if(sscanf(params, "s[24]s[32]d",usage,item,slot))
                {
                    SendClientMessage(playerid, COLOUR_GREY, "Usage: /house get money [amount]");
                    return 1;

                }
                if(HouseMoney[houseid] < slot) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much money stored in your house.");
                if(slot < 1 || slot  > 100000) return SendClientMessage(playerid, COLOUR_GREY, "The amount must be between $0 and $100,000");
                HouseMoney[houseid] = HouseMoney[playerid] -= slot;
                PlayerMoney[playerid] = PlayerMoney[playerid] + slot;
                GivePlayerMoney(playerid, PlayerMoney[playerid]);
                MySQL_SetInteger(houseid, "HouseMoney", HouseMoney[houseid], "houses");
                MySQL_SetInteger(PlayerSQLID[playerid], "Money", PlayerMoney[playerid], "accounts");
                format(string, sizeof(string), "You have taken $%d from your house,you now have a total of: $%d in your house", slot, HouseMoney[houseid]);
                SendClientMessage(playerid, COLOUR_BLUE, string);
                format(string, sizeof(string), "* %s has taken some money from their house.", GetNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
            }
Reply
#2

hm...
Код:
HouseMoney[houseid] = HouseMoney[playerid] - slot;
PlayerMoney[playerid] = PlayerMoney[playerid] + slot;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerMoney[playerid]);
or
Код:
HouseMoney[houseid] -= slot;
PlayerMoney[playerid] += slot;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerMoney[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)