Dont know what error is this :(
#1

[19:56:39] [debug] Run time error 4: "Array index out of bounds"
[19:56:39] [debug] Accessing element at negative index -400
[19:56:39] [debug] AMX backtrace:
[19:56:39] [debug] #0 000544f4 in public cmd_v (10, 18260712) from usf.amx
[19:56:39] [debug] #1 native CallLocalFunction () from samp03svr
[19:56:39] [debug] #2 00006330 in public OnPlayerCommandText (10, 18260680) from usf.amx

Getting this errors in my console

pawn Код:
CMD:v(playerid, params[])
{
    if (PlayerInfo[playerid][inDM] == 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You cannot spawn a vehicle here, please /leave to proceed.");
    if( Minigamer_{ playerid } != false && inProgress >= 1) return SendClientMessage( playerid, COLOR_RED, ""RED"ERROR: "GREY"You can't use this command while in Don't Get Wet minigame." );
    if(GetPlayerVirtualWorld(playerid) == 1520 || GetPlayerVirtualWorld(playerid) == 1517) return SendClientMessage(playerid, COLOR_GREY, "You can't use that cmd in this zone!");
    new Vehicle[32], VehicleID, ColorOne, ColorTwo;
    if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
    {
        SendClientMessage(playerid, 0x6FFF00FF, "{F07F1D}USAGE: {BBFF00}/v <Vehicle Name>");
        return 1;
    }

    if(GetPlayerVirtualWorld(playerid) != 1518)
    {
        if(strcmp(Vehicle, "520")==0 || strcmp(Vehicle, "425")==0 || strcmp(Vehicle, "432")==0 || strcmp(Vehicle, "464")==0 ||
strcmp(Vehicle, "476")==0 && GetPlayerVirtualWorld(playerid) == 0) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"The vehicle you have specified is globally disabled.");
        VehicleID = GetVehicleModelIDFromName(Vehicle);
        if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
               VehicleID != 430 && VehicleID != 449 && VehicleID != 476 &&
               VehicleID != 520 && VehicleID != 537 && VehicleID != 538 &&
               VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
               VehicleID != 590 && VehicleID != 592 && VehicleID != 610 && VehicleID != 539) {
            if(VehicleID == -1 )
            {
                VehicleID = strval(Vehicle);

                if(VehicleID < 400 || VehicleID > 611 )
                {
                    return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You have specified an invalid vehicle name!");
                }
            }

            GetPlayerPos(playerid, pX, pY, pZ);
            GetPlayerFacingAngle(playerid, pAngle);

            DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
            PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, random(128), random(128), -1);
            LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
            SetVehicleVirtualWorld(PlayerInfo[playerid][pSpawnVehicle], GetPlayerVirtualWorld(playerid));
            PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
            new msg[60];
            format(msg, sizeof(msg), "~g~>> ~r~You have spawned ~g~%s", VehicleNames[GetVehicleModelIdFromName(params) - 400]);
            TD_MSG( playerid, 3000, msg );
        } else {
            if(PlayerInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Unauthorized Vehicle.");
            GetPlayerPos(playerid, pX, pY, pZ);
            GetPlayerFacingAngle(playerid, pAngle);

            DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
            PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, random(128), random(128), -1);
            LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
            SetVehicleVirtualWorld(PlayerInfo[playerid][pSpawnVehicle], GetPlayerVirtualWorld(playerid));
            PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
            new msg[60];
            format(msg, sizeof(msg), "~g~>> ~r~You have spawned ~g~%s", VehicleNames[GetVehicleModelIdFromName(params) - 400]);
            TD_MSG( playerid, 3000, msg );
        }
    } else {
        SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You cannot spawn a vehicle in this area.");
    }
    if(GetPlayerVirtualWorld(playerid) == 1518)
    {
            VehicleID = GetVehicleModelIDFromName(Vehicle);
            if(VehicleID == -1 )
            {
                VehicleID = strval(Vehicle);

                if(VehicleID < 400 || VehicleID > 611 )
                {
                    return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You have specified an invalid vehicle name!");
                }
            }

            GetPlayerPos(playerid, pX, pY, pZ);
            GetPlayerFacingAngle(playerid, pAngle);

            DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
            PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
            LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
            SetVehicleVirtualWorld(PlayerInfo[playerid][pSpawnVehicle], GetPlayerVirtualWorld(playerid));
            PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
            new msg[60];
            format(msg, sizeof(msg), "~g~>> ~r~You have spawned ~g~%s", VehicleNames[GetVehicleModelIdFromName(params) - 400]);
            TD_MSG( playerid, 3000, msg );
    }
    return 1;
}

Please Help me to fix this...
Thanks in advance
Reply


Messages In This Thread
Help me to fix this :( - by kesarthakur - 17.01.2015, 08:57
Re: Dont know what error is this :( - by GShock - 12.04.2015, 08:28
Re: Dont know what error is this :( - by dominik523 - 12.04.2015, 08:31
Re: Dont know what error is this :( - by R0 - 12.04.2015, 08:34
Re: Dont know what error is this :( - by GShock - 12.04.2015, 12:29
Re: Dont know what error is this :( - by Konstantinos - 12.04.2015, 13:49

Forum Jump:


Users browsing this thread: 1 Guest(s)