SA-MP Forums Archive
INI_ParseFile - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: INI_ParseFile (/showthread.php?tid=302754)



INI_ParseFile - Speed - 10.12.2011

I have problem with loading with y_ini

i put:

pawn Код:
new file[40];
format(file,sizeof(file),"House/Kuce/%i.ini",HouseCount);
INI_ParseFile(file, "ini_%s_%s");
under OnGameModeInit

and at the end of script i put:

pawn Код:
forward ini_examples_mine(name[], value[]);
public ini_examples_mine(name[], value[])
{
.....
}
and it wont to load ...

pls help


Re: INI_ParseFile - FireCat - 11.12.2011

I never used YINI, so therefor I dont know what parse file is for.
But you're missing some parameters:
INI_ParseFile(file, "ini_%s_%s",SOMETHINGHERE, SOMETHINGHERE);


Re: INI_ParseFile - TheArcher - 11.12.2011

Your parse file is ini_%s_%s and your file is %i! They don't match at all.


Re: INI_ParseFile - Speed - 11.12.2011

thanks for that, but i still get problem...


Re: INI_ParseFile - PlayHard - 11.12.2011

Hello ^^, You shouldn't put that OnGameModeInIt,

Put this at the top of your script, if you have enums Put that under them but not in them or just above GameModeInIt!
pawn Код:
new file[40];
format(file,sizeof(file),"House/Kuce/%i.ini",HouseCount);
INI_ParseFile(file, "ini_%s_%s");

And INI_ParseFile should be like this

INI_ParseFile(file, "YOURLOADINGTHING", .bExtra = true, .extra = playerid);


If this didn't work, check Kush's tutorial because he made it easier and not complicated , if the problem still exists reply!!


Re: INI_ParseFile - Speed - 11.12.2011

dosent work


Re: INI_ParseFile - PlayHard - 11.12.2011

Hm, I can't detect what the problem is. Can you post what it says? Else try to use the way Kush used Y_Ini in


Re: INI_ParseFile - Speed - 11.12.2011

Quote:
Originally Posted by PlayHard
Посмотреть сообщение
Hm, I can't detect what the problem is. Can you post what it says? Else try to use the way Kush used Y_Ini in
it dosent have any of problem, just dont want to load it :S

i try all..


Re: INI_ParseFile - PlayHard - 11.12.2011

Quote:
Originally Posted by Speed
Посмотреть сообщение
it dosent have any of problem, just dont want to load it :S

i try all..
Did you make a lot of progress on it? If not use Kush's one ^^


Re: INI_ParseFile - Speed - 12.12.2011

pawn Код:
forward ini_examples_mine(name[], value[]);
public ini_examples_mine(name[], value[])
{
    new file[60];
    for(new i = 0; i < MAX_HOUSES;i++)
    {
        format(file,sizeof(file),"House/Kuce/%i.ini",i);
        INI_Int("Cijena", HouseInfo[i][Price]);
        INI_Int("Level", HouseInfo[i][Level]);
        INI_Int("Zauzeto", HouseInfo[i][Owned]);
        INI_Float("XPos", HouseInfo[i][XPos]);
        INI_Float("YPos", HouseInfo[i][YPos]);
        INI_Float("ZPos", HouseInfo[i][ZPos]);
        INI_Int("VirtualWorld", HouseInfo[i][VirtualWorld]);
        INI_String("Vlasnik", HouseInfo[i][Owner], 24);
        INI_String("Opis", HouseInfo[i][Opis], 50);
        HouseEnter[i]  = CreatePickup(1273, 23, HouseInfo[i][XPos],HouseInfo[i][YPos],HouseInfo[i][ZPos],HouseInfo[i][VirtualWorld]);
        HouseExit[i] = CreatePickup(1239, 23,443.9237,509.4609,1001.4195,HouseInfo[i][VirtualWorld]);
        new labelstring[256];
        switch(HouseInfo[i][Owned])
        {
            case 0:{format(labelstring,sizeof(labelstring),"Vlasnik: Nitko \nCijena: %i\nLevel: %i\nVrsta kuce: %s",HouseInfo[i][Price], HouseInfo[i][Level], HouseInfo[i][Opis]);}
            case 1:{format(labelstring,sizeof(labelstring),"Vlasnik: %s\nCijena: %i\nLevel: %i\nVrsta kuce: %s",HouseInfo[i][Owner], HouseInfo[i][Price], HouseInfo[i][Level], HouseInfo[i][Opis]);}
        }
        HouseInfo[i][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,HouseInfo[i][XPos],HouseInfo[i][YPos],HouseInfo[i][ZPos],25.0,HouseInfo[i][VirtualWorld]);
        HouseCount++;
    }
    return 1;
}



Re: INI_ParseFile - TheArcher - 12.12.2011

@Speed I think in INI publics should be called only the INI formats.


Re: INI_ParseFile - Speed - 12.12.2011

You want a command where is saving it??

pawn Код:
CMD:createhouse(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return NotAdmin(playerid);
    new HousePrice,id = HouseCount, HouseLevel, opis[50];
    if(sscanf(params,"iis[128]",HousePrice, HouseLevel, opis)) return Usage(playerid, "/createhouse [Cijena] [Level] [Opis Kuce]");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    HouseInfo[id][Price] = HousePrice;
    HouseInfo[id][Level] = HouseLevel;
    HouseInfo[id][Owned] = 0;
    HouseInfo[id][XPos] = x;
    HouseInfo[id][YPos] = y;
    HouseInfo[id][ZPos] = z;
    HouseInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
    format(HouseInfo[id][Opis], 50, "%s", opis);
    format(HouseInfo[id][Owner],24,"Nitko");
    SendClientMessage(playerid, -1, ""#COL_BLUE"[House Kuca] Nova kuca je napravljena na vasoj poziciji!");
    HouseEnter[id]  = CreatePickup(1273, 23, x,y,z,GetPlayerVirtualWorld(playerid));
    HouseExit[id] = CreatePickup(1239, 23, 443.9237,509.4609,1001.4195,GetPlayerVirtualWorld(playerid));
    new file[40],labelstring[256];
    format(file,sizeof(file),"House/Kuce/%i.ini",id);
    new INI:kuca = INI_Open(file);
    INI_WriteInt(kuca, "Cijena",HousePrice);
    INI_WriteInt(kuca, "Level",HouseLevel);
    INI_WriteInt(kuca, "Zauzeto",0);
    INI_WriteInt(kuca, "VirtualWorld",GetPlayerVirtualWorld(playerid));
    INI_WriteFloat(kuca, "XPos",x);
    INI_WriteFloat(kuca, "YPos",y);
    INI_WriteFloat(kuca, "ZPos",z);
    INI_WriteString(kuca, "Vlasnik","Nitko");
    INI_WriteString(kuca, "Opis",opis);
    INI_Close(kuca);
    format(labelstring,sizeof(labelstring),"Vlasnik: Nitko \nCijena: %i\nLevel: %i\nVrsta kuce: %s",HousePrice, HouseLevel, opis);
    HouseInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
    HouseCount++;
    return 1;
}
or that:

pawn Код:
Cijena = 100
Level = 1
Zauzeto = 0
VirtualWorld = 0
XPos = 2802.431396
YPos = -1936.273925
ZPos = 13.546875
Vlasnik = Nitko
Opis = Velika Kuca



Re: INI_ParseFile - Speed - 14.12.2011

bump still i have this problem


Re: INI_ParseFile - Speed - 14.12.2011

is that neccesery?