Dini => ini problem
#9

Quote:
Originally Posted by Mivco
Посмотреть сообщение
Thanks, I do not want to go to SQlite...


Do you think this code is well done? When I put it in y_ini.

PHP код:
stock CreateHouse(Float:HX,Float:HY,Float:HZ,CENA)
{
    
HouseCount++;
    if(
HouseCount MAX_HOUSES)
    {
        print(
"MAX. Počet domov bol prekročenэ. Server bol vypnutэ !");
        
SendRconCommand("exit");
    }
    
HouseInfo[HouseCount][p_X] = HX;
    
HouseInfo[HouseCount][p_Y] = HY;
    
HouseInfo[HouseCount][p_Z] = HZ;
    
HouseInfo[HouseCount][Cena]= CENA;
    
HouseInfo[HouseCount][VW]  = HouseCount;
    new 
s[100];
    
format(s,100,"Houses/House%d.txt",HouseCount);
    if(!
fexist(s))
    {
        new 
INI:File INI_Open(s));
        
INI_WriteInt(File,"Owner","none");
        
INI_WriteInt(File,"Pass","none");
        
INI_WriteInt(File,"Locked",false);
        
INI_WriteInt(File,"Interior",3);
        
INI_WriteInt(File,"Money",0);
        
INI_WriteInt(File,"Camera",0);
        
INI_WriteInt(File,"Dog",0);
        
INI_WriteInt(File,"TermoSenzor",0);
        
INI_WriteInt(File,"WalkSenzor",0);
        
INI_WriteInt(File,"StrongDoors",0);
        
        new 
asdf[15];
        for(new 
i;<= MAX_WEAPON_SLOT;i++)
        {
            
format(asdf,10,"Weapon%d",i);
            
INI_WriteInt(File,asdf,0);
            
format(asdf,15,"WeaponAmmo%d",i);
            
INI_WriteInt(File,asdf,0);
        }
        for(new 
i;<= MAX_SKIN_SLOT;i++)
        {
            
format(asdf,10,"Skin%d",i);
            
INI_WriteInt(File,asdf,-1);
        }
        
INI_Close(File);
    }
    
HouseInfo[HouseCount][IntTyp] = INI_String(s,"Interior");
    
HouseInfo[HouseCount][HousePick] = CreatePickup(1277,1,HouseInterior[HouseInfo[HouseCount][IntTyp]][P_X],HouseInterior[HouseInfo[HouseCount][IntTyp]][P_Y],HouseInterior[HouseInfo[HouseCount][IntTyp]][P_Z],HouseInfo[HouseCount][VW]);
    
format(HouseInfo[HouseCount][Password],32,INI_String(s,"Pass"));
    new 
asdf[15];
    for(new 
i;MAX_WEAPON_SLOT;i++)
    {
        
format(asdf,10,"Weapon%d",i);
        
HouseInfo[HouseCount][Weapon][i] = INI_String(s,asdf);
        
format(asdf,15,"WeaponAmmo%d",i);
        
HouseInfo[HouseCount][Ammo][i] = INI_String(s,asdf);
    }
    for(new 
i;MAX_SKIN_SLOT;i++)
    {
        
format(asdf,10,"Skin%d",i);
        
HouseInfo[HouseCount][Skins][i] = INI_String(s,asdf);
    }
    new 
sx[200];
    if(
IsHouseForSale(HouseCount))
    {
        
format(HouseInfo[HouseCount][Owner],MAX_PLAYER_NAME,"Nikto");
        
HouseInfo[HouseCount][Zamek] = false;
        
HouseInfo[HouseCount][Pickup] = CreatePickup(1273,1,HXHYHZ);
        
format(sx,200,"{FFFFFF}Dom {0000FF}č.%d\r\n{FFFFFF}Majiteľ: {0000FF}Nikto\r\n{FFFFFF}Cena: {0000FF}%d",HouseCount,CENA);
        
HouseInfo[HouseCount][Text] = Create3DTextLabel(sx,0xFF0000FF,HX,HY,HZ+1,50,0);
        }else{
    if(
INI_String(s,"Locked")) HouseInfo[HouseCount][Zamek] = true;
    else 
HouseInfo[HouseCount][Zamek]=false;
    
HouseInfo[HouseCount][Pickup] = CreatePickup(1272,1,HXHYHZ);
    
format(HouseInfo[HouseCount][Owner],MAX_PLAYER_NAME,"%s",dini_Get(s,"Owner"));
    
format(sx,200,"{FFFFFF}Dom {0000FF}\tč.%d\r\n{FFFFFF}Majiteľ: {0000FF}\t%s\r\n{FFFFFF}Park. miest: {0000FF}\t%d\r\n{FFFFFF}Locked: {0000FF}\t%s",HouseCount,HouseInfo[HouseCount][Owner],HouseInfo[HouseCount][CarSlots]+1,YesNo(HouseInfo[HouseCount][Zamek]));
    
HouseInfo[HouseCount][Text] = Create3DTextLabel(sx,0xFF0000FF,HX,HY,HZ+1,50,0);
    }
    return 
HouseCount;

I didn’t completely look over your code there but I did spot an issue right off the bat.

PHP код:
INI_WriteInt(File,"Owner","none"); 
INI_WriteInt(File,"Pass","none"); 
Those are not integers, they’re suppose to be written as strings:

PHP код:
INI_WriteString(File,"Owner","none"); 
INI_WriteString(File,"Pass","none"); 
I’d suggest going over your code and looking for small mistakes like this.
Reply


Messages In This Thread
Dini => ini problem - by Mivco - 12.11.2017, 17:41
Re: Dini => ini problem - by Mivco - 12.11.2017, 18:37
Re: Dini => ini problem - by Gammix - 12.11.2017, 20:28
Re: Dini => ini problem - by Lucases - 12.11.2017, 20:49
Re: Dini => ini problem - by cuber - 12.11.2017, 20:51
Re: Dini => ini problem - by Lucases - 12.11.2017, 20:52
Re: Dini => ini problem - by cuber - 12.11.2017, 20:53
Re: Dini => ini problem - by Mivco - 12.11.2017, 20:58
Re: Dini => ini problem - by CantBeJohn - 13.11.2017, 08:34
Re: Dini => ini problem - by Mivco - 13.11.2017, 09:44

Forum Jump:


Users browsing this thread: 3 Guest(s)