SA-MP Forums Archive
Help "invalid array size (negative, zero or out of bounds) - 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: Help "invalid array size (negative, zero or out of bounds) (/showthread.php?tid=513559)



Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

I don't know the Problem Here or whre the Error is but this is what i added before that Error came


pawn Код:
else if(IsARRWrecker(vehicleid))
        {
            if(PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 4)
            {
                SendClientMessageEx(playerid, COLOR_GREEN, "__________________RAPID RECOVERY WRECKER____________________");
                SendClientMessageEx(playerid, COLOR_GRAD2, "<< Avaiable wrecker commands: >>");
                SendClientMessageEx(playerid, COLOR_GRAD2, "<< /wreck /unwreck /impound >>");
                SendClientMessageEx(playerid, COLOR_GREEN, "____________________________________________________________");
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
                defer NOPCheck(playerid);
                SendClientMessageEx(playerid, COLOR_GRAD2, "You are not atleast rank 4 and above in Rapid Recovery");
            }
        }
        else if(IsARRTower(vehicleid))
        {
            if(PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 2)
            {
                SendClientMessageEx(playerid, COLOR_GREEN, "__________________RAPID RECOVERY TOW TRUCK____________________");
                SendClientMessageEx(playerid, COLOR_GRAD1, "<< Avaiable tow commands: >>");
                SendClientMessageEx(playerid, COLOR_GRAD1, "<< /tow /untow /impound >>");
                SendClientMessageEx(playerid, COLOR_GREEN, "______________________________________________________________");
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
                defer NOPCheck(playerid);
                SendClientMessageEx(playerid, COLOR_GRAD2, "You are not atleast rank 2 and above in Rapid Recovery");
            }
        }
        else if(IsARRBattery(vehicleid))
        {
            if(PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 1)
            {
                SendClientMessageEx(playerid, COLOR_GREEN, "__________________RAPID RECOVERY BATTERY______________________");
                SendClientMessageEx(playerid, COLOR_GRAD1, "<< Avaiable mechanic commands: >>");
                SendClientMessageEx(playerid, COLOR_GRAD1, "<< /fix /refill >>");
                SendClientMessageEx(playerid, COLOR_GREEN, "______________________________________________________________");
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
                defer NOPCheck(playerid);
                SendClientMessageEx(playerid, COLOR_GRAD2, "You are not atleast rank 3 and above in Rapid Recovery");
            }
        }

And After i Compile and Run This Error Came

invalid array size (negative, zero or out of bounds)


This is the Same Script with it that i didn't encounter any errors

pawn Код:
else if(IsAnAmbulance(vehicleid)) {
            if(PlayerInfo[playerid][pFaction] == 3 || PlayerInfo[playerid][pLeader] == 3) {
                if(LAFDVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5) {
                    RemovePlayerFromVehicle(playerid);
                    new Float:slx, Float:sly, Float:slz;
                    GetPlayerPos(playerid, slx, sly, slz);
                    SetPlayerPos(playerid, slx, sly, slz);
                    NOPCheck(playerid);
                    SendClientMessage(playerid, COLOR_GRAD2, "Only ranks 5+ can drive this vehicle.");
                }
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   You're not in the LAFD!");
                RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
                NOPCheck(playerid);
            }
        }

I Really Need Help! I'm new here i really really wanna know anything/everything about Scripting


Re: Help "invalid array size (negative, zero or out of bounds) - Dignity - 17.05.2014

Can you remove all of the code apart from the parts that give the errors?

Also, please put all your code in [pawn] [ /pawn] brackets! (:

pawn Код:
code



Re: Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

@Mionee Done
Please Help me , I that's the only Problem of my Script


Re: Help "invalid array size (negative, zero or out of bounds) - Dignity - 17.05.2014

What line does the error occur on?


Re: Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

Sorry Mionee but i don't know where the Error Occur

But when i compile and run the Error is "invalid array size (negative, zero or out of bounds)"

I'm new in scripting so i don't know how to find where the Error Occurs

But Like i said when i Put the "ScriptThe First Pawn) and i compile and run the Error Occurs

Help please


Re: Help "invalid array size (negative, zero or out of bounds) - Dignity - 17.05.2014

Your compiler output shows what line the error occurs on.

This comes from my compiler output, just to give an example:
pawn Код:
C:\Users\Harukaze\Desktop\Pawn Library\ex.pwn(8) : error 032: array index out of bounds (variable "var")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
The (8) is the line it's on. If you paste your compiler output here, I can tell you what line it's on and you can paste that line here.


Re: Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

Yes using that how to Trace the Error?? i Don't Understand how to Trace the Error

Sorry i'm new in scripting :3


Re: Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

The Error is 759

The OPGVehicles[0]

i made it Zero because the Faction doesn't have Fac Cars right now

How to fix it?


Re: Help "invalid array size (negative, zero or out of bounds) - cedizon - 17.05.2014

Closed , Fixed But thanks Mionee