SA-MP Forums Archive
Error help. - 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)
+--- Thread: Error help. (/showthread.php?tid=309622)



Error help. - iGetty - 08.01.2012

Quote:

(33074) : error 032: array index out of bounds (variable "plate")
(33079) : error 032: array index out of bounds (variable "plate")
(33084) : error 032: array index out of bounds (variable "plate")

pawn Код:
command(lookupplate, playerid, params[])
{
    if(gPlayerData[playerid][Faction] == 5)
    {
        new plate[128], string[256];
        if(sscanf(params, "s", plate)) return SendClientMessage(playerid, GREY, "Server: /lookupplate [Plate]");
        {
            for(new i = 0; i < MAX_PLAYERS; i ++)
            {
                if(plate[128] == gPlayerData[i][NumPlate]) //line 33074
                {
                    format(string, sizeof(string), "[%s] This vehicle belongs to %s.", plate, RemoveUnderScore(i));
                    SendClientMessage(playerid, WHITE, string);
                }
                else if(plate[128] == gPlayerData[i][NumPlate2]) //line 33079
                {
                    format(string, sizeof(string), "[%s] This vehicle belongs to %s.", plate, RemoveUnderScore(i));
                    SendClientMessage(playerid, WHITE, string);
                }
                else if(plate[128] == gPlayerData[i][NumPlate3]) //line 33084
                {
                    format(string, sizeof(string), "[%s] This vehicle belongs to %s.", plate, RemoveUnderScore(i));
                    SendClientMessage(playerid, WHITE, string);
                }
                else return SendClientMessage(playerid, WHITE, "This vehicle wasn't found in the vehicle database.");
            }
        }
    }
    else return SendClientMessage(playerid, GREY, "You are not in the correct Faction.");
    return 1;
}
I've marked the lines in the PAWN code.


Re: Error help. - FarSe. - 08.01.2012

new plate[129], string[256];

or:


if(plate[127] == gPlayerData[i][NumPlate]) //line 33074//same for all


Re: Error help. - iGetty - 08.01.2012

OK so I added the thing you said FarSE. and it's now not recognizing the number plate.

I have /setnumplate [plate]

It doesn't do nothing though, just returns: "This vehicle wasn't found in the vehicle database."

What's wrong?