SA-MP Forums Archive
dini_Get - 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: dini_Get (/showthread.php?tid=81374)



dini_Get - Vince - 10.06.2009

Hi

I have this code:
pawn Код:
// ===== HOUSES
  for(new i = 0; i <= MAX_HOUSES; i++)
    {
        format(HouseFile, sizeof(HouseFile), hFile, i);
        HouseInfo[i][id]        = dini_Int(HouseFile,   "id");
        HouseInfo[i][x]         = dini_Float(HouseFile, "x");
        HouseInfo[i][y]         = dini_Float(HouseFile, "y");
        HouseInfo[i][z]         = dini_Float(HouseFile, "z");
        HouseInfo[i][rot]       = dini_Float(HouseFile, "rot");
        HouseInfo[i][x_int]     = dini_Float(HouseFile, "x_int");
        HouseInfo[i][y_int]     = dini_Float(HouseFile, "y_int");
        HouseInfo[i][z_int]     = dini_Float(HouseFile, "z_int");
        HouseInfo[i][rot_int]   = dini_Float(HouseFile, "rot_int");
        HouseInfo[i][int_id]  = dini_Int(HouseFile,     "int_id");
        HouseInfo[i][carid]     = dini_Int(HouseFile,   "carid");
        HouseInfo[i][carmodel]  = dini_Int(HouseFile,   "carmodel");
        HouseInfo[i][car_x]     = dini_Float(HouseFile, "car_x");
        HouseInfo[i][car_y]     = dini_Float(HouseFile, "car_y");
        HouseInfo[i][car_z]     = dini_Float(HouseFile, "car_z");
        HouseInfo[i][car_rot]   = dini_Float(HouseFile, "car_rot");
        HouseInfo[i][carcol1]   = dini_Int(HouseFile,   "carcol1");
        HouseInfo[i][carcol2]   = dini_Int(HouseFile,   "carcol2");
        HouseInfo[i][owner]     = dini_Get(HouseFile,   "owner"); // <= Line with error
        HouseInfo[i][price]     = dini_Int(HouseFile,   "price");
      printf("LOADED: House %02i", i);
   
        HouseInfo[i][id] = CreatePickup(1239, 23, HouseInfo[i][x], HouseInfo[i][y], HouseInfo[i][z]);
        HouseInfo[i][carid] = CreateVehicle(HouseInfo[i][carmodel], HouseInfo[i][car_x], HouseInfo[i][car_y], HouseInfo[i][car_z], HouseInfo[i][car_rot], HouseInfo[i][carcol1], HouseInfo[i][carcol2], 3600);
  }
    return 1;
}
And this error:
Код:
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rr.pwn(270) : error 047: array sizes do not match, or destination array is too small
How to fix?


Re: dini_Get - Andom - 10.06.2009

Is ''owner'' in enum defined as a string?


Re: dini_Get - Vince - 10.06.2009

Yeah

pawn Код:
owner[MAX_PLAYER_NAME],
EDIT:
Fixed it

pawn Код:
format(HouseInfo[i][owner], 24, dini_Get(HouseFile, "owner"));



Re: dini_Get - efeX - 10.06.2009

IT doesn't match because dini_Get returns a DINI_MAX_STRING not MAX_PLAYER_NAME


Re: dini_Get - DracoBlue - 10.06.2009

Quote:
Originally Posted by Vince
Fixed it

pawn Код:
format(HouseInfo[i][owner], 24, dini_Get(HouseFile, "owner"));
Correct.

But secure:
pawn Код:
format(HouseInfo[i][owner], 24, "%s", dini_Get(HouseFile, "owner"));
Since sometimes % are in strings, so you should always use "%s" if you want to do that.

- Draco