Short question.
#1

Hey guys. Why do I have this warning?

pawn Код:
PlayerInfo[playerid][pFaction] = dini_Get(file, "Faction");
Код:
C:\Users\Bart\Desktop\infinityrp\gamemodes\infinityrp.pwn(599) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Because you cannot assign a string to a variable directly. Use strcat or format.
Reply
#3

strcat(PlayerInfo[playerid][pFaction] = dini_Get(file, "Faction"));

Same error.

I have pFaction[60]; on top
Reply
#4

Does anyone knows the problem?
Reply
#5

Try this:

pawn Код:
new pFactionS[60];

format(pFactionS,sizeof(pFactionS),"%s",dini_Get(file, "Faction"));

PlayerInfo[playerid][pFaction] = pFactionS;
Reply
#6

pawn Код:
strmid(PlayerInfo[playerid][pFaction],dini_Get(file, "Faction"), false, strlen(dini_Get(file, "Faction")), 60);
Reply
#7

Thanks both. I'm using your code Donya.
Now how will I do this?

pawn Код:
COMMAND:join(playerid,params[])
{
    new f[80];
    if(sscanf(params,"s[80]",f)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /join [faction]");
    PlayerInfo[playerid][pFaction] = f;
    return 1;
}
Код:
C:\Users\Bart\Desktop\infinityrp\gamemodes\infinityrp.pwn(459) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

Make the string sizes same. If pFaction is 60, format the string with length 60.

pawn Код:
new f[60];
Reply
#9

Ahaha lol. THanks xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)