Array Must Be Indexed
#1

Код:
		new file[122];
        format(file,sizeof(file),"/ladmin/users/%s.sav",PlayerName2(playerid));
        PlayerInfo[playerid][Banned_By] = dini_Get(file, "Banned_By");
        PlayerInfo[playerid][Ban_Reason] = dini_Get(file, "Ban_Reason");
Errors
Код:
error 006: must be assigned to an array
error 006: must be assigned to an array
Error Line
Код:
     PlayerInfo[playerid][Banned_By] = dini_Get(file, "Banned_By");
        PlayerInfo[playerid][Ban_Reason] = dini_Get(file, "Ban_Reason");
Reply
#2

I haven't done much dini but oh' well.

Inside your enum declaration you should be having something like this:

enum e_PlayerInfo {
Banned_By,
Ban_Reason
};

Have you made those two into arrays? Should be looking like this if you want it to be correct:
enum e_PlayerInfo {
Banned_By[MAX_PLAYER_NAME],
Ban_Reason[128]
};

EDIT:
Nevermind I was stupid, it should maybe work like if you put it into a format.

Код:
format(PlayerInfo[playerid][Banned_By], MAX_PLAYER_NAME, "%s", dini_Get(file, "Banned_By");
Reply
#3

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
I haven't done much dini but oh' well.

Inside your enum declaration you should be having something like this:

enum e_PlayerInfo {
Banned_By,
Ban_Reason
};

Have you made those two into arrays? Should be looking like this if you want it to be correct:
enum e_PlayerInfo {
Banned_By[MAX_PLAYER_NAME],
Ban_Reason[128]
};

EDIT:
Nevermind I was stupid, it should maybe work like if you put it into a format.

Код:
format(PlayerInfo[playerid][Banned_By], MAX_PLAYER_NAME, "%s", dini_Get(file, "Banned_By");
Banned_By[MAX_PLAYER_NAME + 1]
for the termination \0 cell

also, I suggest to use memcpy or strcat at least instead of format
Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2);
strcpy(dest, str[], length);
for this reason
Reply
#4

Quote:
Код:
format(PlayerInfo[playerid][Banned_By], MAX_PLAYER_NAME, "%s", dini_Get(file, "Banned_By");
Thanks Well U Made A Mistake
It Should Be
Код:
format(PlayerInfo[playerid][Banned_By], 256, "%s", dini_Get(file, "Banned_By"));
Reply
#5

Quote:
Originally Posted by Speaker
Посмотреть сообщение
Thanks Well U Made A Mistake
It Should Be
Код:
format(PlayerInfo[playerid][Banned_By], 256, "%s", dini_Get(file, "Banned_By"));
He didnt' make a mistake, MAX_PLAYER_NAME is defined to equal to 24, which is the maximum length a nickname on samp can be.
Why do you set it to 256?
I thought Banned_By holds the name of the player who bans the other player.

If so, it should be 24 at max. because nicknames on samp cannot be longer than this.
Reply
#6

Aye I forget about the \ thanks, should probably fix this in my own gamemode since I never really thought about it.

Ї\_(ツ)_/Ї
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)