Code

//God Mode
 }else if(stricmp(lpcLine, "!god") == 0){
  bRet = false;
  if(ADDR_GODMODE[0] != 0x90){
  BYTE godmode[] = {0x90, 0x90};
  EnableHack((BYTE*)ADDR_GODMODE, godmode, 2);
  Echo("GodMode On");
 }
  else{
  BYTE godmode[] = {0x7B, 0x05};
  EnableHack((BYTE*)ADDR_GODMODE, godmode, 2);
  Echo("GodMode Off");
 }

Error

error C2109: subscript requires array or pointer type

Recommended Answers

All 5 Replies

The compilers I use will take you to the potential culprit line. If yours does too then telling us which line is pointed to gives us, and you too, an idea of where to start. Since:

BYTE godmode[] = {0x90, 0x90};

and this:

BYTE godmode[] = {0x7B, 0x05};

are both local array declarations, then I must assume from the code posted that the culprit may be this:


ADDR_GODMODE[0]

If ADDR_GODMODE isn't an array or a pointer or a vector or a map then the use of subscript operator [] is illegal unless you have overloaded the [] operator for whatever type ADDR_GODMODE is. However, since ADDR_GODMODE isn't declared in the code snippet posted I have no idea what type it is.

ADDR_GODMODE = the address im changing with

BYTE godmode[] = {0x90, 0x90};

and this:

BYTE godmode[] = {0x7B, 0x05};

Please post entire function and complete error message including line number -- we still have no clude how ADDR_GODMODE is declared or what line number that error occurred.

NVM I Fixed It ;)

apart from when i activate it it works but when i type !god again to de-activate it, it just says GodMode On.... and dosent de-activate it

//God Mode
}else if(stricmp(lpcLine, "!god") == 0){
bRet = false;
if(0x00481692 != 0x90){
BYTE godmode[] = {0x90, 0x90};
EnableHack((BYTE*)ADDR_GODMODE, godmode, 2);
Echo("GodMode On");
}
else{
BYTE godmode[] = {0x7B, 0x05};
EnableHack((BYTE*)ADDR_GODMODE, godmode, 2);
Echo("GodMode Off");
}

stricmp() will return zero if the two strings are equal from a case insensitive point of view. Therefore if you compare the input line, which I presume is lpcLine with !god using stricmp() and the result equals zero then lpcLine is !god and you would presumably output GodModeOff rather than GodModeOn using the Echo() statement, though I have no idea what Echo() really does.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.