Damn, what's wrong now? Array index...
#6

Thanks John.

Still, I'm having problems with reading text from .ini file.

If I put dini_Get(SERVER_FACTION_FILE_1, "FactionName")
I get an error saying:

[code]C:\Users\Kreso\Desktop\SAMP Server\gamemodes\GGRP.pwn(179) : error 047: array sizes do not match, or destination array is too small[code]

Also, when I add in faction1 enum array size to a string (like: fRank1[30]) I get 20+ errors. All I want to do is to get the text written in .ini file in those variables.

Here is a part of code:

pawn Код:
// http://gb-rp.one-forum.net/
// INCL
#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#include <sscanf2>
#pragma unused ret_memcpy

// SCRIPT DEFINES
#undef MAX_PLAYERS
#define MAX_PLAYERS 200
#define SERVER_USER_FILE "users/%s.ini"
#define PLAYER_NAME MAX_PLAYER_NAME
#define SERVER_FACTION_FILE_1 "factions/1.ini"
#define SERVER_FACTION_FILE_2 "factions/2.ini"

// COLORS
#define COLOR_POWDERBLUE 0xB0E0E6FF
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GOLD 0xFFD700FF
#define COLOR_OLIVE 0x808000FF
#define COLOR_ORED 0xFF0000FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_TEAL 0x008080FF
#define COLOR_BROWN 0xFFBB7796
#define COLOR_LOCALMSG 0xEC5413AA
#define COLOR_ADMINCMD 0xF97804FF
#define COLOR_ADMINDUTY 0x007E96F6
#define COLOR_NOTLOGGED 0x00000000
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_MONEYBAR 0x005800FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xA10000AA
#define COLOR_DARKRED 0xCD000000
#define COLOR_ANTICHEAT 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTBLUE2 0x0080FFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_LIGHTORANGE 0xFF8000FF
#define COLOR_DARKBROWN 0xB36C42FF
#define COLOR_MEDIUMBLUE 0x1ED5C7FF
#define COLOR_LIGHTYELLOW 0xE0E377AA
#define COLOR_LIGHTYELLOW2 0xE0EA64AA
#define COLOR_LIGHTYELLOW3 0xFF6347AA
#define COLOR_DARKPURPLE 0x5F56F8AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define COLOR_NEWS 0xFFA500AA
#define COLOR_OOC 0xE0FFFFAA
#define COLOR_NEWOOC 0x0080FFAA
// END COLORS

// FACTIONS (TEAMS)

// FORWARDS
forward NearByMessage(playerid, colour, string[]);
forward NearByMessageLow(playerid, colour, string[]);
forward NearByMessageShout(playerid, colour, string[]);
forward paycheck();
forward checkpaytime();
forward savestats(playerid);
forward updatestats(playerid);

// PLAYER INFORMATION IS STORED TEMPORERALY HERE
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
    pPaycheckStatus,
    pRespect,
    pNextLvl,
    pLeader,
    pFaction,
    pFRank,
}

// FACTION INFORMATION ARE LOADED HERE FROM FILE (TEMP)
// Faction 1 = SFPD
// Faction 2 = Goverment
enum fFaction1
{
    fLeader[MAX_PLAYER_NAME],
    fFactionName[40],
    fRank1,
    fRank2,
    fRank3,
    fRank4,
    fRank5,
    fRank6,
    fRank7,
    fSkin1,
    fSkin2,
    fSkin3,
    fSkin4,
    fSkin5,
    fSkin6,
}


// THE GOVERNMENT
enum fFaction2
{
    fLeader[MAX_PLAYER_NAME],
    fFactionName[40],
    fRank1,
    fRank2,
    fRank3,
    fRank4,
    fRank5,
    fRank6,
    fRank7,
    fSkin1,
    fSkin2,
    fSkin3,
    fSkin4,
    fSkin5,
    fSkin6,
}


// VARIABLES
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
new pPaycheck;
new paytimer;
new checkpaytimer;
new bool:pMuted[MAX_PLAYERS] = false;



// FACTION VARIABLES:
new Faction1[100][fFaction1];
new Faction2[100][fFaction2];

main()
{
    print("\n--------------------------------------");
    print(" my server ");
    print(" made by: Outcast. ");
    print("--------------------------------------/n");
}


