Strtok Error help - 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)
+--- Thread: Strtok Error help (
/showthread.php?tid=626519)
Strtok Error help -
TobiasJones - 16.01.2017
C:\Users\A\Desktop\Server\Script\filterscripts\fur nituresys.pwn(487) : error 021: symbol already defined: "strtok"
How to fix this error? I tried much but didn't find a way.
PHP код:
if(strcmp(cmd,"/Remove",true) == 0)
{
new tmp[128], id, string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
there is much like this, which means I made many commands with ''strtok''
Re: Strtok Error help -
RyderX - 16.01.2017
PHP код:
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;
}
Re: Strtok Error help -
TobiasJones - 16.01.2017
Still doesn't work.
Re: Strtok Error help -
RyderX - 16.01.2017
Create a stock for it..
PHP код:
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;
}
Re: Strtok Error help -
TobiasJones - 16.01.2017
mate when I add your code it gives me the same error, when I delete it, it works without any error.
BUT, the commands doesn't work
Re: Strtok Error help - iLearner - 16.01.2017
Line 487, script fur nituresys.pwn
Re: Strtok Error help -
GoldenLion - 16.01.2017
You probably have defined it twice or if you haven't then show your whole OnPlayerCommandText. I suggest you using a command processor and sscanf for commands though. It would be easier and faster.
Quote:
Originally Posted by RyderX
Create a stock for it..
PHP код:
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;
}
|
A function, not a stock!
https://sampforum.blast.hk/showthread.php?tid=570635
Re: Strtok Error help -
oMa37 - 16.01.2017
Quote:
Originally Posted by RyderX
PHP код:
strtok(const string[], &index)
//CODE
|
Код:
symbol already defined: "strtok"
OT: It means you have 'strtok' function defined more than once, Find the duplicated version and remove it.