Szerző Téma: Betöltés hiba  (Megtekintve 846 alkalommal)

Betöltés hiba
« Dátum: 2018. November 16. - 06:58:50 »
0
 Sziasztok! Elakadtam, de érzem, hogy közel járok.
 
Arról lenne szó, hogy egy angol (letöltött) házrendszerbe próbálok belefűzni egy bútor rendszert. 
 
Minden szuper, a menü, a létrehozás, a vásárlás, a mentés...
 
Viszont a betöltés nem akar sikerülni...
 
Beillesztem ide azokat a részeket, amire szükségetek lehet. (Nem a teljes scriptet.)
 
(A betöltést a házrendszer kocsibetöltéséből próbáltam átalakítani. De sehogy se akar sikerülni...)
 
Előre is köszönöm, ha valaki segít. 
 
 
 

///Enumok
enum THouseData
{
PickupID, // Holds the pickup-id that is linked to this house
Text3D:DoorText, // Holds the reference to the 3DText above the house\'s pickup
MapIconID, // Holds the ID of the mapicon for the house
bool:Owned, // Holds true if the house is owned by somebody
Owner[24], // Holds the name of the owner of the house
HouseName[100], // Holds the name of the house (this will be displayed above the pickup near the house when it\'s owned)
Float:HouseX, // Holds the X-coordinate of the pickup for the house
Float:HouseY, // Holds the Y-coordinate of the pickup for the house
Float:HouseZ, // Holds the Z-coordinate of the pickup for the house
HouseLevel, // Holds the level of upgrades the house has, and defines which interior to use when you enter the house
HouseMaxLevel, // Holds the maximum level this house can be upgraded to
HousePrice, // Holds the price for buying the house, the same price applies when upgrading a house per level (multiplied by HouseUpgradePercent/100)
bool:HouseOpened, // Holds true if the house is open to the public (anyone can enter), false means: only the owner can enter it
bool:Insurance, // Holds \"true\" if the house has an insurance for the vehicles belonging to this house
VehicleIDs[10], // Holds the vehicle-id\'s of the vehicles linked to this house (max 10 vehicles per house)
bool:StaticHouse, // Holds \"true\" if the house is static (cannot be upgraded and has a fixed interior)
CarSlots, // Holds the amount of carslots available
//butorok
FCount,
FModel[MAX_FURNITURE],
FurnitureObj[MAX_FURNITURE],
Float:FPosX[MAX_FURNITURE],
Float:FPosY[MAX_FURNITURE],
Float:FPosZ[MAX_FURNITURE],
Float:FRotX[MAX_FURNITURE],
Float:FRotY[MAX_FURNITURE],
Float:FRotZ[MAX_FURNITURE],
Interiorja,
VirtualWorld
}
// Holds the data for all houses
new AHouseData[MAX_HOUSES][THouseData];
 
