Quote:
Originally Posted by Drago987
Hello,i've a problem with /hnext command.It shows the next available houses even if its used before,Can someone tell me what is the problem with it ?
pawn Код:
CMD:hnext(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pShopTech] == 1) { SendClientMessageEx(playerid, COLOR_RED, "* Listing next available house..."); for(new x;x<MAX_HOUSES;x++) { if(HouseInfo[x][hOwned] == 0) { new string[128]; format(string, sizeof(string), "%d is available to use.", x); SendClientMessageEx(playerid, COLOR_WHITE, string); break; } } } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!"); return 1; } return 1; }
++ REP
|
Your loop looks okay... nothing wrong.
if(HouseInfo[x][hOwned] == 0) - means if the house isn't owned by anyone, if there is a owner so it will count the next one non-owned.