Indexed error? - 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: Indexed error? (
/showthread.php?tid=164038)
Indexed error? -
WillyP - 29.07.2010
Hey, I have this error:
pawn Код:
C:\Users\Will\Desktop\San Andreas Stuntz by Lolrofl\filterscripts\teles2.pwn(38) : error 033: array must be indexed (variable "cmd")
heres the line
pawn Код:
cmd = strtok(cmdtext,idx);
help pls
Re: Indexed error? -
ScottCFR - 29.07.2010
Re: Indexed error? -
WillyP - 29.07.2010
same error, someone help??
here are the surrounding linez
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/teleports",true)==0)
{
Re: Indexed error? -
WillyP - 29.07.2010
y'know, a reply might be nice
Re: Indexed error? -
mastasquizy - 29.07.2010
I was looking at this forever, and i see whats wrong. LOL
pawn Код:
if(strcmp(cmd,"/teleports",true)==0)
This should be:
pawn Код:
if(strcmp(cmdtext,"/teleports",true)==0)//note the "cmd" changed to "cmdtext"
strcmp is looking for a string, and cmd[] isn't a string yet....so use cmdtext.
Re: Indexed error? -
WillyP - 29.07.2010
still got the error...