Array Size
#1

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;
}
Reply
#2

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

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.
Reply
#4

What is the function createReport?
Reply
#5

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

replace r_Text[200] with r_Text[256]
Reply
#7

Same problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)