sscanf + Array issue.
#1

Hi there, I am having a little problem with my sscanf line to login. I am getting an error that
pawn Код:
error 006: must be assigned to an array
And here is my sscanf code.
pawn Код:
sscanf(line, "p<|>s[50]s[50]dddds[50]ds[50]", Data[0], Data[1], Data2[0], Data2[1], Data2[2], Data2[3], Data[3], Data2[4], Data[4]);
SetPVarInt(playerid, "Kills", Data2[0]);
SetPVarInt(playerid, "Deaths", Data2[1]);
SetPlayerScore(playerid, Data2[2]);
SetPVarInt(playerid, "MoneyGaved", Data2[3]);
PlayerInfo[playerid][Admin] = Data2[4];
PlayerInfo[playerid][Gender] = Data[4]; //Error right here
SendClientMessage(playerid, ORANGE, "SERVER: Successfully logged in!");
I can't figure out why, can someone help please.
Reply
#2

What format is PlayerInfo[playerid][Gender]? Is it an array?
Reply
#3

Its a enum.

pawn Код:
enum pInfo
{
    User,
    Pass,
    Kills,
    Deaths,
    Score,
    Money,
    IP,
    Admin,
    Gender,
    Age,
    CameFrom
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#4

Well if I'm not mistaken, Data[4] would appear to be a string? Since that's what you're specifying it as in the sscanf function.

So the Gender variable should also be a string.

pawn Код:
enum pInfo
{
    User,
    Pass,
    Kills,
    Deaths,
    Score,
    Money,
    IP,
    Admin,
    Gender[50],
    Age,
    CameFrom
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#5

Hmmmm, okay I'll tets that and see if it works. Thanks JaTochNietDan.

EDIT;
Yeah it worked, couldn't believe I didn't think of that, Thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)