SetPlayerInfo give some erros -
BritishBoy - 08.04.2011
Hi!
I have another question.
My function give some errors
Код:
stock SetPlayerInfo(playerid, info[], newinfo[])
{
AccountInfo[playerid][info]=newinfo;
return 1;
}
Код:
\pawno\include\gamemode/account.inc(175) : error 033: array must be indexed (variable "info")
\pawno\include\gamemode/account.inc(175) : error 006: must be assigned to an array
This is how I use this function (example):
SetPlayerInfo(playerid, "WarnReason", "DM To Much"); //SetPlayerInfo(playerid, info[], newinfo[])
Re: SetPlayerInfo give some erros -
SchurmanCQC - 08.04.2011
pawn Код:
stock SetPlayerInfo(playerid, info[], newinfo[])
{
AccountInfo[playerid][info] = newinfo;
return 1;
}
Respuesta: SetPlayerInfo give some erros -
admantis - 08.04.2011
The [] signs are used for strings only!
pawn Код:
stock SetPlayerInfo(playerid, info, newinfo)
{
AccountInfo[playerid][info]=newinfo;
return 1;
}
Quote:
Originally Posted by Schurman
pawn Код:
stock SetPlayerInfo(playerid, info[], newinfo[]) { AccountInfo[playerid][info] = newinfo; return 1; }
|
The code is exactly the same! PAWN is not sensitive to whitespace additions.
pawn Код:
x=x+1;
// is the same of
x = x + 1;
// and viceversa
Re: SetPlayerInfo give some erros -
BritishBoy - 08.04.2011
Yes, thats what I want.
This is how I use this function (example):
SetPlayerInfo(playerid, "WarnReason", "DM To Much"); //SetPlayerInfo(playerid, info[], newinfo[])
Re: SetPlayerInfo give some erros -
Sascha - 08.04.2011
what about
:
pawn Код:
stock SetPlayerInfo(playerid, info[], newinfo[])
{
format(AccountInfo[playerid][info], sizeof(AccountInfo[playerid][info]), "%s", newinfo);
return 1;
}
not sure whether this will work though
Re: SetPlayerInfo give some erros -
Mean - 08.04.2011
Your WarnReason can't be a string, it must be
pawn Код:
SetPlayerInfo(playerid, WarnReason, "DM To Much"); //SetPlayerInfo(playerid, info[], newinfo[])
So, you'd have to make a special function for strings, and for integers, etc.
Re: SetPlayerInfo give some erros -
BritishBoy - 09.04.2011
How do you mean?
Can you give an example?
Re: SetPlayerInfo give some erros -
Vince - 09.04.2011
What name did you give your enumerator? You'll need that as a tag for your function.
pawn Код:
SetPlayerInfo(playerid, pInfo:info, int_newinfo, str_newinfo[] = "")
{
if(strlen(str_newinfo))
{
// There's some string passed, copy it
strcat((AccountInfo[playerid][info] = EOS, AccountInfo[playerid][info]), str_newinfo);
return 1;
}
AccountInfo[playerid][info] = int_newinfo;
return 1;
}
Re: SetPlayerInfo give some erros -
BritishBoy - 10.04.2011
Nice and thanks!,
I see where the info will be set if it is an int, but where does it set the info if it is a string?