24.06.2010, 10:32
Simply the command checks for all houses within for() looping with returns, so it's wrong. Example: 1 house, it checks, and it's not found, it sends a message, when returns and don't check for 2 house... am i right? I suggest you to use continue; function in for() loops. In for() loops return stops looping, continue just ends variable looping.
BTW. If you want to send end message, send it before for() looping.
BTW. If you want to send end message, send it before for() looping.
Код:
if(strcmp(cmd,"/kaufen",true)==0) { for(new i=0;i<MAX_HOUSES;i++) { if(!IsPlayerInRangeOfPoint(playerid, 3.0, HausInfo[i][eX], HausInfo[i][eY], HausInfo[i][eZ])) continue; if(GetPlayerMoney(playerid) < HausInfo[i][Preis]) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, MAX_PLAYER_NAME); GivePlayerMoney(playerid, - HausInfo[i][Preis]); strmid(HausInfo[i][Besitzer], Name, 0, strlen(Name), 24); HausInfo[i][Vergeben] = 1; SendClientMessage(playerid, FARBE_WEIЯ,"Du hast das Haus gekauft, um Befehle anzusehen schreibe /hauscmds !"); return 1; } else { SendClientMessage(playerid,FARBE_WEIЯ,"Du hast zu wenig Geld, du musst zuerst das Geld auf der Hand haben."); return 1; } } return 1; }