SA-MP Forums Archive
cmds problem help rep+ - 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: cmds problem help rep+ (/showthread.php?tid=321856)



cmds problem help rep+ - N0FeaR - 28.02.2012

Error i get

Код:
C:\Users\Robin\Desktop\New folder\pawno\include\/CRP/Publics/OnPlayerCommand.pwn(194) : error 047: array sizes do not match, or destination array is too small



CMD
Код:
}
    if(strcmp(cmd, "/use", true) == 0) // by Cuervo
	{
		if(IsPlayerConnected(playerid))
		{
			new x_nr[24];
			x_nr = strtok(cmdtext, idx);
			if(!strlen(x_nr))
			{
			    SendClientMessage(playerid, COLOR_GREY, "USAGE: /use [backpack, briefcase, nothing]");
			    SendClientMessage(playerid, COLOR_GREY, "TIP: \"nothing\" will remove the item from your body!");
				return 1;
			}
			if(strcmp(x_nr,"backpack",true) == 0)
			{
   				AttachObjectCorrectly(playerid, 3026);
			}
			else if(strcmp(x_nr,"briefcase",true) == 0)
			{
   				AttachObjectCorrectly(playerid, 1210);
			}
			else if(strcmp(x_nr,"nothing",true) == 0)
			{
			    RemovePlayerAttachedObject(playerid,3);
			}
			else return SendClientMessage(playerid, COLOR_GREY,"* Unknown item!");
        }
		return 1;



Re: cmds problem help rep+ - Twisted_Insane - 28.02.2012

Which is the line giving you the error? Seems to be a little problem in your arrays...

Or give your variable "x_nr" the value "128", not only "24", because it seems to be too small! I just read in some topic about such an error, lol!


Re: cmds problem help rep+ - Konstantinos - 28.02.2012

Try set the value on the variable because it probably is too small.
pawn Код:
new x_nr[ 256 ];
As you are using strcmp.


Re: cmds problem help rep+ - N0FeaR - 28.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Try set the value on the variable because it probably is too small.
pawn Код:
new x_nr[ 256 ];
As you are using strcmp.
Thank you.