Houseinfo problem
#1

I have this command but when I type /houseinfo it sends me above 20 messages with this command.
pawn Код:
if(strcmp(cmd,"/houseinfo",true)==0)
  {
    if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pPhousekey] == 255)
        {
          SendClientMessage(playerid, COLOR_WHITE, "You don't own a house!");
          return 1;
            }
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
            new text1[20];
            new text2[20];
            if(HouseInfo[h][hLock]) { text1 = "Locked"; } else { text1 = "Unlocked"; }
        if(HouseInfo[h][hRentabil]) { text2 = "Yes"; } else { text2 = "No"; }
        format(string,sizeof(string)," == HOUSE ID %d == ", PlayerInfo[playerid][pPhousekey]);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                format(string,sizeof(string),"Door: %s",text1);
                SendClientMessage(playerid, 0x00E3D8AA, string);
                format(string,sizeof(string),"Rentprice: %d",HouseInfo[h][hRent]);
                SendClientMessage(playerid, 0x00DBD8AA, string);
                format(string,sizeof(string),"Rentabil - %s",text2);
                SendClientMessage(playerid, 0x00CED8AA, string);
                format(string,sizeof(string),"Money: %d",HouseInfo[h][hTakings]);
                SendClientMessage(playerid, 0x00C2D8AA, string);
                format(string,sizeof(string),"Vehicle: %d",HouseInfo[h][hVec]);
                SendClientMessage(playerid, 0x00B4D8AA, string);
            }
        }
        return 1;
    }
Reply
#2

If you put these 'SendClientMessage(s)' inside a for loop ... well ofcourse they'll be send multiple times.

To be more precise they will each be send as much as the sizeof(HouseInfo)

what do you want us to do? get those out of the for loop
Reply
#3

Same .
Reply
#4

Bump.

I have solved but when I type /houseinfo it sends me : 'Money: 2500" and I haven't any money in my house.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)