SA-MP Forums Archive
[Help] djson (cez accounts) loading data 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: [Help] djson (cez accounts) loading data error (/showthread.php?tid=166886)



[Solved] djson (cez accounts) loading data error - Ace_Menace - 10.08.2010

The problem:
pawn Код:
error 047: array sizes do not match, or destination array is too small
I get this error for every one of these lines:

pawn Код:
PlayerInfo[playerid][pCrimeReason] = AccountGet(PlayerName, "CrimeReason");
PlayerInfo[playerid][pWhyLeft] = AccountGet(PlayerName, "WhyLeft");
PlayerInfo[playerid][pMarriedTo] = AccountGet(PlayerName, "MarriedTo");
PlayerInfo[playerid][pNote1] = AccountGet(PlayerName, "Note1");
PlayerInfo[playerid][pNote2] = AccountGet(PlayerName, "Note2");
PlayerInfo[playerid][pNote3] = AccountGet(PlayerName, "Note3");
PlayerInfo[playerid][pNote4] = AccountGet(PlayerName, "Note4");
PlayerInfo[playerid][pNote5] = AccountGet(PlayerName, "Note5");
PlayerInfo[playerid][pPendingInfo] = AccountGet(PlayerName, "PendingInfo");
PlayerInfo[playerid][pPunishment1] = AccountGet(PlayerName, "Punishment1");
PlayerInfo[playerid][pPunishment2] = AccountGet(PlayerName, "Punishment1");
PlayerInfo[playerid][pPunishment3] = AccountGet(PlayerName, "Punishment1");
PlayerInfo[playerid][pPunishment4] = AccountGet(PlayerName, "Punishment1");
PlayerInfo[playerid][pIP] = AccountGet(PlayerName, "IP");
PlayerInfo[playerid][pLastSeen] = AccountGet(PlayerName, "LastSeen");
PlayerInfo[playerid][pRegistredDate] = AccountGet(PlayerName, "RegistredDate");
Obviously it's an issue with array sizes, but I have no idea how to fix these.


Re: [Help] djson (cez accounts) loading data error - Simon - 10.08.2010

There's 2 possible solutions from the top of my head.

1. Change the array size of PlayerInfo variables to what AccountGet returns.

To do this we'll need to know what's inside the CezAccounts function. Then we need to know how your PlayerInfo array and enum is declared i.e. the sizes of all the enum fields.

2. You could try using strmid as a copy function. The disadvantage to this is that some data may be truncated (cut off).

pawn Код:
// Change this line to:
PlayerInfo[playerid][pIP] = AccountGet(PlayerName, "IP");

// This line:
strmid(PlayerInfo[playerid][pIP], AccountGet(PlayerName, "IP"), 0, sizeof(PlayerInfo[playerid][pIP]));

// You will need to do this for all the equals statements.



Re: [Help] djson (cez accounts) loading data error - Ace_Menace - 10.08.2010

Thanks for the reply.
I had this idea too

Unfortunately I got these errors on the IP line:
pawn Код:
strmid(pshit[pIP], AccountGet(PlayerName, "IP"), 0, sizeof(pshit[pIP]));
pawn Код:
error 001: expected token: "]", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line



Re: [Help] djson (cez accounts) loading data error - Ace_Menace - 10.08.2010

Scratch that, read deeper into your post (epic fail), and I
went and looked at the string size in the CezAccounts
which is 255 by the way, thanks for the help but I got it.


Re: [Help] djson (cez accounts) loading data error - Kar - 10.08.2010

pawn Код:
strmid(pshit[pIP], AccountGet(PlayerName, "IP"), 0, 128);
no "sizeof(pshit"