Error, But i dont know how to fix
#1

Hi all,
I have a error and i dont know how to fix :S

Код:
 error 047: array sizes do not match, or destination array is too small
the line:
Код:
	cmd = strtok(cmdtext, idx);
Does somebody knows how to fix it please help me
Reply
#2

can you show us your cmd and idx sources ?
Reply
#3

The problem has be in a Array. That means you have to look for variables that are like this:

Код:
new MyArray[9] [3];
The compiler says it should be too small, so you have to look for the problem, where the array gets an index or a value.
Reply
#4

Quote:
Originally Posted by ► James_Alex
can you show us your cmd and idx sources ?
sure the command:
Код:
	new string[256];
 	dcmd(login,5,cmdtext);
 	dcmd(register,8,cmdtext);
	new cmd[128], tmp[128], idx;
	cmd = strtok(cmdtext, idx);
	if(!strcmp("/job", cmd, true)) if(Logged[playerid] == 1)
	{
	tmp = strtok(cmdtext, idx);
	if (!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /job <JobName>") && SendClientMessage(playerid,COLOR_WHITE,"[ ! ] List of jobs: cop, swat, robber");
	if (!strcmp("cop", tmp, true)) if(IsPlayerJob(playerid) == 1)
	{
	 	if(GetPlayerMoney(playerid) <= 25) return SendClientMessage(playerid,COLOR_RED,"[ ! ] Not enough Money! You need 2000!");
	GivePlayerMoney(playerid, -2000);
	RemovePlayerJob(playerid);
	SetPlayerJob(playerid,2);
	SendClientMessage(playerid,TEAM_COP_COLOR,"[ ! ] Cheif of police: Welcome to officer son !");
	SendClientMessage(playerid,ADMIN_MSG,"[ ! ] You are kicked for ( PLEASE RESTART GAME :) )");
	Kick(playerid);
	return 1;
	}
Reply
#5

Try
Код:
new cmd[256]
Reply
#6

Quote:
Originally Posted by Jefff
Try
Код:
new cmd[256]
God what's this useless post for?
You are misleading him and also his pawn will crash because you missed a ; in the array.
Change the string size to 128.
Reply
#7

Quote:
Originally Posted by Jefff
Try
Код:
new cmd[256]
thnx The error is gone

Reply
#8

Quote:
Originally Posted by MenaceX^
God what's this useless post for?
You are misleading him and also his pawn will crash because you missed a ; in the array.
Change the string size to 128.
Not true. The string has nothing to do with the error. The error is about the array cmd, like he told you before. it was too small, so:
Код:
new cmd[256];
should work very well.

but the problem is solved though
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)