error 047: array sizes do not match, or destination array is too small
#1

Hello buddies, i've been making my own adminname system, i'm using y_ini to save/load players data
This is the error i get.
pawn Код:
error 047: array sizes do not match, or destination array is too small
and this is the line
pawn Код:
PlayerInfo[id][AdminName] = name;
Help me please.
Reply
#2

sizeof won't work with arrays from enums and format is slow for copying strings. Use strcat instead:

pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
and
pawn Код:
// Usage: strcpy(destination, source, lenght)
strcpy(PlayerInfo[id][AdminName], name, MAX_PLAYER_NAME);
// change the size to higher if it's needed.
Reply
#3

I got this warning
pawn Код:
warning 201: redefinition of constant/macro (symbol "strcpy(%0,%1)")
Reply
#4

Then use this :

pawn Код:
#if defined strcpy
      #undef strcpy
      #define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
#endif
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)