SA-MP Forums Archive
Houseinfo problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Houseinfo problem (/showthread.php?tid=129455)



Houseinfo problem - Razvann - 22.02.2010

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;
    }



Re: Houseinfo problem - Rizard - 22.02.2010

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


Re: Houseinfo problem - Razvann - 22.02.2010

Same .


Re: Houseinfo problem - Razvann - 23.02.2010

Bump.

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