Szerző Téma: Házrendszer gond  (Megtekintve 415 alkalommal)

Nem elérhető Live

  • 507
    • Profil megtekintése
Házrendszer gond
« Dátum: 2013. Október 04. - 15:40:26 »
0 Show voters
Helló!
Ha beírom a /butorok parancsot elsõnek akkor még jó, de ha megint beírom a 20 slottot bõvíti és így a dialogba hozzáad még 20-at ahányszor csak megnyitom, és a fájlba is így menti el.
A második pedig, ha használva van a slot akkor is azt írja, hogy használatlan.
 

#include a_samp
#include zcmd
#include dini
#include fixchars
#include sscanf2
#include streamer
#define MAX_INGATLAN   (500)
#define MAX_BUTOR       (20)
#define DIALOG_MENU    (1000)
#define DIALOG_HASZNALT (1001)
#define DIALOG_BUTOROK    (1002)
#define DIALOG_TORLES    (1003)
enum ADATOK {
ID,
Tulaj[MAX_PLAYER_NAME+1],
Ar,
Interior,
Float:BeX,
Float:BeY,
Float:BeZ,
Float:KiX,
Float:KiY,
Float:KiZ,
Ajto,
Text3D:Infok,
Pickup,
MapIcon,
Stilus
}
enum OADATOK {
    ButorID,
    ButorAr,
    Butor[128+1]
}
new Butorok[][OADATOK] = {
//  Objekt | Ár | Bútor
{1740,150, \"Éjjeli Szekrény\"},
{1741,100, \"Kissebb Szekrény\"},
{1742,200, \"Könyvespolc\"},
{1743,150, \"Ruhás szekrény\"},
{1714,70,\"Számítógépes szék1\"},
{1806,70,\"Számítógépes szék2\"},
{1715,60,\"Fodrász szék\"},
{1716,50,\"Bárpult szék1\"},
{1805,50,\"Bárpult szék2\"},
{1720,50,\"Konyhai szék1\"},
{1739,50,\"Konyhai szék2\"},
{1735,70,\"Kényelmes szék\"},
{1746,20,\"Zsámoly\"},
{1759,40,\"Régies szék\"},
{1433,110,\"4 Személyes asztal\"},
{1827,150,\"Üvegasztal\"},
{2370,90,\"Dohányzóasztal\"},
{1432,220,\"Kerek asztal + 3 szék\"},
{1432,190,\"Sakk Asztal + 4 szék\"},
{1432,260,\"Nappali Asztal + 3 szék\"},
{1432,180,\"Ker. Asztal + 2 szék\"},
{19172,100,\"LS tengerpart festmény\"},
{19173,120,\"San Fierro híd festmény\"},
{19174,110,\"Erdõ festmény\"},
{19166,120,\"GTA Térkép\"},
{1702,310,\"Barna fotel (2 szem.)\"},
{1703,350,\"Modern kék fotel (2 szem.)\"},
{1704,290,\"Modern kék fotel (1 szem.)\"},
{1705,260,\"Barna fotel (1 szem.)\"},
{1708,250,\"Régi alakú fotel (1 szem.)\"},
{1710,400,\"Régies kanapé (4 szem.)\"},
{1764,450,\"Kockás kanapé (2 szem.)\"},
{1711,240,\"Régies fotel (1 szem.)\"},
{1712,290,\"Régies fotel (2 szem.)\"},
{1700,460,\"Francia ágy(2 szem.)\"},
{1701,450,\"Barna ágy(2 szem.)\"},
{1745,430,\"Csíkos ágy(2 szem.)\"},
{1794,450,\"Faágy (2 szem.)\"},
{1795,440,\"Dolbino ágymatrac\"},
{1796,350,\"Faágy (1 szem.)\"},
{1797,470,\"Modern ágymatrac\"},
{1799,500,\"Modern ágy (4 szem.)\"},
{1803,540,\"Francia ágy (4 szem.)\"},
{2817,50,\"Kék szõnyeg\"},
{2818,50,\"Piros-fekete kockás\"},
{2815,50,\"Lilás szõnyeg\"},
{2833,60,\"Díszes szõnyeg1\"},
{2834,40,\"Díszes szõnyeg2\"},
{2835,30,\"Tojás alakú szõ.\"},
{2836,50,\"Rácsos dísz. szõnyeg\"},
{2841,40,\"Kék Toj. szõnyeg\"},
{2842,60,\"Bordó színû szõnyeg\"},
{2847,60,\"Barna szõnyeg\"},
{1828,100,\"Párduc szõnyeg\"}
};
enum BDATA {
UjButor,
Butor[256+1],
ButorID,
Float:PosX,
Float:PosY,
Float:PosZ,
Float:PosRX,
Float:PosRY,
Float:PosRZ
}
new Ingatlan[MAX_INGATLAN][ADATOK],
Ingatlanok,
Fajl[128+1],
Sztring[256+1],
NSztring[3036+1],
ButorSlot[MAX_PLAYERS][MAX_BUTOR][bDATA],
SlotUsed[MAX_PLAYERS][MAX_BUTOR],
InteriorTimer[MAX_PLAYERS];
forward InteriorChange(playerid);
public OnFilterScriptInit() {
Ingatlanok = 0;
for(new Osszes = 0; Osszes <MAX_INGATLAN; Osszes++) { IngatlanBetoltes(Osszes); Ingatlan[Osszes][infok] = Create3DTextLabel(\"BETÖLTÉS...\", -1, Ingatlan[Osszes][beX], Ingatlan[Osszes][beY], Ingatlan[Osszes][beZ], 30, 0, 0); }
for(new i; i <MAX_BUTOR; i++) { ButorokBetoltese(i); }
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) {
if(GetPVarInt(playerid, \"Ingatlanban\") == 1) {
if(newinteriorid == 0) {
    InteriorTimer[playerid] = SetTimerEx(\"InteriorChange\",1000,true,\"i\",playerid);
}
}
return 1;
}
public InteriorChange(playerid) {
    SetSpawnInfo(playerid, 0, 0, GetPVarFloat(playerid, \"X\"), GetPVarFloat(playerid, \"Y\"), GetPVarFloat(playerid, \"Z\"), 250.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPVarInt(playerid, \"Ingatlanban\", 0);
KillTimer(InteriorTimer[playerid]);
return 1;
}
public OnPlayerConnect(playerid) {
    ButorokBetoltese(playerid);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {
case DIALOG_MENU: {
   if(response) {
      if(SlotUsed[playerid][listitem] == 1) {
         ShowPlayerDialog(playerid, DIALOG_HASZNALT, DIALOG_STYLE_LIST, \"* Lakberendezés\", \"Szerkesztés\\nTörlés\\nÖsszes bútor elmentése\", \"Választ\", \"Mégsem\");
                    SetPVarInt(playerid, \"GetSlotUsed\", listitem);
      } else {
          new string[3036+1];
          for(new i; i <sizeof(Butorok); i++) {
                format(string, sizeof(string), \"%s{FFFF99}%s - {04B404}${DDDDDD}%d\\n\", string, Butorok[butor], Butorok[butorAr]);
            }
          ShowPlayerDialog(playerid, DIALOG_BUTOROK, DIALOG_STYLE_LIST, \"* Lakberendezés\", string, \"Választ\", \"Mégsem\");
          SetPVarInt(playerid, \"GetSlotUsed\", listitem);
      }
   }
}
case DIALOG_HASZNALT: {
   if(response) {
                if(listitem == 0) {
            EditPlayerObject(playerid, ButorSlot[playerid][GetPVarInt(playerid, \"GetSlotUsed\")][ujButor]);
      }
      if(listitem == 1) {
                    DestroyPlayerObject(playerid, ButorSlot[playerid][GetPVarInt(playerid, \"GetSlotUsed\")][ujButor]);
                  SlotUsed[playerid][GetPVarInt(playerid,\"GetSlotUsed\")] = 0;
                  format(Fajl, sizeof(Fajl), \"Ingatlanok/%s.butorok\", NickName(playerid));
                  format(Sztring, sizeof(Sztring), \"SLOT%dUsed\", GetPVarInt(playerid,\"GetSlotUsed\"));
                  dini_IntSet(Fajl, Sztring, SlotUsed[playerid][GetPVarInt(playerid,\"GetSlotUsed\")]);
                  SendClientMessage(playerid, 0xFFFF99AA, \"* Bútor törölve!\");
      }
      if(listitem == 2) {
                    format(Fajl, sizeof(Fajl), \"Ingatlanok/%s.butorok\", NickName(playerid));
                    if(!dini_Exists(Fajl)) {
            dini_Create(Fajl);
            for(new i; i <MAX_BUTOR; i++) {
               if(SlotUsed[playerid] == 1) {
                   new s1[16], s2[16], s3[16], s4[16], s5[16], s6[16], s7[16], s8[16], s9[16];
                   format(s1, sizeof(s1), \"SLOT%dUsed\", i);
                   dini_IntSet(Fajl, s1, 1);
                   format(s2, sizeof(s2), \"SLOT%dName\", i);
                   dini_Set(Fajl, s2, ButorSlot[playerid][butor]);
                  format(s3, sizeof(s3), \"SLOT%dID\", i);
                  dini_IntSet(Fajl, s3, ButorSlot[playerid][butorID]);
                  format(s4, sizeof(s4), \"SLOT%dX\", i);
                  dini_FloatSet(Fajl, s4, ButorSlot[playerid][PosX]);
                  format(s5, sizeof(s5), \"SLOT%dY\", i);
                  dini_FloatSet(Fajl, s5, ButorSlot[playerid][PosY]);
                  format(s6, sizeof(s6), \"SLOT%dZ\", i);
                  dini_FloatSet(Fajl, s6, ButorSlot[playerid][PosZ]);
                  format(s7, sizeof(s7), \"SLOT%dRX\", i);
                  dini_FloatSet(Fajl, s7, ButorSlot[playerid][PosRX]);
                  format(s8, sizeof(s8), \"SLOT%dRY\", i);
                  dini_FloatSet(Fajl, s8, ButorSlot[playerid][PosRY]);
                  format(s9, sizeof(s9), \"SLOT%dRZ\", i);
                  dini_FloatSet(Fajl, s9, ButorSlot[playerid][PosRZ]);
                  
                   continue;
               }
            } SendClientMessage(playerid, 0xFFFF99AA, \"* Bútorok mentve!\");
         } else {
             for(new i; i <MAX_BUTOR; i++) {
               if(SlotUsed[playerid] == 1) {
                   new s1[16], s2[16], s3[16], s4[16], s5[16], s6[16], s7[16], s8[16], s9[16];
                   format(s1, sizeof(s1), \"SLOT%dUsed\", i);
                   dini_IntSet(Fajl, s1, 1);
                   format(s2, sizeof(s2), \"SLOT%dName\", i);
                   dini_Set(Fajl, s2, ButorSlot[playerid][butor]);
                  format(s3, sizeof(s3), \"SLOT%dID\", i);
                  dini_IntSet(Fajl, s3, ButorSlot[playerid][butorID]);
                  format(s4, sizeof(s4), \"SLOT%dX\", i);
                  dini_FloatSet(Fajl, s4, ButorSlot[playerid][PosX]);
                  format(s5, sizeof(s5), \"SLOT%dY\", i);
                  dini_FloatSet(Fajl, s5, ButorSlot[playerid][PosY]);
                  format(s6, sizeof(s6), \"SLOT%dZ\", i);
                  dini_FloatSet(Fajl, s6, ButorSlot[playerid][PosZ]);
                  format(s7, sizeof(s7), \"SLOT%dRX\", i);
                  dini_FloatSet(Fajl, s7, ButorSlot[playerid][PosRX]);
                  format(s8, sizeof(s8), \"SLOT%dRY\", i);
                  dini_FloatSet(Fajl, s8, ButorSlot[playerid][PosRY]);
                  format(s9, sizeof(s9), \"SLOT%dRZ\", i);
                  dini_FloatSet(Fajl, s9, ButorSlot[playerid][PosRZ]);
                   continue;
               }
            } SendClientMessage(playerid, 0xFFFF99AA, \"* Bútorok mentve!\");
         }
      }
   }
}
case DIALOG_BUTOROK: {
   if(response) {
                SlotUsed[playerid][GetPVarInt(playerid,\"GetSlotUsed\")] = 1;
            format(Sztring, sizeof(Sztring), \"%s\", Butorok[listitem][butor]);
            new Float:xP, Float:yP, Float:zP, Float:Angle;
            GetPlayerPos(playerid, xP, yP, zP);
      GetPlayerFacingAngle(playerid, Angle);
      xP += (2 * floatsin(-Angle, degrees));
      yP += (2 * floatcos(-Angle, degrees));
      ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][butor] = Sztring;
      ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][ujButor] = CreatePlayerObject(playerid, Butorok[listitem][butorID], xP, yP, zP, 0.0, 0.0, 0.0);
                ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][butorID] = Butorok[listitem][butorID];
                ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosX] = xP;
      ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosY] = yP;
      ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosZ] = zP;
      EditPlayerObject(playerid, ButorSlot[playerid][GetPVarInt(playerid, \"GetSlotUsed\")][ujButor]);
   }
}
}
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) {
new Float:Xa, Float:Ya, Float:Za, Float:rX, Float:rY, Float:rZ;
GetPlayerObjectPos(playerid,objectid, Xa, Ya, Za);
GetPlayerObjectRot(playerid,objectid, rX, rY, rZ);
if(response == EDIT_RESPONSE_FINAL) {
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosX] = fX;
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosY] = fY;
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosZ] = fZ;
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosRX] = fRotX;
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosRY] = fRotY;
ButorSlot[playerid][GetPVarInt(playerid,\"GetSlotUsed\")][PosRZ] = fRotZ;
format(Fajl, sizeof(Fajl), \"Ingatlanok/%s.butorok\", NickName(playerid));
        if(!dini_Exists(Fajl)) {
   dini_Create(Fajl);
   for(new i; i <MAX_BUTOR; i++) {
      if(SlotUsed[playerid] == 1) {
          new s1[16], s2[16], s3[16], s4[16], s5[16], s6[16], s7[16], s8[16], s9[16];
          format(s1, sizeof(s1), \"SLOT%dUsed\", i);
          dini_IntSet(Fajl, s1, 1);
          format(s2, sizeof(s2), \"SLOT%dName\", i);
          dini_Set(Fajl, s2, ButorSlot[playerid][butor]);
         format(s3, sizeof(s3), \"SLOT%dID\", i);
         dini_IntSet(Fajl, s3, ButorSlot[playerid][butorID]);
         format(s4, sizeof(s4), \"SLOT%dX\", i);
         dini_FloatSet(Fajl, s4, ButorSlot[playerid][PosX]);
         format(s5, sizeof(s5), \"SLOT%dY\", i);
         dini_FloatSet(Fajl, s5, ButorSlot[playerid][PosY]);
         format(s6, sizeof(s6), \"SLOT%dZ\", i);
         dini_FloatSet(Fajl, s6, ButorSlot[playerid][PosZ]);
         format(s7, sizeof(s7), \"SLOT%dRX\", i);
         dini_FloatSet(Fajl, s7, ButorSlot[playerid][PosRX]);
         format(s8, sizeof(s8), \"SLOT%dRY\", i);
         dini_FloatSet(Fajl, s8, ButorSlot[playerid][PosRY]);
         format(s9, sizeof(s9), \"SLOT%dRZ\", i);
         dini_FloatSet(Fajl, s9, ButorSlot[playerid][PosRZ]);
          continue;
      }
   } SendClientMessage(playerid, 0xFFFF99AA, \"* Bútor mentve!\");
} else {
    for(new i; i <MAX_BUTOR; i++) {
      if(SlotUsed[playerid] == 1) {
          new s1[16], s2[16], s3[16], s4[16], s5[16], s6[16], s7[16], s8[16], s9[16];
          format(s1, sizeof(s1), \"SLOT%dUsed\", i);
          dini_IntSet(Fajl, s1, 1);
          format(s2, sizeof(s2), \"SLOT%dName\", i);
          dini_Set(Fajl, s2, ButorSlot[playerid][butor]);
         format(s3, sizeof(s3), \"SLOT%dID\", i);
         dini_IntSet(Fajl, s3, ButorSlot[playerid][butorID]);
         format(s4, sizeof(s4), \"SLOT%dX\", i);
         dini_FloatSet(Fajl, s4, ButorSlot[playerid][PosX]);
         format(s5, sizeof(s5), \"SLOT%dY\", i);
         dini_FloatSet(Fajl, s5, ButorSlot[playerid][PosY]);
         format(s6, sizeof(s6), \"SLOT%dZ\", i);
         dini_FloatSet(Fajl, s6, ButorSlot[playerid][PosZ]);
         format(s7, sizeof(s7), \"SLOT%dRX\", i);
         dini_FloatSet(Fajl, s7, ButorSlot[playerid][PosRX]);
         format(s8, sizeof(s8), \"SLOT%dRY\", i);
         dini_FloatSet(Fajl, s8, ButorSlot[playerid][PosRY]);
         format(s9, sizeof(s9), \"SLOT%dRZ\", i);
         dini_FloatSet(Fajl, s9, ButorSlot[playerid][PosRZ]);
          continue;
      }
   } SendClientMessage(playerid, 0xFFFF99AA, \"* Bútor mentve!\");
}
}
}
bool:IsPlayerHaveHouseKey(playerid, id) {
if(strcmp(NickName(playerid), Ingatlan[id][Tulaj], true) == 0) return true;
    return false;
}
CMD:ujhaz(playerid, params[]) {
new Float:PozX, Float:PozY, Float:PozZ, HStilus, HID;
GetPlayerPos(playerid, PozX, PozY, PozZ);
if(sscanf(params, \"dd\", HID, HStilus)) return SendClientMessage(playerid, 0xFFFF99AA, \"Használat: /ujhaz [{DDDDDD}ID{FFFF99}] [{DDDDDD}Stílus{FFFF99}]\");
UjIngatlan(HID, PozX, PozY, PozZ, HStilus);
return 1;
}
CMD:haztorol(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(ingatlan == -1) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy elég közel a ház ikonjához!\");
IngatlanTorol(ingatlan);
return 1;
}
CMD:bemegy(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(ingatlan == -1) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy elég közel a ház ikonjához!\");
    if(Ingatlan[ingatlan][Ajto] == 0) return SendClientMessage(playerid, 0xFF4646AA, \"* Ez a ház be van zárva!\");
    SetPlayerInterior(playerid, Ingatlan[ingatlan][interior]);
SetPlayerPos(playerid, Ingatlan[ingatlan][KiX], Ingatlan[ingatlan][KiY], Ingatlan[ingatlan][KiZ]);
SetPlayerVirtualWorld(playerid, Ingatlan[ingatlan][iD]);
SetPVarInt(playerid, \"Ingatlanban\", 1);
SetPVarFloat(playerid, \"X\", Ingatlan[ingatlan][beX]);
SetPVarFloat(playerid, \"Y\", Ingatlan[ingatlan][beY]);
SetPVarFloat(playerid, \"Z\", Ingatlan[ingatlan][beZ]);
return 1;
}
CMD:kimegy(playerid, params[]) {
if(GetPVarInt(playerid, \"Ingatlanban\") == 0) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy házban!\");
SetPlayerPos(playerid, GetPVarFloat(playerid, \"X\"), GetPVarFloat(playerid, \"Y\"), GetPVarFloat(playerid, \"Z\"));
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPVarInt(playerid, \"Ingatlanban\", 0);
return 1;
}
CMD:megvesz(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(ingatlan == -1) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy elég közel a ház ikonjához!\");
if(Ingatlan[ingatlan][Ar] == 0) return SendClientMessage(playerid, 0xFF4646AA, \"* Ez a ház nem eladó!\");
if(GetPlayerMoney(playerid) < Ingatlan[ingatlan][Ar]) return SendClientMessage(playerid, 0xFF4646AA, \"* Nincs elég pénzed a ház vásárláshoz!\");
Ingatlan[ingatlan][Tulaj] = NickName(playerid);
GivePlayerMoney(playerid, -Ingatlan[ingatlan][Ar]);
Ingatlan[ingatlan][Ar] = 0;
SendClientMessage(playerid, 0xFFFF99AA, \"* Sikeresen vásároltál egy házat!\");
Delete3DTextLabel(Ingatlan[ingatlan][infok]);
DestroyDynamicPickup(Ingatlan[ingatlan][Pickup]);
DestroyDynamicMapIcon(Ingatlan[ingatlan][MapIcon]);
format(Sztring, sizeof(Sztring), \"{008ACE}%s háza\\n{DDDDDD}ID: %d\", Ingatlan[ingatlan][Tulaj], ingatlan);
Ingatlan[ingatlan][infok] = Create3DTextLabel(Sztring, -1, Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], 30, 0, 0);
Ingatlan[ingatlan][Pickup] = CreateDynamicPickup(1272, 23, Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], -1, -1, -1);
Ingatlan[ingatlan][MapIcon] = CreateDynamicMapIcon(Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], 32, 0, -1, -1, -1, 250.0);
IngatlanMent(ingatlan);
SetPVarInt(playerid, \"IngatlanID\", ingatlan);
return 1;
}
CMD:elad(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(ingatlan == -1) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy elég közel a ház ikonjához!\");
if(IsPlayerHaveHouseKey(playerid, ingatlan)) {
    if(Ingatlan[ingatlan][Ar] == 0) {
    format(Ingatlan[ingatlan][Tulaj], MAX_PLAYER_NAME+1, \"%s\", \"\");
   if(Ingatlan[ingatlan][stilus] == 1) Ingatlan[ingatlan][Ar] = 5000, GivePlayerMoney(playerid, 5000);
   if(Ingatlan[ingatlan][stilus] == 2) Ingatlan[ingatlan][Ar] = 10000, GivePlayerMoney(playerid, 10000);
   if(Ingatlan[ingatlan][stilus] == 3) Ingatlan[ingatlan][Ar] = 25000, GivePlayerMoney(playerid, 25000);
   SendClientMessage(playerid, 0xFFFF99AA, \"* Sikeresen eladtad a házad!\");
   Delete3DTextLabel(Ingatlan[ingatlan][infok]);
   DestroyDynamicPickup(Ingatlan[ingatlan][Pickup]);
   DestroyDynamicMapIcon(Ingatlan[ingatlan][MapIcon]);
   format(Sztring, sizeof(Sztring), \"{FFA600}Ez a ház eladó!\\n{DDDDDD}Ár: {04B404}${DDDDDD}%d\\nID: %d\", Ingatlan[ingatlan][Ar], ingatlan);
   Ingatlan[ingatlan][infok] = Create3DTextLabel(Sztring, -1, Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], 30, 0, 0);
   Ingatlan[ingatlan][Pickup] = CreateDynamicPickup(1273, 23, Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], -1, -1, -1);
   Ingatlan[ingatlan][MapIcon] = CreateDynamicMapIcon(Ingatlan[ingatlan][beX], Ingatlan[ingatlan][beY], Ingatlan[ingatlan][beZ], 31, 0, -1, -1, -1, 250.0);
            IngatlanMent(ingatlan);
            SetPVarInt(playerid, \"IngatlanID\", -1);
} else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
} else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
return 1;
}
CMD:hazzar(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(IsPlayerHaveHouseKey(playerid, ingatlan)) {
    if(Ingatlan[ingatlan][Ar] == 0) {
       Ingatlan[ingatlan][Ajto] = 0;
       SendClientMessage(playerid, 0xFF4646AA, \"* A házad sikeresen bezárva!\");
        } else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
} else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
return 1;
}
CMD:haznyit(playerid, params[]) {
new ingatlan = Melyik(playerid);
if(IsPlayerHaveHouseKey(playerid, ingatlan)) {
    if(Ingatlan[ingatlan][Ar] == 0) {
       Ingatlan[ingatlan][Ajto] = 1;
       SendClientMessage(playerid, 0xFF4646AA, \"* A házad sikeresen kinyitva!\");
        } else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
} else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
return 1;
}
CMD:butorok(playerid) {
    new ingatlan = Melyik2(playerid);
    if(GetPVarInt(playerid, \"Ingatlanban\") == 0) return SendClientMessage(playerid, 0xFF4646AA, \"* Nem vagy házban!\");
if(IsPlayerHaveHouseKey(playerid, ingatlan)) {
for(new i; i <MAX_BUTOR; i++) {
   if(SlotUsed[playerid] == 1) {
      format(NSztring, sizeof(NSztring), \"%s\\n{FFFF99}SLOT %d {DDDDDD}- %s\", NSztring, i, ButorSlot[playerid][butor]);
      continue;
   }
   format(NSztring, sizeof(NSztring), \"%s\\n{FFFF99}SLOT %d {DDDDDD}- Használatlan\", NSztring, i);
}
ShowPlayerDialog(playerid, DIALOG_MENU, DIALOG_STYLE_LIST, \"* Lakberendezés\", NSztring, \"Választ\", \"Mégse\");
} else { SendClientMessage(playerid, 0xFF4646AA, \"* Ez nem a Te házad!\"); }
return 1;
}
ButorokBetoltese(playerid) {
    format(Fajl, sizeof(Fajl), \"Ingatlanok/%s.butorok\", NickName(playerid));
    for(new i; i <MAX_BUTOR; i++) {
        new s1[16], s2[16], s3[16], s4[16], s5[16], s6[16], s7[16], s8[16], s9[16], ButorNev[256+1];
    format(s1, sizeof(s1), \"SLOT%dUsed\", i);
    dini_IntSet(Fajl, s1, 1);
    format(s2, sizeof(s2), \"SLOT%dName\", i);
    dini_Set(Fajl, s2, ButorSlot[playerid][butor]);
format(s3, sizeof(s3), \"SLOT%dID\", i);
dini_IntSet(Fajl, s3, ButorSlot[playerid][butorID]);
format(s4, sizeof(s4), \"SLOT%dX\", i);
dini_FloatSet(Fajl, s4, ButorSlot[playerid][PosX]);
format(s5, sizeof(s5), \"SLOT%dY\", i);
dini_FloatSet(Fajl, s5, ButorSlot[playerid][PosY]);
format(s6, sizeof(s6), \"SLOT%dZ\", i);
dini_FloatSet(Fajl, s6, ButorSlot[playerid][PosZ]);
format(s7, sizeof(s7), \"SLOT%dRX\", i);
dini_FloatSet(Fajl, s7, ButorSlot[playerid][PosRX]);
format(s8, sizeof(s8), \"SLOT%dRY\", i);
dini_FloatSet(Fajl, s8, ButorSlot[playerid][PosRY]);
format(s9, sizeof(s9), \"SLOT%dRZ\", i);
dini_FloatSet(Fajl, s9, ButorSlot[playerid][PosRZ]);
if(dini_Int(Fajl, s1) == 1) {
        SlotUsed[playerid] = 1;
   ButorNev = dini_Get(Fajl, s2);
   ButorSlot[playerid][butorID] = dini_Int(Fajl, s3);
   ButorSlot[playerid][butor] = ButorNev;
   ButorSlot[playerid][PosX] = dini_Float(Fajl, s4);
   ButorSlot[playerid][PosY] = dini_Float(Fajl, s5);
   ButorSlot[playerid][PosZ] = dini_Float(Fajl, s6);
   ButorSlot[playerid][PosRX] = dini_Float(Fajl, s7);
   ButorSlot[playerid][PosRY] = dini_Float(Fajl, s8);
   ButorSlot[playerid][PosRZ] = dini_Float(Fajl, s9);
    ButorSlot[playerid][ujButor] = CreatePlayerObject(playerid, ButorSlot[playerid][butorID], ButorSlot[playerid][PosX], ButorSlot[playerid][PosY], ButorSlot[playerid][PosZ], ButorSlot[playerid][PosRX], ButorSlot[playerid][PosRY], ButorSlot[playerid][PosRZ]);
   continue;
    }
}
}
IngatlanMent(id) {
format(Fajl, 128, \"/Ingatlanok/%d.ingatlan\", id);
if(!dini_Exists(Fajl)) return 0;
dini_Set(Fajl, \"Tulaj\", Ingatlan[id][Tulaj]);
dini_FloatSet(Fajl, \"BeX\", Ingatlan[id][beX]);
dini_FloatSet(Fajl, \"BeY\", Ingatlan[id][beY]);
dini_FloatSet(Fajl, \"BeZ\", Ingatlan[id][beZ]);
dini_IntSet(Fajl, \"Ár\", Ingatlan[id][Ar]);
dini_IntSet(Fajl, \"Ajtó\", Ingatlan[id][Ajto]);
return 1;
}
IngatlanTorol(id) {
format(Fajl, sizeof(Fajl), \"/Ingatlanok/%d.ingatlan\", id);
if(!dini_Exists(Fajl)) return 0;
dini_Remove(Fajl);
Ingatlan[id][beX] = 0;
Ingatlan[id][beY] = 0;
Ingatlan[id][beZ] = 0;
Ingatlan[id][Ar] = 0;
Ingatlan[id][Ajto] = 0;
Delete3DTextLabel(Ingatlan[id][infok]);
DestroyDynamicPickup(Ingatlan[id][Pickup]);
DestroyDynamicMapIcon(Ingatlan[id][MapIcon]);
Ingatlanok --;
printf(\"* %d ház betöltve\", Ingatlanok);
return 1;
}
UjIngatlan(id, Float:HX, Float: HY, Float: HZ, HStilus) {
    format(Fajl, sizeof(Fajl), \"/Ingatlanok/%d.ingatlan\", id);
    if(dini_Exists(Fajl)) return 0;
    dini_Create(Fajl);
    dini_Set(Fajl, \"Tulaj\", \"\");
    dini_FloatSet(Fajl, \"BeX\", HX);
    dini_FloatSet(Fajl, \"BeY\", HY);
    dini_FloatSet(Fajl, \"BeZ\", HZ);
    dini_IntSet(Fajl, \"Stílus\", HStilus);
    if(HStilus == 1) {
        dini_IntSet(Fajl, \"Ár\", 5000);
        dini_IntSet(Fajl, \"Interior\", 1);
        dini_FloatSet(Fajl, \"KiX\", 223.043991);
        dini_FloatSet(Fajl, \"KiY\", 1289.259888);
        dini_FloatSet(Fajl, \"KiZ\", 1082.199951);
    }
    if(HStilus == 2) {
dini_IntSet(Fajl, \"Ár\", 10000);
dini_IntSet(Fajl, \"Interior\", 2);
dini_FloatSet(Fajl, \"KiX\", 225.756989);
dini_FloatSet(Fajl, \"KiY\", 1240.000000);
dini_FloatSet(Fajl, \"KiZ\", 1082.149902);
    }
    if(HStilus == 3) {
dini_IntSet(Fajl, \"Ár\", 25000);
dini_IntSet(Fajl, \"Interior\", 3);
dini_FloatSet(Fajl, \"kiX\", 235.508994);
dini_FloatSet(Fajl, \"KiY\", 1189.169897);
dini_FloatSet(Fajl, \"KiZ\", 1080.339966);
    }
    dini_IntSet(Fajl, \"Ajtó\", 1);
    Ingatlan[id][iD] = id;
    Ingatlan[id][beX] = dini_Float(Fajl, \"BeX\");
    Ingatlan[id][beY] = dini_Float(Fajl, \"BeY\");
    Ingatlan[id][beZ] = dini_Float(Fajl, \"BeZ\");
    Ingatlan[id][Ar] = dini_Int(Fajl, \"Ár\");
    Ingatlan[id][KiX] = dini_Float(Fajl, \"KiX\");
    Ingatlan[id][KiY] = dini_Float(Fajl, \"KiY\");
    Ingatlan[id][KiZ] = dini_Float(Fajl, \"KiZ\");
    Ingatlan[id][stilus] = dini_Int(Fajl, \"Stílus\");
    Ingatlan[id][interior] = dini_Int(Fajl, \"Interior\");
    format(Sztring, sizeof(Sztring), \"{FFA600}Ez a ház eladó!\\n{DDDDDD}Ár: {04B404}${DDDDDD}%d\\nID: %d\", Ingatlan[id][Ar], id);
    Ingatlan[id][infok] = Create3DTextLabel(Sztring, -1, HX, HY, HZ, 30, 0, 0);
    Ingatlan[id][Pickup] = CreateDynamicPickup(1273, 23, HX, HY, HZ, -1, -1, -1);
Ingatlan[id][MapIcon] = CreateDynamicMapIcon(HX, HY, HZ, 31, 0, -1, -1, -1, 250.0);
    Ingatlanok ++;
    printf(\"* %d ház betöltve\", Ingatlanok);
return 1;
}
IngatlanBetoltes(id) {
format(Fajl, sizeof(Fajl), \"/Ingatlanok/%d.ingatlan\", id);
if(!dini_Exists(Fajl)) return 0;
Ingatlan[id][iD] = id;
format(Ingatlan[id][Tulaj], MAX_PLAYER_NAME+1, \"%s\", dini_Get(Fajl, \"Tulaj\"));
Ingatlan[id][beX] = dini_Float(Fajl, \"BeX\");
Ingatlan[id][beY] = dini_Float(Fajl, \"BeY\");
Ingatlan[id][beZ] = dini_Float(Fajl, \"BeZ\");
Ingatlan[id][Ar] = dini_Int(Fajl, \"Ár\");
Ingatlan[id][KiX] = dini_Float(Fajl, \"KiX\");
Ingatlan[id][KiY] = dini_Float(Fajl, \"KiY\");
Ingatlan[id][KiZ] = dini_Float(Fajl, \"KiZ\");
Ingatlan[id][interior] = dini_Int(Fajl, \"Interior\");
Ingatlan[id][stilus] = dini_Int(Fajl, \"Stílus\");
Ingatlan[id][Ajto] = dini_Int(Fajl, \"Ajtó\");
Delete3DTextLabel(Ingatlan[id][infok]);
if(Ingatlan[id][Ar] == 0) {
    format(Sztring, sizeof(Sztring), \"{008ACE}%s háza\\n{DDDDDD}ID: %d\", Ingatlan[id][Tulaj], id);
        Ingatlan[id][Pickup] = CreateDynamicPickup(1272, 23, Ingatlan[id][beX], Ingatlan[id][beY], Ingatlan[id][beZ], -1, -1, -1);
Ingatlan[id][MapIcon] = CreateDynamicMapIcon(Ingatlan[id][beX], Ingatlan[id][beY], Ingatlan[id][beZ], 32, 0, -1, -1, -1, 250.0);
} else {
    format(Sztring, sizeof(Sztring), \"{FFA600}Ez a ház eladó!\\n{DDDDDD}Ár: {04B404}${DDDDDD}%d\\nID: %d\", Ingatlan[id][Ar], id);
        Ingatlan[id][Pickup] = CreateDynamicPickup(1273, 23, Ingatlan[id][beX], Ingatlan[id][beY], Ingatlan[id][beZ], -1, -1, -1);
Ingatlan[id][MapIcon] = CreateDynamicMapIcon(Ingatlan[id][beX], Ingatlan[id][beY], Ingatlan[id][beZ], 31, 0, -1, -1, -1, 250.0);
}
Ingatlan[id][infok] = Create3DTextLabel(Sztring, -1, Ingatlan[id][beX], Ingatlan[id][beY], Ingatlan[id][beZ], 30, 0, 0);
Ingatlanok ++;
printf(\"* %d ház betöltve\", Ingatlanok);
return 1;
}
stock Melyik(playerid) {
for(new i; i <MAX_INGATLAN ;i++) { if(IsPlayerInRangeOfPoint(playerid, 1.0, Ingatlan[beX], Ingatlan[beY], Ingatlan[beZ])) return i; }
return -1;
}
stock Melyik2(playerid) {
for(new i; i <MAX_INGATLAN ;i++) { if(IsPlayerInRangeOfPoint(playerid, 500.0, Ingatlan[KiX], Ingatlan[KiY], Ingatlan[KiZ])) return i; }
return -1;
}
stock NickName(playerid) { new nick[24+1]; GetPlayerName(playerid, nick, sizeof(nick)); return nick; }
« Utoljára szerkesztve: 2013. Október 04. - 15:48:12 írta BnK' »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal