Array must be indexed, Help please
#1

Код:
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]}
Reply
#2

You can't use if-statement to compare strings, use strcmp - https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

He can also use strfind.
Reply
#4

aha, Thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)