array sizes do not match, or destination array is too small - 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: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: array sizes do not match, or destination array is too small (
/showthread.php?tid=518555)
array sizes do not match, or destination array is too small -
unuky - 10.06.2014
Mi duda es quй le pasa a este cуdigo, le he dado muchas vueltas y no logro saber cual es el error.
Error = array sizes do not match, or destination array is too small
pawn Код:
#include <dini>
#define MAX_FACCION_NAME 30
forward LoadDataFaccion(faccionid);
forward SaveDataFaccion(faccionid);
enum DataFacciones
{
NameFaccion[MAX_FACCION_NAME],
Lider[MAX_PLAYER_NAME]
}
new DIR_FACCIONES[12] = "/Facciones/";
new FaccionData[MAX_FACCION_COUNT][DataFacciones];
public SaveDataFaccion(faccionid)
{
new File[18];
format(File, sizeof(File), "%s%i.ini", DIR_FACCIONES, faccionid);
dini_Set(File, "NameFaccion", FaccionData[faccionid][NameFaccion]);
dini_Set(File, "Lider", FaccionData[faccionid][Lider]);
}
public LoadDataFaccion(faccionid)
{
new File[18];
format(File, sizeof(File), "%s%i.ini", DIR_FACCIONES, faccionid);
FaccionData[faccionid][NameFaccion] = dini_Get(File, "NameFaccion"); // Lнnea de error
FaccionData[faccionid][Lider] = dini_Get(File, "Lider"); // Lнnea de error
}
Gracias.
Respuesta: array sizes do not match, or destination array is too small -
Swedky - 10.06.2014
Tu errores son '
FaccionData[faccionid][NameFaccion]' - '
FaccionData[faccionid][Lider]' ya que tratas de convertir esas variables enteras en cadenas.
Lo que tienes que hacer es crearlas aparte
(si deseas
):
pawn Код:
new NameFaction[MAX_FACTIONS][MAX_NAME_FACTION];
// ....
// LoadDataFaccion
format(NameFaction[factionid], MAX_NAME_FACTION, "%s", dini_Get(File, "NameFaccion"));
// ...
Creo que esa es la soluciуn.
Respuesta: array sizes do not match, or destination array is too small -
unuky - 10.06.2014
Perfecto, ahora lo entiendo. Muchas gracias.