Array sizes do not match -
dusk - 28.03.2013
Hey,
Error:
pawn Код:
array sizes do not match, or destination array is too small
Line:
pawn Код:
PlayerInfo[playerid][Job]="Mechanic";
Seriously,what is wrong?
Re: Array sizes do not match -
Jstylezzz - 28.03.2013
pawn Код:
format(PlayerInfo[playerid][Job],sizeof(PlayerInfo[playerid][Job]),"%s","Mechanic");
Make sure 'Job' is a string, if it's not, it won't work.
Re: Array sizes do not match -
Jeffry - 28.03.2013
pawn Код:
format(PlayerInfo[playerid][Job], sizeof(PlayerInfo[playerid][Job]), "Mechanic");
Might not be the best solution, but unless you provide us your enum definitions, I can't state much more.
Re: Array sizes do not match -
dusk - 28.03.2013
Here is my enum:
pawn Код:
enum pInfo
{
userid,
username[128],
pPass[128],
alevel,
money,
level,
SkinID,
Leader[32],
Job[32]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Yea, i though of format myself...just didn't want to use it. Is there a better way?
Re: Array sizes do not match -
Jeffry - 28.03.2013
Quote:
Originally Posted by dusk
Yea, i though of format myself...just didn't want to use it. Is there a better way?
|
Well, according to your enum the ways stated above should work and seem to be the best ones to use. I do not know of any way to set this with ="...";
What's so bad in using format? ^^
Re: Array sizes do not match -
Jstylezzz - 28.03.2013
I suggest you use 'Job' as a integer, and make the mechanic job for example, number 1. Then to check the job, just do
pawn Код:
if(PlayerInfo[playerid][Job] == 1) {
//code
}
Re: Array sizes do not match -
Konstantinos - 28.03.2013
Quote:
Originally Posted by Jeffry
What's so bad in using format? ^^
|
I've heard format is slower than other methods for formating a string.
Re: Array sizes do not match -
dusk - 28.03.2013
Exactly,i heard that as well.
Anyway,this topic is done. I used Jari's suggestion. Thank you all!
Re: Array sizes do not match -
Omirrow - 28.03.2013
should use the numbers
pawn Код:
if(PlayerInfo[playerid][Job] == 1)
{
}
etc.
Re: Array sizes do not match -
Pottus - 28.03.2013
I like the number idea but that is really bad practice to do it in such a direct manner use #define define your jobs then reference them that way.
#define JOB_MECHANIC 1
#define JOB_GUNDEALER 2
#define JOB_DRUGDEALER 3