06.02.2014, 07:25
pawn Код:
if(sscanf(cmdtext, "s[20]d", choice, amount))
{
return SendClientMessage(playerid, COLOR_LIGHTRED, "/houseedit | Level/Price | ammount");
}
pawn Код:
LoadHouse();
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))
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)
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;
}