error 029: invalid expression, assumed zero
#1

I have this error:
Код:
error 029: invalid expression, assumed zero
On this line under:
Код:
strtok(const string[], &index)
How to fix it? +rep to the one who helps me!

And also ive got this Warnings:
Код:
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43771) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43772) : warning 219: local variable "cmd" shadows a variable at a preceding level
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43786) : warning 219: local variable "string" shadows a variable at a preceding level
On lines:
Код:
Line 43771: new idx;
Line 43772: new cmd[128];
Line 43786: new string[100];
The Errors and Warnings:
Код:
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43771) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43772) : warning 219: local variable "cmd" shadows a variable at a preceding level
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43786) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43803) : error 029: invalid expression, assumed zero
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43803) : error 029: invalid expression, assumed zero
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43803) : error 029: invalid expression, assumed zero
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(43803) : fatal error 107: too many error messages on one line
The Whole Code:
Код:
	if(strcmp(cmd, "/getevidence", true) == 0)
	{
    new idx;
    new cmd[128];
	cmd = strtok(cmdtext, idx);
    {
            if(IsACop(playerid)) //Your own variable u must change it
	        {
	            SendClientMessage(playerid, COLOR_RED, "   You are not a Cop / FBI / Prison Guard !");
	            return 1;
	        }
            foreach (Player, i)
			{
			  if(IsPlayerInRangeOfPoint(playerid, 3, Xa[i], Ya[i], Za[i]))
 			  {

				 new name[128];
				 new string[100]; //Not sure about this size
                 GetPlayerName(killer1[i], name, sizeof(name));
				 format(string, sizeof(string),"The body was murdered by %s , Cause: %s.",name,Reason[i]);
				 SendClientMessage(playerid, COLOR_RED, string);

			  }
			  else
 			  {
                SendClientMessage(playerid, COLOR_RED, "   You are not near any deadbody");
	            return 1;
	          }
			}
	}
	return 0;
}
#define index

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return 1;
	}
Reply
#2

remove that strtok function or post the whole strtok function.
Reply
#3

There are already these variables above, re-name them to:
pawn Код:
new
    idx2,
    cmd2[ 128 ],
    string2[ 100 ]
;
Reply
#4

Quote:
Originally Posted by [bot]fatninja
Посмотреть сообщение
remove that strtok function or post the whole strtok function.
Here is the Whole Strok.. I think..
Код:
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return 1;
	}
Reply
#5

None of them worked :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)