[Big Problem] OnPlayerEnterVehicle [Help]
#1

When i enter in car i get this error's from crashdetecter:
pawn Код:
[00:24:44] [01:36:26] [debug] Run time error 4: "Array index out of bounds"
[01:36:26] [debug]  Accessing element at index 8 past array upper bound 7
[01:36:26] [debug] AMX backtrace:
[01:36:26] [debug] #0 00377578 in ?? (0x00000111) from PBRP.amx
[01:36:26] [debug] #1 001a4cd4 in ?? (0x00000000, 0x00000111, 0x00000000) from PBRP.amx
[01:36:26] [debug] #2 0000a8dc in public OnPlayerEnterVehicle (0x00000000, 0x00000111, 0x00000000) from PBRP.amx

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(IsDMVCar(vehicleid))
        {
            if(!LicenseTest[playerid])
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SendClientMessage(playerid, COLOR_ORANGE, "Ovo vozilo je na Drzava/AutoShop nemozes ga voziti.");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
                SetPlayerCheckpoint(playerid,980.1932,-1407.9902,13.0956,5);
                SendClientMessage(playerid, COLOR_RED, "If you exit the car your test will be failed and it will have to be re-done.");
            }
        }
    }
    if(!ispassenger)
    {
        new id = GetVehicleID(vehicleid);
        if(IsValidVehicle(id) && VehicleCreated[id] == VEHICLE_PLAYER)
        {
            new msg[64];
            format(msg, sizeof(msg), "Ovo vozilo pripada %s", VehicleOwner[id]);
            SendClientMessage(playerid, COLOR_GREY, msg);
        }
    }
     if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
        {
            if(PlayerInfo[playerid][pJob] == JOB_TAXI || PlayerInfo[playerid][pVIPJob] == JOB_TAXI)
            {
             SendClientMessage(playerid, COLOR_LIGHTBLUE, "* TAXI SLUZBA: Tvoja posla je da vozis ljudima do destinacije za odredjeni novac.");
            }
            else
            {
                 new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                 RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY, "Ti nisi radnik za Taxi Firma.");
            }
        }
    if(IsVIPcar(vehicleid))
        {
            if(PlayerInfo[playerid][pVIP] < 0)
            {
             SendClientMessage(playerid, COLOR_LIGHTBLUE, "* VIP: Ovo je VIP vozilo!");
            }
            else
            {
                 new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                 RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY, "Ti nisi VIP, ovoj je auto iz VIP Garaze!");
            }
        }
       if(IsPaukAuto(vehicleid))
        {
            if(!IsPaukSluzba(playerid))
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SendClientMessage(playerid, COLOR_GREY, "Ti nisi radnik za Pauk Sluzba.");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* PAUK SLUZBA: Tvoja posla je da uzimas pogresno parkirane auta.");
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* PAUK SLUZBA: Ukoliko ti treba pomoc od LSPD pricaj sa njima preku /d.");
            }
        }
       if(IsTRGovAuto(vehicleid))
        {
            if(!IsTRG(playerid))
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SendClientMessage(playerid, COLOR_GREY, "Ti ne radis za Tierra Robada Vlada.");
            }
            else
            {
                SendClientMessage(playerid, COLOR_TEAL, "* TR GOV: Tvoji posao je da ne dozvolis da SA uzme TR.");
                SendClientMessage(playerid, COLOR_TEAL, "* TR GOV: Pricaj sa svi organizacije u TR preko /trd");
            }
        }
        if(IsPaukLider(vehicleid))
        {
            if(!IsPaukSLider(playerid))
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SendClientMessage(playerid, COLOR_GREY, "Ti nisi lider/menadzer da bi vozio auto.");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* PAUK MENADZER: Ovo auto nesmes koristiti bez dozvolu Lidera.");
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "* PAUK LIDER: Ukoliko se vozi ovo vozilo mora da se vrati u garazu.");
            }
        }
        if(IsTruckerVehicle(vehicleid))
        {
        if(PlayerInfo[playerid][pJob] == JOB_TRUCKER || PlayerInfo[playerid][pVIPJob] == JOB_TRUCKER)
            {
                SendClientMessage(playerid, COLOR_WHITE, "[{FFD200}INFO{FAFAFA}]: Usli ste u {00B9FF}Kamionu{FAFAFA}.");
                SendClientMessage(playerid, COLOR_WHITE, "[{FFD200}INFO{FAFAFA}]: Da bi utovarili kamion morate bidi na mesto za utovar {00B9FF}/utgps{FAFAFA}");
                SendClientMessage(playerid, COLOR_WHITE, "[{FFD200}INFO{FAFAFA}]: Kad ste na mesto da utovariot kamion {00B9FF}/utovaripaketi{FAFAFA}");
                SendClientMessage(playerid, COLOR_WHITE, "[{FFD200}INFO{FAFAFA}]: Kad ste na destinacija da bi dostavili paketa {00B9FF}/dostavipaketi{FAFAFA}");
            }
            else
            {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_WHITE,"[{FFD200}INFO{FAFAFA}]: Niste vozac {00B9FF}Kamione{FAFAFA}.");
            }
        }
        if(MechCar(vehicleid))
        {
            if(PlayerInfo[playerid][pJob] != JOB_MECHANIC && PlayerInfo[playerid][pVIPJob] != JOB_MECHANIC)
            {
                new Float:slx1, Float:sly1, Float:slz1;
                GetPlayerPos(playerid, slx1, sly1, slz1);
                SetPlayerPos(playerid, slx1, sly1, slz1+1.3);
                PlayerPlaySound(playerid, 1130, slx1, sly1, slz1+1.3);
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GRAD2, "[{FFD200}INFO{FAFAFA}]: Ti nisi Mehanic!");
            }
        }
        if(PetrolCar(vehicleid))
        {
            if(PlayerInfo[playerid][pJob] != JOB_PETROL && PlayerInfo[playerid][pVIPJob] != JOB_PETROL)
            {
                new Float:slx2, Float:sly2, Float:slz2;
                GetPlayerPos(playerid, slx2, sly2, slz2);
                SetPlayerPos(playerid, slx2, sly2, slz2+1.3);
                PlayerPlaySound(playerid, 1130, slx2, sly2, slz2+1.3);
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GRAD2, "[{FFD200}INFO{FAFAFA}]: Ti nisi vozac za Oil Petrola!");
            }
        }
        if(ProduCar(vehicleid))
        {
            if(PlayerInfo[playerid][pJob] != JOB_PRODUKTE && PlayerInfo[playerid][pVIPJob] != JOB_PRODUKTE)
            {
                new Float:slx3, Float:sly3, Float:slz3;
                GetPlayerPos(playerid, slx3, sly3, slz3);
                SetPlayerPos(playerid, slx3, sly3, slz3+1.3);
                PlayerPlaySound(playerid, 1130, slx3, sly3, slz3+1.3);
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GRAD2, "[{FFD200}INFO{FAFAFA}]: Ti nisi Dostavjac Produkte!");
            }
        }
       else if(IsDLCar(vehicleid))
        {
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        }
        else if(IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid))
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ti nemozes voziti ovo vozilo jer nisi u familija.");
        }
        else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ovo vozilo pripada na LSPD.");
        }
        else if(IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_ORANGE, " Ovo vozilo pripada na LSFMD.");
        }
        else if(IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ovo vozilo pripada na SaNews Agencija.");
        }
        else if(IsHitmanVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 3)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ti nemozes da vozis vozilo registrovano na Agencije.");
        }
        else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ovo vozilo pripada na FBI.");
        }
        else if(IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ovo vozilo pripada na NG.");
        }
        else if(HotDogCar(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GRAD2, "[{FFD200}INFO{FAFAFA}]: Ti nisi Dostavjac HotDog-a!");
        }
        else if(IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            new Float:pos[3];
            GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
            SendClientMessage(playerid, COLOR_GREY, " Ovo vozilo pripada na Vlada.");
        }
        return 1;

    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)