I Need help with error - 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: I Need help with error (
/showthread.php?tid=125921)
I Need help with error -
scott1 - 06.02.2010
Hello guys, i need help with my script
Here is some ligne that i have create
Код:
#define MAX_DATTE_AUTOSECU (3) // Datte auto secu
forward SaveAutoSecu();
forward LoadAutoSecu();
Код:
new Datte[MAX_VEHICLES][MAX_DATTE_AUTOSECU]; // Datte autosecu
Код:
if(strcmp(cmd, "/autosecuriter", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new year, month, day;
getdate(year, month, day);
Datte[carid][1] = day;
Datte[carid][2] = month;
Datte[carid][3] = year;
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"Ce vehicule ne vous appartient pas !");
}
return 1;
}
return 1;
}
Код:
public SaveAutoSecu()
{
new idx;
new File: file2;
idx = 1;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%i,%i,%i,\n",
Datte[idx][1],
Datte[idx][2],
Datte[idx][3],
if(idx == 1)
{
file2 = fopen("AutoSecu.cfg", io_write);
}
else
{
file2 = fopen("AutoSecu.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
Код:
public LoadAutoSecu()
{
new arrCoords[13][64];
new strFromFile2[256];
new File: file = fopen("AutoSecu.cfg", io_read);
if (file)
{
new idx = 1;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
Datte[idx][1] = strval(arrCoords[0]);
Datte[idx][2] = strval(arrCoords[1]);
Datte[idx][3] = strval(arrCoords[2]);
idx++;
}
}
return 1;
}
Here is the result
Код:
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(29238) : error 032: array index out of bounds (variable "Datte")
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52845 -- 52848) : error 032: array index out of bounds (variable "Datte")
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52845 -- 52849) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52849 -- 52850) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52849 -- 52850) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
But i don't know what is wrong :/
Thank you
Re: I Need help with error -
ettans - 06.02.2010
Try changing
#define MAX_DATTE_AUTOSECU (3) to
#define MAX_DATTE_AUTOSECU 4
Re: I Need help with error -
scott1 - 06.02.2010
Thank you, but now i have
Код:
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52845 -- 52849) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52849 -- 52850) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propriйtaire\Bureau\serveur samp\LARP\Bon serv\gamemodes\CDC7.pwn(52853) : error 029: invalid expression, assumed zero
Here is the ligne
Код:
public SaveAutoSecu()
{
new idx;
new File: file2;
idx = 184;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%i,%i,%i,\n", //52845
Datte[idx][1],//52846
Datte[idx][2],//52847
Datte[idx][3],//52848
if(idx == 1)//52849
{//52850
file2 = fopen("AutoSecu.cfg", io_write);//52851
}//52852
else//52853
{
file2 = fopen("AutoSecu.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
Tank you
Re: I Need help with error -
scott1 - 06.02.2010
No one can help me?
Re: I Need help with error -
ettans - 06.02.2010
Oh, you forgot to close the format.
pawn Код:
public SaveAutoSecu()
{
new idx;
new File: file2;
idx = 184;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%i,%i,%i,\n",Datte[idx][1],Datte[idx][2],Datte[idx][3]);
if(idx == 1)//52849
{//52850
file2 = fopen("AutoSecu.cfg", io_write);//52851
}//52852
else//52853
{
file2 = fopen("AutoSecu.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}