SA-MP Forums Archive
Help please. A few errors.(strtok) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please. A few errors.(strtok) (/showthread.php?tid=106947)



Help please. A few errors.(strtok) - MichalGusta - 07.11.2009

Hello, I have just started to learn Pawn coding. I took TGP Gamemode found here and found may errors. (Most where about array size not matching, which I was able to fix by using skills I picked up from school when I learned VB and VC, and using the Wiki.) Now I get these errors.

Код:
C:\Users\Randall\Downloads\samp\TPG Roleplay\TPG Roleplay\gamemodes\TPGSERVER.pwn(11600) : error 021: symbol already defined: "strtok"
C:\Users\Randall\Downloads\samp\TPG Roleplay\TPG Roleplay\gamemodes\TPGSERVER.pwn(11615) : error 047: array sizes do not match, or destination array is too small
And it points me to here.

Код:
stock strtok(const string[], &index,seperator=' ')
{
 	new length = strlen(string);
	new offset = index;
	new result[256];
	while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
  {
		result[index - offset] = string[index];
		index++;
	}

	result[index - offset] = EOS;
	if ((index < length) && (string[index] == seperator))
	{
	index++;
	}
	return result;
}
Now I did some random test which included reming this out when I did that I could register but not login. also I could spawn but with no money, which if I am correct from what I saw in the scripting you do start with money.

I know I have to remove a strtok but i have no clue from where.


Re: Help please. A few errors.(strtok) - jesse237 - 09.11.2009

well i was working with kind of the same problem as you.
now i found out (if you are working with 0.3)
when you delete:
Код:
#include "../include/gl_common.inc"
it also solves the problem.
so strtok is already defined in that include i guess!
still my function doesn't work properly
it's seif's Include: Walk.
I've tried to include it and it works half