Strtok together!
#1

Hello how i can put those two strtoks togehter?

Код:
stock strtok(const string[], &index,seperator=' ')
{
	new length = strlen(string);
	new offset = index;
	new result[MAX_STRING];
	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;
}

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

why should you put them together? lol
Reply
#3

Don't use strtok, it's crap.
Reply
#4

That wasn't my question, I need those fuctions togehter, I get errors when I use both, duh!
Its from Ladmin so i have to use it!
Reply
#5

Lol, just get rid of those two, and get the function again from wiki.sa-mp.com
Reply
#6

Just delete one and you won't get any errors
Reply
#7

Yeah thats should be fatastic but no!
If i delete on, I only can compile my GM but not Ladmin, if I delete the other on, i only can compile Ladmin without errors.
So thats the way how i do it now...
and it takes long!
is it so hard for ppl like you to put this together? wow didnt know that
Reply
#8

Assuming that strtok is used both on your gamemode and also in your filterscript (LAdmin) then you can just leave it. You shouldn't have any warnings. If you do, then why not just rename one of the functions to strtok2 in either the gamemode or filterscript. If you wish to rename then just use the 'Replace' feature in Pawno. (Hit Ctrl+H) and it'll rename all the strtok to strok2. Simple as that.

Good Luck
Reply
#9

yeah i tried that, put my fault, i mean My Gamemode and Include...

dude lol why I didn't think on that :P thanks .. its works when I renamed on of them
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)