ERROR: array must be indexed (variable "cmd")
#1

C:\Users\JordiX\Desktop\samp\gamemodes\lvdm.pwn(19 0) : error 033: array must be indexed (variable "cmd")

what is this?? how to fix? line 190:

public OnPlayerCommandText(playerid, cmdtext[])
{
cmd = strtok(cmdtext, idx);
if(!strcmp(cmdtext, "/help", true))
{
ShowPlayerDialogHelpCommand(playerid);
return 1;
}
return 0;
Reply
#2

Why do you even have it in that snippet of code, you never use it?

Anyway it needs to be indexed, like it says. When you create the variable cmd, create it as an array.

pawn Код:
new cmd [128];
Reply
#3

where to put it?

i get the same error :S
Reply
#4

Put that before using it

like OnPlayerCommandText

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        new string[256];
        new tmp[256];
        new cmd[256];
        cmd = strtok(cmdtext, idx);
This is an example of my script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)