SA-MP Forums Archive
Faction type and slot resetting after LoadFaction is called. [rep++] - 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: Faction type and slot resetting after LoadFaction is called. [rep++] (/showthread.php?tid=334894)



Faction type and slot resetting after LoadFaction is called. [rep++] - seanny - 16.04.2012

Hi, the FactionType and FactionSlot keep resetting after LoadFactions is called, what is the problem?

pawn Код:
LoadFactions()
{
    new arrCoords[12][64];
    new strFromFile2[512];
    new File: file = fopen("Configs/factions.cfg", io_read);
    if(file)
    {
        new idx;
        while (idx < sizeof(FactionInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(FactionInfo[idx][FactionName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(FactionInfo[idx][FactionMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            strmid(FactionInfo[idx][FactionLeader], arrCoords[2], 0, strlen(arrCoords[2]), 255);
            strmid(FactionInfo[idx][FactionRank1], arrCoords[3], 0, strlen(arrCoords[3]), 255);
            strmid(FactionInfo[idx][FactionRank2], arrCoords[4], 0, strlen(arrCoords[4]), 255);
            strmid(FactionInfo[idx][FactionRank3], arrCoords[5], 0, strlen(arrCoords[5]), 255);
            strmid(FactionInfo[idx][FactionRank4], arrCoords[6], 0, strlen(arrCoords[6]), 255);
            strmid(FactionInfo[idx][FactionRank5], arrCoords[7], 0, strlen(arrCoords[7]), 255);
            strmid(FactionInfo[idx][FactionRank6], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            FactionInfo[idx][FactionType] = strval(arrCoords[10]);//This is the error
            FactionInfo[idx][FactionSlot] = strval(arrCoords[11]);//This is the other error
            printf("[Dynamic Faction] Faction Name: %s, Type: %d, Slot: %d, ID: %d",FactionInfo[idx][FactionName],FactionInfo[idx][FactionType],FactionInfo[idx][FactionSlot],idx);
            idx++;
        }
        fclose(file);
    }
    return 1;
}