/houseedit command
#3

pawn Код:
if(sscanf(cmdtext, "s[20]d", choice, amount))
{
    return SendClientMessage(playerid, COLOR_LIGHTRED, "/houseedit  | Level/Price | ammount");
}
You might want to put "return" here to prevent the rest of the code to be executed if your parameters are wrong.

pawn Код:
LoadHouse();
Don't you need to supply the houseID to load in that function?
Or do you load all houses again by using that function?

pawn Код:
new string[128], choice[32], amount;
if(sscanf(cmdtext, "s[20]d", choice, amount))
First you define "choice" as a string of 32 characters long, then using sscanf, you only use 20 of them.
Either increase the size in sscanf "s[32]", or lower the size in the "new" line to 20 to make them match.

pawn Код:
if(amount > 0)
Why check the amount for every house, to see if it's valid.
Use that just below the sscanf statement, before you begin the loop and use "return SendClientMessage..." to notify the player he entered a wrong amount.

Also, add "return 1;" to every if-statement (the ones that use strcmp), to stop processing the rest of the houses. Otherwise, when adjusting the price of HouseID 1, you'll be checking the other houses as well (2000 if your HouseInfo array is that large).

pawn Код:
if(strcmp(choice,"level",true) == 0)
{
        HouseInfo[i][hLevel] = amount;
        format(string, sizeof(string), "You have changed House ID(%d)'s price to %d!", i, amount);
    SendClientMessage(playerid, COLOR_YELLOW, string);
        SaveHouse(i);
        LoadHouse();
                return 1;
}
Reply


Messages In This Thread
/houseedit command - by VD1337 - 05.02.2014, 23:09
Re: /houseedit command - by SickAttack - 06.02.2014, 05:12
Re: /houseedit command - by PowerPC603 - 06.02.2014, 07:25

Forum Jump:


Users browsing this thread: 1 Guest(s)