SA-MP Forums Archive
Help Please :/ - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Please :/ (/showthread.php?tid=223416)



Help Please :/ - Max_Coldheart - 09.02.2011

Okay I keep getting an idiot error that I seem not to find any solutions, Could someone help us a little here ?
Errors:

pawn Код:
C:\Users\Max\Desktop\GTA San Andreas\samp03csvr_win32\filterscripts\ColdAdmin.pwn(95) : error 047: array sizes do not match, or destination array is too small
C:\Users\Max\Desktop\GTA San Andreas\samp03csvr_win32\filterscripts\ColdAdmin.pwn(96) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Lines:
94
pawn Код:
{
95:
pawn Код:
LSPD[fName] = dini_Get(file, "Name");//Gosh
96:
pawn Код:
LSPD[fLeader] = dini_Get(file, "Leader");
The enum:
pawn Код:
enum fInfo
{
    fName[128],
    fLeader[128],
    fSkin1,
    fSkin2,
    fSkin3,
    fSkin4,
    fSkin5,
    fSkin6,
    fRank1[20],
    fRank2[20],
    fRank3[20],
    fRank4[20],
    fRank5[20],
    fRank6[20],
    Float:fx,
    Float:fy,
    Float:fz,
    finterior,
};
And My File Creating ofcourse:

pawn Код:
new file[200];
    format(file, sizeof file, FACTION_FILE, "LSPD");
    if(!dini_Exists(file)) dini_Create(file);
    {
        dini_Set(file, "Name", "Bla");
        dini_Set(file, "Leader", "Penguin");
        dini_IntSet(file, "Skin1", 283);
        dini_IntSet(file, "Skin2", 283);
        dini_IntSet(file, "Skin3", 285);
        dini_IntSet(file, "Skin4", 286);
        dini_IntSet(file, "Skin5", 287);
        dini_IntSet(file, "Skin6", 288);
        dini_Set(file, "Rank1", "Cadet");
        dini_Set(file, "Rank2", "Officer");
        dini_Set(file, "Rank3", "Senior Officer");
        dini_Set(file, "Rank4", "Sergeant");
        dini_Set(file, "Rank5", "Deputy Chief");
        dini_Set(file, "Rank6", "Chief");
        dini_FloatSet(file, "Spawnpointx", 1480.9285);
        dini_FloatSet(file, "Spawnpointy", -1769.8893);
        dini_FloatSet(file, "Spawnpointz", 18.7958);
    }
and if it already exists:
pawn Код:
LSPD[fName] = dini_Get(file, "Name");//Gosh
        LSPD[fLeader] = dini_Get(file, "Leader");
        LSPD[fSkin1] = dini_Int(file, "Skin1");
        LSPD[fSkin2] = dini_Int(file, "Skin2");
        LSPD[fSkin3] = dini_Int(file, "Skin3");
        LSPD[fSkin4] = dini_Int(file, "Skin4");
        LSPD[fSkin5] = dini_Int(file, "Skin5");
        LSPD[fSkin6] = dini_Int(file, "Skin6");
        LSPD[fRank1] = dini_Int(file, "Rank1");
        LSPD[fRank2] = dini_Int(file, "Rank2");
        LSPD[fRank3] = dini_Int(file, "Rank3");
        LSPD[fRank4] = dini_Int(file, "Rank4");
        LSPD[fRank5] = dini_Int(file, "Rank5");
        LSPD[fRank6] = dini_Int(file, "Rank6");
        LSPD[fx] = dini_Float(file, "Spawnpointx");
        LSPD[fy] = dini_Float(file, "Spawnpointy");
        LSPD[fz] = dini_Float(file, "Spawnpointz")
Factions File Location:
pawn Код:
#define FACTION_FILE        "/ColdAdmin/Factions/%s.ini"



Re: Help Please :/ - Medal Of Honor team - 09.02.2011

fName should be a integer not a variable. Replace fName[128], with fName,


Re: Help Please :/ - Sasino97 - 09.02.2011

Quote:
pawn Код:
fName[128],
fLeader[128]
replace 128s with a higher number like:

pawn Код:
fName[256],
fLeader[256]



Re: Help Please :/ - Jantjuh - 09.02.2011

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
replace 128s with a higher number like:

pawn Код:
fName[256],
fLeader[256]
Indeed, but a little tip, don't make 'em too large! Sasino's numbers should fix it for ya


Re: Help Please :/ - Vince - 09.02.2011

Uhm, sorry but: WHAT THE FUCK?
Please keep your mouth shut if you don't know what you're talking about.

1) fName and fLeader should be arrays as they store strings, definitely NOT integers.
2) The max player name is 24 cells, don't waste anymore on them.
3) Tip for the TS: Topics with names like 'Help Please now' are not very descriptive and VERY annoying. A topic title like 'Array sizes do not match' would be far better.
4) As for the problem, try it like this:

pawn Код:
#define strcpy(%0,%1,%2) \
    strcat((%0[0] = '\0', %0), %1, %2)

strcpy(LSPD[fName], dini_Get(file, "Name"), 24);



Re: Help Please :/ - Max_Coldheart - 09.02.2011

Fixed it, thanks, had to change it to 255, as thats the 'Max Value' of 'dini'