PDA

View Full Version : Need Help [ compilation error ]


RicaNiel
03/10/2012, 12:09 PM
Hey guys i got a problem in here

i get this error when i complile


C:\Users\Daniel.Daniel-PC\samp\server\gamemodes\ricaniel.pwn(103) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

By the way here is the code



enum sfiles
{
botname[129]
}
new sdata[sfiles];

if(!fexist(SERVER_DATA))
{
file_Create(SERVER_DATA);
if(file_Open(SERVER_DATA))
{
file_SetStr("bot_name","RicaNiel");
file_Save(SERVER_DATA);
file_Close();
}
}
else
{
if(file_Open(SERVER_DATA))
{
sdata[botname] = file_GetStr("bot_name");
file_Save(SERVER_DATA);
file_Close();
}
}

BiosMarcel
03/10/2012, 12:17 PM
I think you can't use file_open with if()

RicaNiel
03/10/2012, 12:21 PM
Marcel;2151089']I think you can't use file_open with if()

I'd done it but it is still same error that i get when i compile



else
{
file_Open(SERVER_DATA);
sdata[botname] = file_GetStr("bot_name");
file_Save(SERVER_DATA);
file_Close();
}

BiosMarcel
03/10/2012, 12:23 PM
file_Close(SERVER_DATA);

RicaNiel
03/10/2012, 12:28 PM
Marcel;2151098']file_Close(SERVER_DATA);

its unknown directive

i use Southclaw's INI File Script
(http://forum.sa-mp.com/showthread.php?t=262795)
as my INI Writer
and i use Y_ini for the player data

BiosMarcel
03/10/2012, 12:29 PM
which line is it?

RicaNiel
03/10/2012, 12:31 PM
Marcel;2151112']which line is it?

The file_Close();

BiosMarcel
03/10/2012, 12:35 PM
Hm if i understand this right the line is unfixable żżż

RicaNiel
03/10/2012, 01:05 PM
Given that you didn't bother to tell us which line the error is on, I'd guess this is the problem:


sdata[botname] = file_GetStr("bot_name");


I don't know what size array that function returns so you'll have to check the include's documentation or source.

Oh thanks ****** i found it its 256
Thank you so much