[HELP] Dini reading!?
#1

I have one problem.

Code for loading data from file:
pawn Код:
public UcitajPD()
{
    new Fajl[64];
    for(new idx = 1; idx < sizeof(PDInfo); idx++)
    {
        format(Fajl, sizeof Fajl, "Organizacije/PoliceDepartment.ini");
        if(dini_Exists(Fajl))
        {
            strmid(PDInfo[idx][Lider1], dini_Get(Fajl,"Lider_1"), 0, strlen(dini_Get(Fajl,"Lider_1")), 255);
            strmid(PDInfo[idx][Lider2], dini_Get(Fajl,"Lider_2"), 0, strlen(dini_Get(Fajl,"Lider_2")), 255);
            strmid(PDInfo[idx][Mesto1], dini_Get(Fajl,"Mesto_1"), 0, strlen(dini_Get(Fajl,"Mesto_1")), 255);
            strmid(PDInfo[idx][Mesto2], dini_Get(Fajl,"Mesto_2"), 0, strlen(dini_Get(Fajl,"Mesto_2")), 255);
            strmid(PDInfo[idx][Mesto3], dini_Get(Fajl,"Mesto_3"), 0, strlen(dini_Get(Fajl,"Mesto_3")), 255);
            strmid(PDInfo[idx][Mesto4], dini_Get(Fajl,"Mesto_4"), 0, strlen(dini_Get(Fajl,"Mesto_4")), 255);
            strmid(PDInfo[idx][Mesto5], dini_Get(Fajl,"Mesto_5"), 0, strlen(dini_Get(Fajl,"Mesto_5")), 255);
            printf("*************************");
            printf("******* PD Ucitan *******");
            printf("*************************");
        }
        else
        {
            printf("GRESKA: Neuspelo ucitavanje %s.", Fajl);
        }
    }
    return 1;
}

/sviclanovi cmd:
pawn Код:
if(strcmp(cmd, "/sviclanovi", true) == 0)
    {
        if(PlayerInfo[playerid][pLeader] == 0)
        {
            SendClientMessage(playerid, COLOR_GRAD2, "  (greska) Niste lider!");
            return 1;
        }
        if(PlayerInfo[playerid][pLeader] == 1)
        {
            new str[128];
            UcitajPD();
            SendClientMessage(playerid, COLOR_LTYELLOW, "|____________________ Los Santos Police Department _______________|");
            format(str, sizeof str, "| Lider 1: %s | Lider 2: %s", PDInfo[1][Lider1], PDInfo[2][Lider2]);
            SendClientMessage(playerid, COLOR_LTYELLOW, str);
            format(str, sizeof str, "| 1: %s | 2: %s | 3: %s | 4: %s | 5: %s",
            PDInfo[3][Mesto1],
            PDInfo[4][Mesto2],
            PDInfo[5][Mesto3],
            PDInfo[6][Mesto4],
            PDInfo[7][Mesto5]);
            SendClientMessage(playerid, COLOR_LTYELLOW, str);
        }
        return 1;
    }

Content of Organizacije/PoliceDepartment.ini:
Код:
Lider_1=Niko
Lider_2=Niko
Mesto_1=Niko
Mesto_2=Niko
Mesto_3=Niko
Mesto_4=Niko
Mesto_5=Niko
and enum:
pawn Код:
#define ORG 8
enum pdInfo
{
    Lider1,
    Lider2,
    Mesto1,
    Mesto2,
    Mesto3,
    Mesto4,
    Mesto5,
};
new PDInfo[ORG][pdInfo];


And... My problem:
http://slike.hr/slike/samp924_7dae4.png.html


How to fix it?
Reply
#2

pawn Код:
format(PDInfo[idx][Lider1],sizeof(PDInfo[idx][Lider1]),"%s",dini_Get(Fajl,"Lider_1"));
// etc... replace every thing with format...
i mean replace at the loading
Reply
#3

pawn Код:
enum pdInfo
{
    Lider1[32],
    Lider2[32],
    Mesto1[32],
    Mesto2[32],
    Mesto3[32],
    Mesto4[32],
    Mesto5[32],
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)