Error, Array. - 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: Error, Array. (
/showthread.php?tid=159547)
Error, Array. -
oliverrud - 13.07.2010
pawn Код:
if(HQInfo[i][Owner] == pname)
Код:
error 033: array must be indexed (variable "pname")
It's quite obvious what I'm trying to do: I'm trying to make it check if HQ[i][Owner] is the players name.
Re: Error, Array. -
RyDeR` - 13.07.2010
lol, use strcmp.
EDIT:
pawn Код:
if(!strcmp(HQInfo[i][Owner], pname, true))
{
// the same name
}
else
{
// not the same name
}
Re: Error, Array. -
oliverrud - 13.07.2010
if(strcmp(HQInfo[i][Owner],pname)) doesn't work
Guess I'm failing.
Edit: Atleast it says that I'm not the owner even though I am
Re: Error, Array. -
RyDeR` - 13.07.2010
Quote:
Originally Posted by oliverrud
if(strcmp(HQInfo[i][Owner],pname)) doesn't work Guess I'm failing.
Edit: Atleast it says that I'm not the owner even though I am
|
strcmp works %100 fine.
There's something wrong with the values in it.
Re: Error, Array. -
oliverrud - 13.07.2010
Found a solution, just had to change it.
pawn Код:
if(strcmp(HQInfo[i][Owner],pname))
{
// Right Message if owner
}
else
{
// Wrong message if not owner
}
Just replaced that with:
pawn Код:
if(strcmp(HQInfo[i][Owner],pname))
{
// wrong message if not owner
}
else
{
// right message if owner
}
Re: Error, Array. -
Mauzen - 13.07.2010
Did you use the '!' (not) or '== 0'? strcmp does return 0, if the strings are identical.
EDIT: Ok, your other solution is possible, too.
Re: Error, Array. -
oliverrud - 13.07.2010
Yea should have used the ! now that your saying it anyways got it fixed, thanks to you both!