sscanf + Array issue. - 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: sscanf + Array issue. (
/showthread.php?tid=167506)
sscanf + Array issue. -
Toni - 12.08.2010
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.
Re: sscanf + Array issue. -
JaTochNietDan - 12.08.2010
What format is PlayerInfo[playerid][Gender]? Is it an array?
Re: sscanf + Array issue. -
Toni - 12.08.2010
Its a enum.
pawn Код:
enum pInfo
{
User,
Pass,
Kills,
Deaths,
Score,
Money,
IP,
Admin,
Gender,
Age,
CameFrom
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Re: sscanf + Array issue. -
JaTochNietDan - 12.08.2010
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];
Re: sscanf + Array issue. -
Toni - 12.08.2010
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!