Array must be indexed, Help please - 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: Array must be indexed, Help please (
/showthread.php?tid=111519)
Array must be indexed, Help please -
cdcyborg - 02.12.2009
Код:
C:\Network Game Servers\GTA\a Freeroam\filterscripts\main.pwn(2048) : error 033: array must be indexed (variable "tmp")
C:\Network Game Servers\GTA\a Freeroam\filterscripts\main.pwn(2052) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
This is the script, but it has them errors ^ i have tried to fix it myself but cant do it =(
pawn Код:
[2043]irccmd_toggle(conn, channel[], user[], message[]) {
[2044] new tmp[256], string[256];
[2045] tmp = zcmd(1, message);
[2046] if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "[4Error] You Are Not A Channel Admin.");
[2047] if(strlen(tmp) == 0) return ircSay(conn, channel, "[4Error] Usage: !toggle <module>");
[2048] if (tmp == "playerchat") {
[2049] format(string, sizeof(string), "Toggle Playerchat");
[2050] ircSay(conn, channel, string);
[2051] }
[2052] else if (tmp == "playerjoins") {
[2053] format(string, sizeof(string), "Toggle Playerjoins");
[2054] ircSay(conn, channel, string);
[2055] }
[2056]
[2057] format(string, sizeof(string), "%s", tmp);
[2058] ircSay(conn, channel, string);
[2059] return 1;
[2060]}
Re: Array must be indexed, Help please -
Correlli - 02.12.2009
You can't use if-statement to compare strings, use strcmp -
https://sampwiki.blast.hk/wiki/Strcmp
Re: Array must be indexed, Help please -
MenaceX^ - 02.12.2009
He can also use strfind.
Re: Array must be indexed, Help please -
cdcyborg - 02.12.2009
aha, Thanks