#1

Okay, as I know 256 is not higly recommended, so I tryed to use 128, but I get :

Код:
C:\Documents and Settings\Convidado\Meus documentos\MedicDCMD.pwn(109) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Convidado\Meus documentos\MedicDCMD.pwn(109) : error 047: array sizes do not match, or destination array is too small
Command:

Код:
	new index, cmd[256], tmp[256], id;
	cmd = strtok(cmdtext, index);
	
	if (strcmp(cmd, "/heal", true) == 0)
	{
		tmp = strtok(cmdtext, index);
		if (strlen(tmp))
		{
			id = strval(tmp);
			if (IsPlayerConnected(id))
			{
				SetPlayerHealth(id, 100.0);
				SendClientMessage(id, 0x00FF00AA, "You have been healed");
				SendClientMessage(playerid, 0x00FF00AA, "Player healed");
			}
			else
			{
				SendClientMessage(playerid, 0xFF0000AA, "Player not found");
			}
		}
		else
		{
			SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
		}
		return 1;
	}
On my Gamemode, it has registration and login system so it includes dudb and dini, so the strtok is already included. How could I set my command to allow 128 cells?
Reply
#2

Just read the error it explains it, try like 200 or w/e.
Reply
#3

Nope, do you think doesn't tried it? -.-
Reply
#4

Well - sorry for trying to help.
Reply
#5

Nothing wrong whit the code..I compiled and no errors..

Ecko
Reply
#6

because the cells are 256, try 128 then you get the errors. cmd[256]
Reply
#7

Help? please it's really important ...
Reply
#8

Quote:
Originally Posted by Hot
because the cells are 256, try 128 then you get the errors. cmd[256]
Well there is the problem..the error is saying the same as you do... ---> array is too small !
just leave the 256!

Ecko
Reply
#9

If you read the error, it says the array sizes don't match.
Reply
#10

Quote:
Originally Posted by Weirdosport
If you read the error, it says the array sizes don't match.
I think that didnt help :S

Your strtok uses 256 cells which is a total waste
Just use that strtok => https://sampwiki.blast.hk/wiki/Strtok
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)