cmds problem help rep+
#1

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

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!
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)