SA-MP Forums Archive
Array Size - 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)
+--- Thread: Array Size (/showthread.php?tid=651436)



Array Size - Hunud - 20.03.2018

Where's the problem,

Log:

Код:
error 047: array sizes do not match, or destination array is too small
error 035: argument type mismatch (argument 2)


Code:

Код:
CMD:reportplayer(playerid, params[])
{
	new target, string[ 130 ], text[256];

  	if (sscanf(params, "us[256]", target, text))
  	{
    	if(!IsPlayerConnected(target)) return SCM(playerid, -1, "* Not found.");
    	createReport(NbRapport, text, GetName(playerid), GetName(target)); //here
    	SCM(playerid, -1,"* Report send"); //here
 	}
  	else
  	{
 	 	SCM(playerid, -1, "/report ID Reason");
    	return 1;
  	}
  	return 1;
}



Re: Array Size - rfr - 20.03.2018

try
if (sscanf(params, "us[256]", target, text[256]))


Re: Array Size - iKarim - 20.03.2018

Quote:
Originally Posted by rfr
Посмотреть сообщение
try
if (sscanf(params, "us[256]", target, text[256]))
Nope, that's invalid and will result in array index out of bounds.

Post your "createreport" definition, also I'd advice not returning players name like that, use the native function instead.


Re: Array Size - Dayrion - 20.03.2018

What is the function createReport?


Re: Array Size - Hunud - 20.03.2018

forward createReport(r_Id,r_Text[200],r_Name[MAX_PLAYER_NAME+1],r_For[MAX_PLAYER_NAME+1]);


Re: Array Size - rfr - 20.03.2018

replace r_Text[200] with r_Text[256]


Re: Array Size - Hunud - 20.03.2018

Same problem.