House System not work corectly
#1

i got problem when i buy house it shows everything good but when i restart it show like the house is not bought

PHP код:
#define HPATH "/houses/%i.ini" 
define


PHP код:
for(new idz 1idz sizeof(HouseInfo); idz++)
    {
        
format(stringsizeof(string), HPATHidz);
        
INI_ParseFile(string"loadhouse_%s", .bExtra true, .extra idz );
        if(
HouseInfo[idz][hOwned] == 0)
        {
            
format(string,sizeof(string),""COL_BROWN"Vlasnik: "COL_WHITE"Nitko\n"COL_BROWN"Cijena: "COL_WHITE"$%d\n"COL_BROWN"Kucni Broj: "COL_WHITE"%d"HouseInfo[idz][hPrice], idz);
            
HouseInfo[idz][hDLabel] = Create3DTextLabel(string0xFFFFFFHouseInfo[idz][hEntranceX],HouseInfo[idz][hEntranceY],HouseInfo[idz][hEntranceZ], 10.000);
            
HouseInfo[idz][hOutsideIcon] = CreateDynamicPickup(12731HouseInfo[idz][hEntranceX], HouseInfo[idz][hEntranceY], HouseInfo[idz][hEntranceZ], HouseInfo[idz][hWorld]);
        }
         else if(
HouseInfo[idz][hOwned] == 1)
        {
            
format(string,sizeof(string),""COL_BROWN"Vlasnik: "COL_WHITE"%s\n"COL_BROWN"Kucni Broj: "COL_WHITE"%d"HouseInfo[idz][hOwner], idz);
            
HouseInfo[idz][hDLabel] = Create3DTextLabel(string0xFFFFFF,  HouseInfo[idz][hEntranceX],HouseInfo[idz][hEntranceY], HouseInfo[idz][hEntranceZ], 10.000);
            
HouseInfo[idz][hOutsideIcon] = CreateDynamicPickup(12721HouseInfo[idz][hEntranceX], HouseInfo[idz][hEntranceY], HouseInfo[idz][hEntranceZ], HouseInfo[idz][hWorld]);
        }
    } 
that is in ongamemode init

PHP код:
forward loadhouse_data(idxname[], value[]);
public 
loadhouse_data(idxname[], value[])
{
    
INI_Int("hOwned"HouseInfo[idx][hOwned]);
    
INI_Int("hPrice"HouseInfo[idx][hPrice]);
    
INI_String("hOwner"HouseInfo[idx][hOwner], 24);
    
INI_Int("hLocked"HouseInfo[idx][hLocked]);
    
INI_Int("hMoney"HouseInfo[idx][hMoney]);
    
INI_Float("hEntranceX"HouseInfo[idx][hEntranceX]);
    
INI_Float("hEntranceY"HouseInfo[idx][hEntranceY]);
    
INI_Float("hEntranceZ"HouseInfo[idx][hEntranceZ]);
    
INI_Float("hEntranceA"HouseInfo[idx][hEntranceA]);
    
INI_Float("hExitX"HouseInfo[idx][hExitX]);
    
INI_Float("hExitY"HouseInfo[idx][hExitY]);
    
INI_Float("hExitZ"HouseInfo[idx][hExitZ]);
    
INI_Float("hExitA"HouseInfo[idx][hExitA]);
    
INI_Int("hInt"HouseInfo[idx][hInt]);
    
INI_Int("hWorld"HouseInfo[idx][hWorld]);
    
INI_Int("hInsideInt"HouseInfo[idx][hInsideInt]);
    
INI_Int("hInsideWorld"HouseInfo[idx][hInsideWorld]);
    return 
1;

forward

PHP код:
for(new idz 1idz sizeof(HouseInfo); idz++)
    {
        new 
file4[40];
        
format(file4sizeof(file4), HPATHidz);
        new 
INI:File INI_Open(file4);
        
INI_SetTag(File,"data");
        
INI_WriteInt(File,"hOwned"HouseInfo[idz][hOwned]);
        
INI_WriteInt(File,"hPrice"HouseInfo[idz][hPrice]);
        
INI_WriteString(File,"hOwner"HouseInfo[idz][hOwner]);
        
INI_WriteInt(File,"hLocked"HouseInfo[idz][hLocked]);
        
INI_WriteInt(File,"hMoney"HouseInfo[idz][hMoney]);
        
INI_WriteFloat(File,"hEntranceX"HouseInfo[idz][hEntranceX]);
        
INI_WriteFloat(File,"hEntranceY"HouseInfo[idz][hEntranceY]);
        
INI_WriteFloat(File,"hEntranceZ"HouseInfo[idz][hEntranceZ]);
        
INI_WriteFloat(File,"hEntranceA"HouseInfo[idz][hEntranceA]);
        
INI_WriteFloat(File,"hExitX"HouseInfo[idz][hExitX]);
        
INI_WriteFloat(File,"hExitY"HouseInfo[idz][hExitY]);
        
INI_WriteFloat(File,"hExitZ"HouseInfo[idz][hExitZ]);
        
INI_WriteFloat(File,"hExitA"HouseInfo[idz][hExitA]);
        
INI_WriteInt(File,"hInt"HouseInfo[idz][hInt]);
        
INI_WriteInt(File,"hWorld"HouseInfo[idz][hWorld]);
        
INI_WriteInt(File,"hInsideInt"HouseInfo[idz][hInsideInt]);
        
INI_WriteInt(File,"hInsideWorld"HouseInfo[idz][hInsideWorld]);
        
INI_Close(File);
    } 
ongamemodeexit


please help i dont know whats worng
Reply
#2

i think that forward is never used...
Reply
#3

first, is the data saved currently ?
if yes then its the loading part that is the problem..
cant say nothing with this amount of info.
Reply
#4

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
first, is the data saved currently ?
if yes then its the loading part that is the problem..
cant say nothing with this amount of info.
in 71.ini (my house id is 71)

PHP код:
[data]
hOwned 1
hPrice 
220000
hOwner 
Sergio Logan
hLocked 
0
hMoney 
0
hEntranceX 
= -2597.398437
hEntranceY 
2364.701660
hEntranceZ 
9.882994
hEntranceA 
267.706420
hExitX 
225.756988
hExitY 
1240.000000
hExitZ 
1082.149902
hExitA 
0.000000
hInt 
0
hWorld 
0
hInsideInt 
2
hInsideWorld 
71 
what else you need?
Reply
#5

then the loading is the probem,you can load them like this:
pawn Код:
format(file,sizeof(file),"/houses/%d.ini",IDs);
INI_ParseFile(file, "LoadHouse", false, true, IDs, true, false );
forward LoadHouse(IDs, name[], value[]);
public LoadHouse(IDs, name[], value[])
{
      //so on..
}
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
then the loading is the probem,you can load them like this:
pawn Код:
format(file,sizeof(file),"/houses/%d.ini",IDs);
INI_ParseFile(file, "LoadHouse", false, true, IDs, true, false );
forward LoadHouse(IDs, name[], value[]);
public LoadHouse(IDs, name[], value[])
{
      //so on..
}
should just

PHP код:
format(stringsizeof(string), HPATHidz);
        
INI_ParseFile(string"loadhouse_%s", .bExtra true, .extra idz ); 
loadhouse_%s be loadhouse_data except of %s? wtf even that %s stands for in this

PHP код:
format(stringsizeof(string), HPATHidz);
        
INI_ParseFile(string"loadhouse_%s", .bExtra true, .extra idz ); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)