[SOLVED]need some help: array must be indexed - 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: [SOLVED]need some help: array must be indexed (
/showthread.php?tid=118056)
[SOLVED]need some help: array must be indexed -
TheChaoz - 02.01.2010
pawn Код:
new tmp[256], tmp2[256], Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(....);
if(!strlen(tmp2)) return SendClientMessage(....);
new playertoban, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128], string2[128], string3[128];
playertoban = strval(tmp);
Код:
D:\Juan\Programas\GTA\Creaciones Propias\CAdmin v 1.0\FilterScript\CAdmin 1.0.pwn(604) : error 017: undefined symbol "strtok"
D:\Juan\Programas\GTA\Creaciones Propias\CAdmin v 1.0\FilterScript\CAdmin 1.0.pwn(604) : error 033: array must be indexed (variable "tmp")
D:\Juan\Programas\GTA\Creaciones Propias\CAdmin v 1.0\FilterScript\CAdmin 1.0.pwn(605) : error 017: undefined symbol "strtok"
D:\Juan\Programas\GTA\Creaciones Propias\CAdmin v 1.0\FilterScript\CAdmin 1.0.pwn(605) : error 033: array must be indexed (variable "tmp2")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
don't know how to fix this :S
Re: need some help: array must be indexed -
Correlli - 02.01.2010
You need a strtok function in your script.
Re: need some help: array must be indexed -
x-cutter - 02.01.2010
Add this:
Код:
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;
}
at the bottom of your script.
Re: need some help: array must be indexed -
TheChaoz - 03.01.2010
thanks both of u it work now