SA-MP Forums Archive
Problem with Housesystem. - 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: Problem with Housesystem. (/showthread.php?tid=109811)



Problem with Housesystem. - Justsmile - 22.11.2009

I can only buy the first one, second one not, why?

pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            new Float:oldposx, Float:oldposy, Float:oldposz;
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
                if(PlayerToPoint(1.0, playerid, HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ]))
                {
                  if(HouseInfo[h][hOwned] == 1) { return SendClientMessage(playerid, COLOR_GREY,"Dieses Haus kannst du nicht kaufen."); }
                    if(PlayerMoney[playerid] > HouseInfo[h][hValue])
                    {
                        HouseInfo[h][hOwned] = 1;
                        AccountInfo[playerid][aHouseKey] = HouseInfo[h][hNumber];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerMoney[playerid] = PlayerMoney[playerid]-HouseInfo[h][hValue];
                        GameTextForPlayer(playerid, "~w~Herrzlichen Glьckwunsch zu deinem neuen Erwerb!", 5000, 3);
                        SendClientMessage(playerid, COLOR_GRAD, "Glьckwunsch, du hast dir ein Haus gekauft !");
                        SendClientMessage(playerid, COLOR_WHITE, "Tippe /myhouse um die neuen Funktionen zu sehen !");
                        OnHouseUpdate();
                        OnPlayerAccountUpdate(playerid);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "  Du hast nicht genug Geld !");
                        return 1;
                    }
                }
                else
                {
                  SendClientMessage(playerid, COLOR_GREY,"Du bist nicht an einem Haus.");
                  return 1;
            }
            }
        }
        return 1;
    }

if(strcmp(cmd, "/exit", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < sizeof(HouseInfo); i++)
            {
                if (PlayerToPoint(5.0, playerid,HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ])) //&& (GetPlayerVirtualWorld(playerid) == HouseInfo[i][hVWorld]))
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid,HouseInfo[i][hEntranceX],HouseInfo[i][hEntranceY],HouseInfo[i][hEntranceZ]);
                    SetPlayerVirtualWorld(playerid, 0);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD, " Du bist nicht am Ausgang. ");
                    return 1;
                }
            }
        }//not connected
        return 1;
    }
enum hHouse
{
    hNumber,
    hOwner[128],
    Float:hEntranceX,
    Float:hEntranceY,
    Float:hEntranceZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hVWorld,
    hInt,
    hLock,
    hVeh,
    hBank,
    hRent,
    hRenter,
    hHeal,
    hArmor,
    hOwned,
    hRentAble,
    hValue,
    hCity,
};
new HouseInfo[7][hHouse];
Loaded successfully. But can only buy first house, i can enter second house but can't get out.