SA-MP Forums Archive
[Resolvido]Por mim - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Resolvido]Por mim (/showthread.php?tid=154935)



[Resolvido]Por mim - tshadow - 16.06.2010

Alguйm me pode ajudar, nгo me consigo livrar destes erros:
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\server\gamemodes\BC_RP.pwn(17486 -- 17487) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\server\gamemodes\BC_RP.pwn(17486 -- 17487) : error 032: array index out of bounds (variable "CarStund")
C:\Program Files\Rockstar Games\GTA San Andreas\server\gamemodes\BC_RP.pwn(17522) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\server\gamemodes\BC_RP.pwn(17529) : warning 213: tag mismatch
C:\Program Files\Rockstar Games\GTA San Andreas\server\gamemodes\BC_RP.pwn(17529) : error 032: array index out of bounds (variable "CarStund")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Pawno:
pawn Код:
public SaveCars()
{
    public SaveCars()
{
    new idx;
    new File: file2;
    while (idx < sizeof(CarStund))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s,%d,%f,%f,%f,%f,%d,%d\n",//17486
        CarStund[idx][Owner],
        CarStund[idx][CarModel],
        CarStund[idx][CarX],
        CarStund[idx][CarY],
        CarStund[idx][CarZ],
        CarStund[idx][CarAngle],//17492
        CarStund[idx][CarColor1],
        CarStund[idx][CarColor2]);
        if(idx == 0)
        {
            file2 = fopen("CRP_Scriptfiles/Cars/Cars.cfg", io_write);
        }
        else
        {
            file2 = fopen("CRP_Scriptfiles/Cars/Cars.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
public LoadCars()
{
    new arrCoords[8][64];
    new strFromFile2[256];
    new File: file = fopen("CRP_Scriptfiles/Cars/Cars.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(CarStund))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(CarStund[idx][CarOwner], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            CarStund[idx][CarModel] = floatstr(arrCoords[1]);//17522
            CarStund[idx][CarX] = floatstr(arrCoords[2]);
            CarStund[idx][CarY] = floatstr(arrCoords[3]);
            CarStund[idx][CarZ] = floatstr(arrCoords[4]);
            CarStund[idx][CarAngle] = floatstr(arrCoords[5]);
            CarStund[idx][CarColor1] = strval(arrCoords[6]);
            CarStund[idx][CarColor2] = strval(arrCoords[7]);
      CarStund[idx][Owner] = CreateVehicle( CarStund[idx][CarModel], CarStund[idx][CarX], CarStund[idx][CarY], CarStund[idx][CarZ], CarStund[idx][CarAngle], CarStund[idx][CarColor1], CarStund[idx][CarColor2], 300000)//17529
        }
        fclose(file);
    }
    return 1;
}
---------------------------------------------------------------------------------------------------------------------------------
Edit.
Obrigado pela atenзгo mas vб passado aqui algumas horas jб deu


Re: [ajuda]erros de gravaзгo de dados - [BR]JD - 16.06.2010

topo do gm [pawn]new CarStund[idx][Owner];[/paw] se continuar com o erro tenta assim:
pawn Код:
new CarStund;