Short question. - 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: Short question. (
/showthread.php?tid=264532)
Short question. -
bartje01 - 26.06.2011
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.
Re: Short question. -
Vince - 26.06.2011
Because you cannot assign a string to a variable directly. Use strcat or format.
Re: Short question. -
bartje01 - 26.06.2011
strcat(PlayerInfo[playerid][pFaction] = dini_Get(file, "Faction"));
Same error.
I have pFaction[60]; on top
Re: Short question. -
bartje01 - 26.06.2011
Does anyone knows the problem?
Re: Short question. -
iPLEOMAX - 26.06.2011
Try this:
pawn Код:
new pFactionS[60];
format(pFactionS,sizeof(pFactionS),"%s",dini_Get(file, "Faction"));
PlayerInfo[playerid][pFaction] = pFactionS;
Re: Short question. -
Donya - 26.06.2011
pawn Код:
strmid(PlayerInfo[playerid][pFaction],dini_Get(file, "Faction"), false, strlen(dini_Get(file, "Faction")), 60);
Re: Short question. -
bartje01 - 26.06.2011
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.
Re: Short question. -
iPLEOMAX - 26.06.2011
Make the string sizes same. If pFaction is 60, format the string with length 60.
Re: Short question. -
bartje01 - 26.06.2011
Ahaha lol. THanks xD