SA-MP Forums Archive
Compil Problem - 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: Compil Problem (/showthread.php?tid=98870)



Compil Problem - rootman - 23.09.2009

Hello

I have a problem on my GM sarp mode
when I compile under samp 0.2x i have no worries
but when I compile under 03 Rc6 i have these errors

Code:
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(12723) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(14374) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(14466) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(14549) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(38487) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(38774) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(38828) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(38965) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(38998) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39063) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39671) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39681) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39793) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39813) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39820) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Administrateur\Bureau\preparation 03\sarp.pwn(39881) : error 047: array sizes do not match, or destination array is too small
How can I settle this errors

PS :I am new writer pawn

Sorry for my bad english


Re: Compil Problem - Correlli - 23.09.2009

Post the code from one of the lines.


Re: Compil Problem - rootman - 23.09.2009

Code:
	if(strcmp(cmd,"/unban",true)==0)
	{
		if (PlayerInfo[playerid][pAdmin] < 4)
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not authorized to unban");
			return 1;
		}
		new unbanname[64];
		unbanname = strtok(cmdtext,idx);  <==== /*here*/
		if(!strlen(unbanname))
		{
			SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /unban [fullName]");
			return 1;
		}
		//new sql[256];
		format(sql, sizeof(sql), "SELECT id FROM players WHERE Name='%s'", unbanname);
		printf("%s", sql);
		samp_mysql_query(sql);
		//if (DEBUG) SQLLog(sql);
		samp_mysql_store_result();
Code:
	if(strcmp(cmd, "/famput", true) == 0)
	{
	new fam = PlayerInfo[playerid][pFMember];
	GetPlayerName(playerid, playername, sizeof(playername));
	if (fam >= MAX_FAMILY)
	  {
	  SendClientMessage(playerid, COLOR_GREY, "You are not in the family!");
	  return 1;
	  }
	if (!PlayerToPoint(2.0, playerid, FamilyInfo[fam][FamilyExt][0], FamilyInfo[fam][FamilyExt][1], FamilyInfo[fam][FamilyExt][2]))
	  {
	  SendClientMessage(playerid, COLOR_GREY, "You are not at your family turf");
	  return 1;
	  }
	new subcmd[MAX_PLAYER_NAME];
	subcmd = strtok(cmdtext,idx); <==== /*here*/
	if (!strlen(subcmd))
	  {
	  SendClientMessage(playerid, COLOR_GREY, "USAGE: /famput [money|mats|drugs] [amount]");
	  return 1;
	  }
	tmp = strtok(cmdtext,idx);
eroors line containing subcmd = strtok(cmdtext,idx);

sry for my bad english



Re: Compil Problem - Correlli - 23.09.2009

Quote:

new subcmd[MAX_PLAYER_NAME];
subcmd = strtok(cmdtext,idx);

MAX_PLAYER_NAME is defined as 24, i think that isn't enough, change it to 128:
pawn Code:
new subcmd[128];
subcmd = strtok(cmdtext,idx);



Re: Compil Problem - rootman - 23.09.2009

i am test your change but always errors even



Re: Compil Problem - Donny_k - 23.09.2009

It's because the 'strtok' string is larger than the one you are using, read the size in your 'strtok' function to see what is required.


Re: Compil Problem - rootman - 23.09.2009

i have difficulty a understand what you wanted to say by the 'strtok' string is larger and strtok' function to see what is required.

can you show an example pls ?

advance thanks




Re: Compil Problem - Donny_k - 24.09.2009

One string is 128, one string is 256, you try to place 256 cells into 128 cells worth of space and it will give you that error as they don't match 128 < 256.

Wrong:

pawn Code:
new
  string1[ 256 ],
  string2[ 128 ];

string2 = string1; //this would be strtok
Right:

pawn Code:
new
  string1[ 128 ],
  string2[ 128 ];

string2 = string1; //this would be strtok



Re: Compil Problem - rootman - 24.09.2009

it s good very thanks ^^

ps: i need a robbank systheme where i can find it

very thanks for your help ^^


Re: Compil Problem - Jose 510 - 24.09.2009

Quote:
Originally Posted by rootman
it s good very thanks ^^

ps: i need a robbank systheme where i can find it

very thanks for your help ^^
Search. There has been a couple posted already.