public OnGameModeInit()
{
    SetGameModeText("Gant Bridge Roleplay v.0.1");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    paytimer = SetTimer("paycheck",3600000,true);
    checkpaytimer = SetTimer("checkpaytime",1800000,true);
   
    // Load faction variables
   
    Faction1[fFaction1][fLeader] = dini_Get(SERVER_FACTION_FILE_1, "Leader");
    Faction1[fFaction1][fFactionName] = dini_Int(SERVER_FACTION_FILE_1, "FactionName");
    Faction1[fFaction1][fRank1] = dini_Int(SERVER_FACTION_FILE_1, "Rank1");
    Faction1[fFaction1][fRank2] = dini_Int(SERVER_FACTION_FILE_1, "Rank2");
    Faction1[fFaction1][fRank3] = dini_Int(SERVER_FACTION_FILE_1, "Rank3");
    Faction1[fFaction1][fRank4] = dini_Int(SERVER_FACTION_FILE_1, "Rank4");
    Faction1[fFaction1][fRank5] = dini_Int(SERVER_FACTION_FILE_1, "Rank5");
    Faction1[fFaction1][fRank6] = dini_Int(SERVER_FACTION_FILE_1, "Rank6");
    Faction1[fFaction1][fRank7] = dini_Int(SERVER_FACTION_FILE_1, "Rank7");
    Faction1[fFaction1][fSkin1] = dini_Int(SERVER_FACTION_FILE_1, "Skin1");
    Faction1[fFaction1][fSkin2] = dini_Int(SERVER_FACTION_FILE_1, "Skin2");
    Faction1[fFaction1][fSkin3] = dini_Int(SERVER_FACTION_FILE_1, "Skin3");
    Faction1[fFaction1][fSkin4] = dini_Int(SERVER_FACTION_FILE_1, "Skin4");
    Faction1[fFaction1][fSkin5] = dini_Int(SERVER_FACTION_FILE_1, "Skin5");
    Faction1[fFaction1][fSkin6] = dini_Int(SERVER_FACTION_FILE_1, "Skin6");


    Faction2[fFaction2][fLeader] = dini_Int(SERVER_FACTION_FILE_2, "Leader");
    Faction2[fFaction2][fFactionName] = dini_Int(SERVER_FACTION_FILE_2, "FactionName");
    Faction2[fFaction2][fRank1] = dini_Int(SERVER_FACTION_FILE_2, "Rank1");
    Faction2[fFaction2][fRank2] = dini_Int(SERVER_FACTION_FILE_2, "Rank2");
    Faction2[fFaction2][fRank3] = dini_Int(SERVER_FACTION_FILE_2, "Rank3");
    Faction2[fFaction2][fRank4] = dini_Int(SERVER_FACTION_FILE_2, "Rank4");
    Faction2[fFaction2][fRank5] = dini_Int(SERVER_FACTION_FILE_2, "Rank5");
    Faction2[fFaction2][fRank6] = dini_Int(SERVER_FACTION_FILE_2, "Rank6");
    Faction2[fFaction2][fRank7] = dini_Int(SERVER_FACTION_FILE_2, "Rank7");
    Faction2[fFaction2][fSkin1] = dini_Int(SERVER_FACTION_FILE_2, "Skin1");
    Faction2[fFaction2][fSkin2] = dini_Int(SERVER_FACTION_FILE_2, "Skin2");
    Faction2[fFaction2][fSkin3] = dini_Int(SERVER_FACTION_FILE_2, "Skin3");
    Faction2[fFaction2][fSkin4] = dini_Int(SERVER_FACTION_FILE_2, "Skin4");
    Faction2[fFaction2][fSkin5] = dini_Int(SERVER_FACTION_FILE_2, "Skin5");
    Faction2[fFaction2][fSkin6] = dini_Int(SERVER_FACTION_FILE_2, "Skin6");

    return 1;
}
Reply


Messages In This Thread
Damn, what's wrong now? Array index... - by Outcast - 10.01.2011, 22:30
Re: Damn, what's wrong now? Array index... - by Rizard - 10.01.2011, 22:50
Re: Damn, what's wrong now? Array index... - by Outcast - 10.01.2011, 23:16
Re: Damn, what's wrong now? Array index... - by Rizard - 10.01.2011, 23:55
Re: Damn, what's wrong now? Array index... - by John_F - 11.01.2011, 00:05
Re: Damn, what's wrong now? Array index... - by Outcast - 11.01.2011, 00:19
Re: Damn, what's wrong now? Array index... - by JaTochNietDan - 11.01.2011, 01:04
Re: Damn, what's wrong now? Array index... - by _rAped - 11.01.2011, 01:58
Re: Damn, what's wrong now? Array index... - by Outcast - 11.01.2011, 05:32
Re: Damn, what's wrong now? Array index... - by Rizard - 11.01.2011, 10:01

Forum Jump:


Users browsing this thread: 6 Guest(s)