////////////////////
//Betöltés
///////////////////
Butorokbetolt(HouseID) //A gamemode betöltésénél van, ugyanígy tölti be a házakat.
{
// Setup local variables
new file[100], File:HFile, LineFromFile[100], ParameterName[50], ParameterValue[50];
    // Construct the complete filename for this house-file
format(file, sizeof(file), HouseFile, HouseID);
    // Construct the complete filename for this house-file
// Check if the HouseFile exists
if (fexist(file))
{
    // Open the housefile for reading
   HFile = fopen(file, io_read);
        // Read the first line of the file
   fread(HFile, LineFromFile);
   // Keep reading until the end of the file is found (no more data)
   // An empty line between data-segments still has the NewLine characters (\\r\\n) so it\'s not completely empty
   // Reading past the last line will read a completely empty line, therefore indicating the end of the file
 
   while (strlen(LineFromFile) > 0)
   {
      StripNewLine(LineFromFile); // Strip any newline characters from the LineFromFile
      sscanf(LineFromFile, \"s[50]s[50]\", ParameterName, ParameterValue); // Extract parametername and parametervalue
      new Float:butikao[6];
      new butikai;
      // Check if there is anything in the LineFromFile (skipping empty lines)
      if (strlen(LineFromFile) > 0)
      {
         if (strcmp(ParameterName, \"[Butor]\", false) == 0) // If the parametername is correct (\"[Vehicle]\")
         {
             // Clear all data to start a new vehicle
             for (new i; i < 6; i++)
                 butikao[i] = 0;
         }
         //majd ide
         if (strcmp(ParameterName, \"FCount\", false) == 0)
                AHouseData[HouseID][FCount] = strval(ParameterValue);
 
                if (strcmp(ParameterName, \"FModel\", false) == 0)
                butikai = strval(ParameterValue);
                if (strcmp(ParameterName, \"FPosX\", false) == 0)
                butikao[0] = floatstr(ParameterValue);
                if (strcmp(ParameterName, \"FPosY\", false) == 0)
                butikao[1] = floatstr(ParameterValue);
                if (strcmp(ParameterName, \"FPosZ\", false) == 0)
                butikao[2] = floatstr(ParameterValue);
                if (strcmp(ParameterName, \"FRotX\", false) == 0)
                butikao[3] = floatstr(ParameterValue);
                if (strcmp(ParameterName, \"FRotY\", false) == 0)
                butikao[4] = floatstr(ParameterValue);
                if (strcmp(ParameterName, \"FRotZ\", false) == 0)
                butikao[5] = floatstr(ParameterValue);
         if (strcmp(ParameterName, \"[/Butor]\", false) == 0) // If the parametername is correct (\"[/Vehicle]\")
         {
         for(new i = 0; i < AHouseData[HouseID][FCount]; i ++)
            {
            if(i != 0)
            {
                AHouseData[HouseID][FModel][i] = butikai;
                AHouseData[HouseID][FPosX][i] = butikao[0];
                AHouseData[HouseID][FPosY][i] = butikao[1];
                AHouseData[HouseID][FPosZ][i] = butikao[2];
                AHouseData[HouseID][FRotX][i] = butikao[3];
                AHouseData[HouseID][FRotY][i] = butikao[4];
                AHouseData[HouseID][FRotZ][i] = butikao[5];
                printf(\"Ebben a házban ennyi bútor lett betöltve: %d\",AHouseData[HouseID][FCount]);
                }
      }
      }
      }
            // Read the next line of the file
      fread(HFile, LineFromFile);
   }
        // Close the file
   fclose(HFile);
        // Return if the file was read correctly
   return 1;
}
else
    return 0; // Return 0 if the file couldn\'t be read (doesn\'t exist)
}
 

///////////////////////
//így néz ki a mentés fájl.
//////////////////////
Owned Yes
Owner Valaki
HouseName Valaki háza
HouseX 1478.116210
HouseY 1013.164611
HouseZ 10.869333
HouseLevel 9
HouseMaxLevel 9
HousePrice 0
HouseOpened No
Insurance No
StaticHouse Yes
CarSlots 10
FCount 6
[Butor]
FModel 0
FPosX 0.000000
FPosY 0.000000
FPosZ 0.000000
FRotX 0.000000
FRotY 0.000000
FRotZ 0.000000
[/Butor]
[Butor]
FModel 0
FPosX 0.000000
FPosY 0.000000
FPosZ 0.000000
FRotX 0.000000
FRotY 0.000000
FRotZ 0.000000
[/Butor]
[Butor]
FModel 0
FPosX 0.000000
FPosY 0.000000
FPosZ 0.000000
FRotX 0.000000
FRotY 0.000000
FRotZ 0.000000
[/Butor]
[Butor]
FModel 0
FPosX 0.000000
FPosY 0.000000
FPosZ 0.000000
FRotX 0.000000
FRotY 0.000000
FRotZ 0.000000
[/Butor]
[Butor]
FModel 0
FPosX 0.000000
FPosY 0.000000
FPosZ 0.000000
FRotX 0.000000
FRotY 0.000000
FRotZ 0.000000
[/Butor]
Ebből többszáz van, (MAX_FURNITURES), párat másoltam csak be.

 
 

Betöltés hiba
« Válasz #1 Dátum: 2018. November 16. - 07:02:12 »
0
Jah, próbálkoztam egyéb csóró megoldásokkal, de egyik se jött össze: 
 
/*
        INI_Open(file);
        //
        new key[1024];
        for (new i; i < MAX_FURNITURE; i++)
        {
            format(key, 32, \"FModel %d\", i);  AHouseData[HouseID][FModel] = INI_ReadInt(key);
            format(key, 32, \"FPosX %d\", i);  AHouseData[HouseID][FPosX]
= INI_ReadFloat(key);
            format(key, 32, \"FPosY %d\", i);  AHouseData[HouseID][FPosY]
= INI_ReadFloat(key);
            format(key, 32, \"FPosZ %d\", i);  AHouseData[HouseID][FPosZ]
= INI_ReadFloat(key);
            format(key, 32, \"FRotX %d\", i);  AHouseData[HouseID][FRotX]
= INI_ReadFloat(key);
            format(key, 32, \"FRotY %d\", i);  AHouseData[HouseID][FRotY]
= INI_ReadFloat(key);
            format(key, 32, \"FRotZ %d\", i);  AHouseData[HouseID][FRotZ]
= INI_ReadFloat(key);
            printf(\"Nalássuk: %d, %f, %f, %f, %f, %f, %f\",AHouseData[HouseID][FModel], AHouseData[HouseID][FPosX], AHouseData[HouseID][FPosY], AHouseData[HouseID][FPosZ], AHouseData[HouseID][FRotX], AHouseData[HouseID][FRotY], AHouseData[HouseID][FRotZ]);

        }



        //

        INI_Close();

*/

/*



         if (dini_Exists(file))

         {

         for(new i = 0; i < MAX_FURNITURE; i ++)

         {

         AHouseData[HouseID][FModel]
= dini_Int(file, \"FModel\");
         AHouseData[HouseID][FPosX]
= dini_Float(file, \"FPosX\");
         AHouseData[HouseID][FPosY]
= dini_Float(file, \"FPosY\");
         AHouseData[HouseID][FPosZ]
= dini_Float(file, \"FPosZ\");
         AHouseData[HouseID][FRotX]
= dini_Float(file, \"FRotX\");
         AHouseData[HouseID][FRotY]
= dini_Float(file, \"FRotY\");
         AHouseData[HouseID][FRotZ]
= dini_Float(file, \"FRotZ\");
         printf(\"Nalássuk: %d, %f, %f, %f, %f, %f, %f\",AHouseData[HouseID][FModel], AHouseData[HouseID][FPosX], AHouseData[HouseID][FPosY], AHouseData[HouseID][FPosZ], AHouseData[HouseID][FRotX], AHouseData[HouseID][FRotY], AHouseData[HouseID][FRotZ]);

         }

         }



*/

Nem elérhető Kovacs_Richard

  • 1743
  • HRP Fejlesztő
  • Discord: Kovacs_Richard#0321
    • Profil megtekintése
    • Hun Role Play Web
Betöltés hiba
« Válasz #2 Dátum: 2018. November 16. - 07:20:04 »
0
kellene egy ilyen config fájl is, hogy könnyebb legyen a hibát keresni
 
amúgy a helyedben a bútorokat külön kiszervezném és külön lenne kezelve, persze akár mellette tárolhatod, hogy mi kapcsolódik ide
Régóta nem tevékenykedem, mint SA-MP scripter.
HRP Fejlesztő.

Betöltés hiba
« Válasz #3 Dátum: 2018. November 16. - 11:23:47 »
0
Hát sajnos a log fájlban semmi hibát nem jelez

Nem elérhető Kovacs_Richard

  • 1743
  • HRP Fejlesztő
  • Discord: Kovacs_Richard#0321
    • Profil megtekintése
    • Hun Role Play Web
Betöltés hiba
« Válasz #4 Dátum: 2018. November 16. - 12:48:50 »
0
nem log, hanem config
 
egy ilyen ház fájlja
Régóta nem tevékenykedem, mint SA-MP scripter.
HRP Fejlesztő.

Nem elérhető kos

  • 292
    • Profil megtekintése
Betöltés hiba
« Válasz #5 Dátum: 2019. Január 03. - 04:33:11 »
0
mind szép és jó de mentő része hol van? :D betöltő oké meg h meg van, de a mentésnél is lehet a gipszer, mert ebbe szerintem nincs ránézésre.
 
for (new i; i < MAX_FURNITURE; i++)
        {Butorokbetolt(i);}
« Utoljára szerkesztve: 2019. Január 03. - 06:25:35 írta kos »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal