Need help on Array
#1

I have a script like this:
pawn Код:
dcmd_getclass(playerid, params[])
{
  if(strlen(params) == 0){
    SendClientMessage(playerid, 0x00FF00AA, "|- Usage: /getclass [class] -|");
    SendClientMessage(playerid, 0xFF0000AA, "___|- Classes -|___");
    SendClientMessage(playerid, 0xFFFF00AA, "Class \"Normal\" (Requirement: Nothing) (Cost: $0) (Extras: Nothing)");
    SendClientMessage(playerid, 0xFFFF00AA, "Class \"Pilot\" (Requirement: Kill >= 80 | Kill-Death >= -20) (Cost: $10000) (Extras: Able to spawn Planes [/getplane])");
    SendClientMessage(playerid, 0xFFFF00AA, "Class \"Rocket Launcher\" (Requirement: Kill >= 30) (Cost: $2000) (Extras: Get 50 Rocket Launchers every spawn)");
    return 1;
  }
  if(params == "normal"){
    SendClientMessage(playerid, 0x00FF00AA, "|- You are now a normal soldier -|");
  }
  return 1;
}
and it results:

Код:
X:\XXXXX\XXXXX\XXXXX\XXXXX.pwn(209) : error [ LINE OF if(params == "normal"){ ]: array must be indexed (variable "params")
I know why it's wrong. I know it's because that i need to index the array. But i don't know how to do it (fix it). Please help
Reply
#2

pawn Код:
if(!strcmp(params, "normal", false)) // If params == "normal"
due to params being a string.
Reply
#3

Oh yes, i forgot about strcmp...

Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)