SA-MP Forums Archive
array must be indexed (variable "result") - 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 (variable "result") (/showthread.php?tid=154491)



array must be indexed (variable "result") - Razvann - 14.06.2010

pawn Код:
dcmd_mevent(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
         new sendername[MAX_PLAYER_NAME],string[86];
         GetPlayerName(playerid,sendername,sizeof(sendername));
        new text[128],cash,result[10];
        if(sscanf(params,"isi",cash,text,result))return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /mevent [Prize Money] [The Test] [The Result]");
        if(cash < 1 || cash > 1000000000) return SendClientMessage(playerid,COLOR_WHITE,"ERROR: Invalid prize money. Please use $1 - $1000000000.");
        if(strlen(text) > 20) return SendClientMessage(playerid,COLOR_WHITE,"ERROR: Your question is to long. Please shorten it to 20 characters max.");
        if(result < 1 || result > 10) return SendClientMessage(playerid,COLOR_WHITE,"ERROR: Your result is to long. Please shorten it to 10 characters max."); // line 11631
        SendClientMessage(playerid,COLOR_LIGHTRED,"You have forced a custom math event.");
        format(string,sizeof(string),"Admin %s has started the math event.",sendername);
         SendClientMessageToAll(0x55946AAA,string);
         format(MateString,sizeof(MateString),"%s",text);
        MateCash = cash;
        MateResult = result; // line 11637
        mateTest();
    }
    return 1;
}
Код:
D:\---\---\---.pwn(11631) : error 033: array must be indexed (variable "result")
D:\---\---\---.pwn(11637) : error 006: must be assigned to an array
How can I solve it?
For example:
/mevent 1000 5-2 3


Re: array must be indexed (variable "result") - cessil - 14.06.2010

take the [10] away from result[10];


Re: array must be indexed (variable "result") - Razvann - 14.06.2010

Thanks.