Help please....SSCANF issue - Still not resolved.
#4

hmm let me check.. will post the edit when im done

EDIT:
try this:
I re organized it a bit. I can understand if you dont like it but its cleaner for me

pawn Code:
CMD:housestore(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");

    new cashamount, string[128],function[16], sum;
    new houseid = GetPlayerHouseID(playerid);
    if(sscanf(params, "s[16]D", function, cashamount)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /housestore [function] Available functions: weapon(coming soon), money");

    if(strcmp(function, "money", true) == 0)
    {
        if(!sscanf(function, "d", cashamount))
        {
            if(cashamount > 1 || cashamount < 500000)
            {
                if(cashamount < PlayerMoney[playerid])
                {
                    if(HouseOwned[playerid] == houseid)
                    {
                        printf("House Owned: %d", HouseOwned[playerid]);
                        sum = HouseMoney[houseid] += cashamount;
                        HouseSQLID[houseid] = MySQL_GetValue(HouseSQLID[houseid], "id", "houses");
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseMoney", sum, "houses");
                        GivePlayerMoney(playerid, -cashamount);
                        printf("Cash amount %d", cashamount);
                        format(string, sizeof(string), "You have stored $%d in your house.", cashamount);
                        SendClientMessage(playerid, COLOUR_ORANGE, string);
                    }
                }
                else return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much to store.");
            }
            else return SendClientMessage(playerid, COLOUR_GREY, "The amount must be between $0 and $500,000.");
        }
        else return SendClientMessage(playerid, COLOUR_GREY, "Usage: /housestore money [amount]"); //use !sscanf
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)