STRTOK 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: STRTOK help (
/showthread.php?tid=130237)
STRTOK help -
Majataka - 25.02.2010
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:
Re: STRTOK help -
Torran - 25.02.2010
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 )
Re: STRTOK help -
GaGlets(R) - 25.02.2010
Botoom of script..
put this at no callback no {}
if you see
public BLALBALBA()
{
balbla
}
// put it after them !
Re: STRTOK help -
Majataka - 26.02.2010
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
Re: STRTOK help -
BlackFoX - 26.02.2010
You never used strtok where is the Problem
Re: STRTOK help -
Majataka - 26.02.2010
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:
Re: STRTOK help -
[LSR]State_Trooper - 26.02.2010
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
Re: STRTOK help -
VonLeeuwen - 26.02.2010
If you use it, the warning will disappear
Re: STRTOK help -
DarkPower - 26.02.2010
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;
Re: STRTOK help -
BlackFoX - 26.02.2010
stock strtok(const string[], &index)
Replace your Functionsheader with this
Re: STRTOK help -
Correlli - 26.02.2010
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:
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.
Re: STRTOK help -
Niixie - 26.02.2010
i'd say
stock strtok(const string[], &index)
yes