Szerző Téma: házrendszer  (Megtekintve 397 alkalommal)

quer

  • Vendég
házrendszer
« Dátum: 2012. Április 07. - 23:25:37 »
0 Show voters
Hali!
Tudna segíteni valaki hogy mi nem jó ebbe?
 
   if(strcmp(cmd, \"/épít\", true) == 0)
{
if(PlayerInfo[playerid][pJob] == 5 || Admin(playerid, 3))
{
       new ureshaz = UresHazKereses();
       if(ureshaz == -1)
       {
      format(string, sizeof(string), \"Max %d a megengedett ház!\", sizeof(HouseInfo));
      SendClientMessage(playerid, COLOR_RED, string);
      return 1;
   }
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp))
   {
      SendClientMessage(playerid, COLOR_GRAD2, \"HASZNÁLAT: /épít [JátékosID/NévRészlet] [interior id (1-4)]\");
      return 1;
   }
   new plo;
   plo = ReturnUser(tmp);
   if(PlayerInfo[plo][pPhousekey] > 255)
   {
      SendClientMessage(playerid, COLOR_WHITE, \"Az illetõnek már van háza!\");
      return 1;
   }
   new x_job[128];
   x_job = strtok(cmdtext, idx);
   if(!strlen(x_job))
   {
      SendClientMessage(playerid, COLOR_WHITE, \"HASZNÁLAT: /épít [JátékosID/NévRészlet] [interior id (1-4)]\");
      return 1;
   }
   new nev[MAX_PLAYER_NAME];
   GetPlayerName(playerid, nev, sizeof(nev));
   new nev2[MAX_PLAYER_NAME];
   GetPlayerName(plo, nev2, sizeof(nev2));
   if(strcmp(x_job,\"1\",true) == 0)
   {
       if(PlayerInfo[playerid][Penz] >= 100000)
       {
          new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid,X,Y,Z);
         PlayerInfo[plo][pPhousekey] = ureshaz;
         HouseInfo[ureshaz][hEntrancex] = X;
         HouseInfo[ureshaz][hEntrancey] = Y;
         HouseInfo[ureshaz][hEntrancez] = Z;
         HouseInfo[ureshaz][hExitx] = 271.884979;
         HouseInfo[ureshaz][hExity] = 306.631988;
         HouseInfo[ureshaz][hExitz] = 999.148437;
         HouseInfo[ureshaz][hValue] = 100000;
         HouseInfo[ureshaz][hOwner] = nev2;
         HouseInfo[ureshaz][hInt] = 2;
         HouseInfo[ureshaz][Van] = 1;
         HouseInfo[ureshaz][hOwned] = 1;
         format(string,sizeof(string),\"<< %s új házat épített. A Ház bejárata: %d to %f - %f - %f ára: %d >>\",nev,ureshaz,X,Y,Z,HouseInfo[ureshaz][hValue]);
                  SendTAdminMessage(COLOR_TULAJ,string);
                   PlayerInfo[playerid][Penz] -= 100000;
         SafeGivePlayerMoney(playerid, -100000);
         varoskassza += 100000;
         Savevaroskassza();
         SaveProperty();
         for(new h = 0; h < sizeof(HouseInfo); h++)
         {
            if(HouseInfo[h][hOwned] == 0)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
               format(stringx, sizeof(stringx), \"Ez a ház eladó!\\n Ára %d$\\n (( /házvesz ))\",HouseInfo[h][hValue]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],25,0,1);
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
            if(HouseInfo[h][hOwned] == 1)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
                format(stringx, sizeof(stringx), \"A ház tulajdonosa:\\n %s\",HouseInfo[h][hOwner]);
               haztulaj = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],35,0,1);
               /*format(string1, sizeof(string), \"[OWNED BY]\\n%s\",HouseInfo[h][hOwner]);
               Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);*/
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
         }
      }
      else
      {
          SendClientMessage(playerid, COLOR_WHITE, \"Nincs elég pénzed! (100.000$)\");
      }
   }
   if(strcmp(x_job,\"2\",true) == 0)
   {
       if(PlayerInfo[playerid][Penz] >= 150000)
       {
             new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid,X,Y,Z);
                  PlayerInfo[plo][pPhousekey] = ureshaz;
         HouseInfo[ureshaz][hEntrancex] = X;
         HouseInfo[ureshaz][hEntrancey] = Y;
         HouseInfo[ureshaz][hEntrancez] = Z;
         HouseInfo[ureshaz][hExitx] = 2233.6057;
         HouseInfo[ureshaz][hExity] = -1111.7039;
         HouseInfo[ureshaz][hExitz] = 1050.8828;
         HouseInfo[ureshaz][hValue] = 150000;
         HouseInfo[ureshaz][hOwner] = nev2;
         HouseInfo[ureshaz][hInt] = 5;
         HouseInfo[ureshaz][Van] = 1;
         HouseInfo[ureshaz][hOwned] = 1;
         format(string,sizeof(string),\"<< %s új házat épített. A Ház bejárata: %d to %f - %f - %f ára: %d >>\",nev,ureshaz,X,Y,Z,HouseInfo[ureshaz][hValue]);
                  SendTAdminMessage(COLOR_TULAJ,string);
                   PlayerInfo[playerid][Penz] -= 150000;
         SafeGivePlayerMoney(playerid, -150000);
         varoskassza += 150000;
         Savevaroskassza();
         SaveProperty();
         for(new h = 0; h < sizeof(HouseInfo); h++)
         {
            if(HouseInfo[h][hOwned] == 0)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
               format(stringx, sizeof(stringx), \"Ez a ház eladó!\\n Ára %d$\\n (( /házvesz ))\",HouseInfo[h][hValue]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],25,0,1);
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
            if(HouseInfo[h][hOwned] == 1)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
                format(stringx, sizeof(stringx), \"A ház tulajdonosa:\\n %s\",HouseInfo[h][hOwner]);
               haztulaj = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],35,0,1);
               /*format(string1, sizeof(string), \"[OWNED BY]\\n%s\",HouseInfo[h][hOwner]);
               Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);*/
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
         }
      }
      else
      {
          SendClientMessage(playerid, COLOR_WHITE, \"Nincs elég pénzed! (150.000$)\");
      }
   }
   if(strcmp(x_job,\"3\",true) == 0)
   {
       if(PlayerInfo[playerid][Penz] >= 200000)
       {
          new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid,X,Y,Z);
                  PlayerInfo[plo][pPhousekey] = ureshaz;
         HouseInfo[ureshaz][hEntrancex] = X;
         HouseInfo[ureshaz][hEntrancey] = Y;
         HouseInfo[ureshaz][hEntrancez] = Z;
         HouseInfo[ureshaz][hExitx] = 2214.8909;
         HouseInfo[ureshaz][hExity] = -1076.0967;
         HouseInfo[ureshaz][hExitz] = 1050.4844;
         HouseInfo[ureshaz][hValue] = 200000;
         HouseInfo[ureshaz][hOwner] = nev2;
         HouseInfo[ureshaz][hInt] = 1;
         HouseInfo[ureshaz][Van] = 1;
         HouseInfo[ureshaz][hOwned] = 1;
         format(string,sizeof(string),\"<< %s új házat épített. A Ház bejárata: %d to %f - %f - %f ára: %d >>\",nev,ureshaz,X,Y,Z,HouseInfo[ureshaz][hValue]);
                  SendTAdminMessage(COLOR_TULAJ,string);
                   PlayerInfo[playerid][Penz] -= 200000;
         SafeGivePlayerMoney(playerid, -200000);
         varoskassza += 200000;
         Savevaroskassza();
         SaveProperty();
         for(new h = 0; h < sizeof(HouseInfo); h++)
         {
            if(HouseInfo[h][hOwned] == 0)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
               format(stringx, sizeof(stringx), \"Ez a ház eladó!\\n Ára %d$\\n (( /házvesz ))\",HouseInfo[h][hValue]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],25,0,1);
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
            if(HouseInfo[h][hOwned] == 1)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
                format(stringx, sizeof(stringx), \"A ház tulajdonosa:\\n %s\",HouseInfo[h][hOwner]);
               haztulaj = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],35,0,1);
               /*format(string1, sizeof(string), \"[OWNED BY]\\n%s\",HouseInfo[h][hOwner]);
               Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);*/
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
         }
      }
      else
      {
          SendClientMessage(playerid, COLOR_WHITE, \"Nincs elég pénzed! (200.000$)\");
      }
   }
   if(strcmp(x_job,\"4\",true) == 0)
   {
       if(PlayerInfo[playerid][Penz] >= 250000)
       {
          new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid,X,Y,Z);
                  PlayerInfo[plo][pPhousekey] = ureshaz;
         HouseInfo[ureshaz][hEntrancex] = X;
         HouseInfo[ureshaz][hEntrancey] = Y;
         HouseInfo[ureshaz][hEntrancez] = Z;
         HouseInfo[ureshaz][hExitx] = 2324.419921;
         HouseInfo[ureshaz][hExity] = -1145.568359;
         HouseInfo[ureshaz][hExitz] = 1050.710083;
         HouseInfo[ureshaz][hValue] = 250000;
         HouseInfo[ureshaz][hOwner] = nev2;
         HouseInfo[ureshaz][hInt] = 12;
         HouseInfo[ureshaz][Van] = 1;
         HouseInfo[ureshaz][hOwned] = 1;
         format(string,sizeof(string),\"<< %s új házat épített. A Ház bejárata: %d to %f - %f - %f ára: %d >>\",nev,ureshaz,X,Y,Z,HouseInfo[ureshaz][hValue]);
                  SendTAdminMessage(COLOR_TULAJ,string);
                   PlayerInfo[playerid][Penz] -= 250000;
         SafeGivePlayerMoney(playerid, -250000);
         varoskassza += 250000;
         Savevaroskassza();
         SaveProperty();
         for(new h = 0; h < sizeof(HouseInfo); h++)
         {
            if(HouseInfo[h][hOwned] == 0)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
               format(stringx, sizeof(stringx), \"Ez a ház eladó!\\n Ára %d$\\n (( /házvesz ))\",HouseInfo[h][hValue]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],25,0,1);
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
            if(HouseInfo[h][hOwned] == 1)
            {
                format(stringx, sizeof(stringx), \"(( A ház idje: %d ))\",HouseInfo[h][hWorld]);
               hazelado = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+0.5,25,0,1);
                format(stringx, sizeof(stringx), \"A ház tulajdonosa:\\n %s\",HouseInfo[h][hOwner]);
               haztulaj = Create3DTextLabel(stringx,0xFFFF00AA,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],35,0,1);
               /*format(string1, sizeof(string), \"[OWNED BY]\\n%s\",HouseInfo[h][hOwner]);
               Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);*/
               AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
               pickups++;
            }
         }
      }
      else
      {
          SendClientMessage(playerid, COLOR_WHITE, \"Nincs elég pénzed! (250.000$)\");
      }
   }
}
else
{
   SendClientMessage(playerid,COLOR_GRAD2,\"Nem vagy építész!\");
}
    return 1;
}

 

public LoadProperty()
{
new arrCoords[31][64];
new strFromFile2[256];
new File: file = fopen(\"cfg-k/hazak.cfg\", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
   fread(file, strFromFile2);
   split(strFromFile2, arrCoords, \',\');
   HouseInfo[idx][hEntrancex] = floatstr(arrCoords[0]);
   HouseInfo[idx][hEntrancey] = floatstr(arrCoords[1]);
   HouseInfo[idx][hEntrancez] = floatstr(arrCoords[2]);
   HouseInfo[idx][hExitx] = floatstr(arrCoords[3]);
   HouseInfo[idx][hExity] = floatstr(arrCoords[4]);
   HouseInfo[idx][hExitz] = floatstr(arrCoords[5]);
   HouseInfo[idx][hHealthx] = strval(arrCoords[6]);
   HouseInfo[idx][hHealthy] = strval(arrCoords[7]);
   HouseInfo[idx][hHealthz] = strval(arrCoords[8]);
   HouseInfo[idx][hArmourx] = strval(arrCoords[9]);
   HouseInfo[idx][hArmoury] = strval(arrCoords[10]);
   HouseInfo[idx][hArmourz] = strval(arrCoords[11]);
   //printf(\"HouseInfo hEntrancez %f\",HouseInfo[idx][hEntrancez]);
   strmid(HouseInfo[idx][hOwner], arrCoords[12], 0, strlen(arrCoords[12]), 255);
   strmid(HouseInfo[idx][hDiscription], arrCoords[13], 0, strlen(arrCoords[13]), 255);
   HouseInfo[idx][hValue] = strval(arrCoords[14]);
   HouseInfo[idx][hHel] = strval(arrCoords[15]);
   HouseInfo[idx][hArm] = strval(arrCoords[16]);
   HouseInfo[idx][hInt] = strval(arrCoords[17]);
   HouseInfo[idx][hLock] = strval(arrCoords[18]);
   HouseInfo[idx][hOwned] = strval(arrCoords[19]);
   HouseInfo[idx][hRooms] = strval(arrCoords[20]);
   HouseInfo[idx][hRent] = strval(arrCoords[21]);
   HouseInfo[idx][hRentabil] = strval(arrCoords[22]);
   HouseInfo[idx][hTakings] = strval(arrCoords[23]);
   HouseInfo[idx][hVec] = strval(arrCoords[24]);
             if(HouseInfo[idx][hVec] == 457)
   {
      HouseInfo[idx][hVec] = 411;
   }
   HouseInfo[idx][hVcol1] = strval(arrCoords[25]);
   HouseInfo[idx][hVcol2] = strval(arrCoords[26]);
   HouseInfo[idx][hDate] = strval(arrCoords[27]);
   HouseInfo[idx][hLevel] = strval(arrCoords[28]);
   HouseInfo[idx][hWorld] = strval(arrCoords[29]);
   HouseInfo[idx][Van] = strval(arrCoords[30]);
   printf(\"HazID: %d Tulaj: %s %s\",idx,HouseInfo[idx][hOwner],HouseInfo[idx][hDiscription]);
   idx++;
}
fclose(file);
}
return 1;
}
public SaveProperty()
{
new idx;
new File: file2;
while (idx < sizeof(HouseInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), \"%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%d,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\\n\",
HouseInfo[idx][hEntrancex],
HouseInfo[idx][hEntrancey],
HouseInfo[idx][hEntrancez],
HouseInfo[idx][hExitx],
HouseInfo[idx][hExity],
HouseInfo[idx][hExitz],
HouseInfo[idx][hHealthx],
HouseInfo[idx][hHealthy],
HouseInfo[idx][hHealthz],
HouseInfo[idx][hArmourx],
HouseInfo[idx][hArmoury],
HouseInfo[idx][hArmourz],
HouseInfo[idx][hOwner],
HouseInfo[idx][hDiscription],
HouseInfo[idx][hValue],
HouseInfo[idx][hHel],
HouseInfo[idx][hArm],
HouseInfo[idx][hInt],
HouseInfo[idx][hLock],
HouseInfo[idx][hOwned],
HouseInfo[idx][hRooms],
HouseInfo[idx][hRent],
HouseInfo[idx][hRentabil],
HouseInfo[idx][hTakings],
HouseInfo[idx][hVec],
HouseInfo[idx][hVcol1],
HouseInfo[idx][hVcol2],
HouseInfo[idx][hDate],
HouseInfo[idx][hLevel],
HouseInfo[idx][hWorld],
HouseInfo[idx][Van]);
HouseInfo[idx][hWorld] = idx;
if(idx == 0)
{
   file2 = fopen(\"cfg-k/hazak.cfg\", io_write);
}
else
{
   file2 = fopen(\"cfg-k/hazak.cfg\", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
« Utoljára szerkesztve: 2012. Április 07. - 23:29:21 írta quer »

házrendszer
« Válasz #1 Dátum: 2012. Április 07. - 23:26:52 »
0 Show voters
[mod]CODE vagy PAWN tageket használd,ne a samp szerver beillesztõt. Topic szerkesztve.[/mod]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal