STRTOK help
#1

Okey i need STRTOK but when i search all i see is put
Код:
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;
}
under your script.. jesus christ! Where is the "Under your Script" at the bottom or what? ... i really need it for /carcolor... and https://sampwiki.blast.hk/wiki/Strtok didnt help me this time D:
Reply
#2

Strtok can go anywhere in your script as long as its outside a callback
Most people put it at the bottom of there script, I put it in my include file but yeah,
Put it at the bottom of your script ( Last line )
Reply
#3

Botoom of script..
put this at no callback no {}
if you see
public BLALBALBA()
{
balbla
}
// put it after them !
Reply
#4

This is what i get
Код:
I:\Programfiler\Rockstar Games\GTA San Andreas\Server\gamemodes\Majatacker.pwn(1374) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Line 1335 - the last line
Код:
				if ( listitem > 5 ) return ShowPlayerDefaultDialog( playerid );

	  	  new
	    	  model_array[] = { 441, 464, 465, 501, 564, 594 };

				return CreatePlayerVehicle( playerid, model_array[ listitem ] );
			}
		}
	}
	return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
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;
}
// ----------------------------------What to do--------------------------
// Teleport Menu
// More Races
// /carcolor
// Stunt maps
// Animations
// /vx
Reply
#5

You never used strtok where is the Problem
Reply
#6

Quote:
Originally Posted by BlackFoX_UD_
You never used strtok where is the Problem
So i dont need to care about the "Strtok" warning? P:
Reply
#7

Quote:
Originally Posted by Majataka
Quote:
Originally Posted by BlackFoX_UD_
You never used strtok where is the Problem
So i dont need to care about the "Strtok" warning? P:
That is Correct
Reply
#8

If you use it, the warning will disappear
Reply
#9

Quote:

I:\Programfiler\Rockstar Games\GTA San Andreas\Server\gamemodes\Majatacker.pwn(1374) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


just put this after includes

new strtok;
Reply
#10

stock strtok(const string[], &index)

Replace your Functionsheader with this
Reply
#11

Quote:
Originally Posted by Majataka
So i dont need to care about the "Strtok" warning? P:
Yes you do. You need to care about EVERY warning. To get rid of the "never used" warning then just delete the function or use this:
pawn Код:
#pragma unused MyFunctionName
so it's like this in your case:
pawn Код:
#pragma unused strtok
Quote:
Originally Posted by DarkPower
Quote:

I:\Programfiler\Rockstar Games\GTA San Andreas\Server\gamemodes\Majatacker.pwn(1374) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

just put this after includes

new strtok;
Learn some basics.
Reply
#12

i'd say stock strtok(const string[], &index)
yes
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)