OnVehicleSpawn - Crashdetect and code
#1

hej there
im getting some errors from OnVehicleSpawn i dont really understand this crashdetection codes so i need some help from you here is the errors by the way it starts at (255) + till a number idk which one cuz never checkd it out and doesnt start from 1 anyway here is the codes


Crashdetect codes
Код:
[00:19:53] Teleports loaded successfully.
[00:20:01] [debug] Run time error 4: "Array index out of bounds"
[00:20:01] [debug]  Accessing element at index 255 past array upper bound 254
[00:20:01] [debug] AMX backtrace:
[00:20:01] [debug] #0 000744c0 in public OnVehicleSpawn (255) from RP.amx
[00:20:01] [debug] #1 native SetVehicleToRespawn () from samp-server.exe
[00:20:01] [debug] #2 00189e7c in ?? (255) from RP.amx
[00:20:01] [debug] #3 0018859c in ?? () from RP.amx
[00:20:01] [debug] #4 0014fd90 in public zcmd_OnGameModeInit () from RP.amx
[00:20:01] [debug] #5 native CallLocalFunction () from samp-server.exe
[00:20:01] [debug] #6 0000cf64 in public IRC_OnGameModeInit () from RP.amx
[00:20:01] [debug] #7 native CallLocalFunction () from samp-server.exe
[00:20:01] [debug] #8 0000cb54 in public OnGameModeInit () from RP.amx

OnVeh Spawn
Код:
public OnVehicleSpawn(vehicleid)
{
dini_IntSet(CarFile(vehicleid), "carmaterials", 0);
SetVehicleEngineOff(vehicleid);
    AddVehicleComponent(vehicleid, 1010);
	AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa0]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa1]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa2]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa3]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa4]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa5]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa6]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa7]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa8]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa9]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa10]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa11]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa12]);
    AddVehicleComponent(vehicleid, Vehicles[vehicleid][compa13]);

    if(vehicleid>sizeof(Vehicles)) return DestroyVehicle(vehicleid);
    vTrailer[vehicleid] = 0;
    CarBombActive[vehicleid] = 0;
    vehicleGuns[vehicleid] = 0;
    vehicleBullets[vehicleid] = 0;
    new vid = GetPlayerVehicleID(vehicleid);
    /*if(Vehicles[vehicleid][nitro] > 0)
    {
        AddVehicleComponent(vid, 1010); // Nitro
    }*/
    if(Vehicles[vehicleid][hydros] > 0)
    {
        AddVehicleComponent(vid, 1087); // Hydros
    }
    for(new i=0;i<13;i++)
	{
		VehicleWeapon[vehicleid][i] 	= 0;
		VehicleAmmo[vehicleid][i]     = 0;
	}
	HasGunCrates[vehicleid] = 0;
    HasBulletCrates[vehicleid] = 0;
    HasCGuns[vehicleid] = 0;
	comps[vehicleid][guns] = 0;
	comps[vehicleid][oil] = 0;
	comps[vehicleid][alchool] = 0;
	comps[vehicleid][money] = 0;
	comps[vehicleid][drugs] = 0;
	comps[vehicleid][stuffs] = 0;
	compscar[vehicleid] = 0;
	SetVehicleVirtualWorld(vehicleid,0);
	SetTimerEx("SetVehicleWorld", 500, false,"dd", vehicleid, Vehicles[vehicleid][vw]);
	if(vehicleid<sizeof(Vehicles)) LinkVehicleToInterior(vehicleid, 0);
	if(Gas[vehicleid]<20) Gas[vehicleid]+=20;
	UnlockVehicle(vehicleid);
	if(!strcmp(Vehicles[vehicleid][carowner], "NoBodY", false) || Vehicles[vehicleid][carprice] > 0) UnlockVehicle(vehicleid);
	else LockVehicle(-1, vehicleid);
	SetTimerEx("ModCar", 1000, 0, "d", vehicleid);
	ChangeVehiclePaintjob(vehicleid, Vehicles[vehicleid][paintjob]);
			            if(Vehicles[vehicleid][carmodel] == 448 || Vehicles[vehicleid][carmodel] == 461 || Vehicles[vehicleid][carmodel] == 462 || Vehicles[vehicleid][carmodel] == 463 || Vehicles[vehicleid][carmodel] == 468 || Vehicles[vehicleid][carmodel] == 471 || Vehicles[vehicleid][carmodel] == 481 ||
            Vehicles[vehicleid][carmodel] == 509 || Vehicles[vehicleid][carmodel] == 510 || Vehicles[vehicleid][carmodel] == 521 || Vehicles[vehicleid][carmodel] == 522 || Vehicles[vehicleid][carmodel] == 523 || Vehicles[vehicleid][carmodel] == 581 || Vehicles[vehicleid][carmodel] == 586)
            {
            UnlockVehicle(vehicleid);
            }
	if(Vehicles[vehicleid][carmodel] == 470)
 SetVehicleHealth(vehicleid, 2500);
 else
 SetVehicleHealth(vehicleid, 1000);


	return 1;
}
Reply


Messages In This Thread
OnVehicleSpawn - Crashdetect and code - by ThatFag - 31.08.2016, 11:14
Re: OnVehicleSpawn - Crashdetect and code - by Shinja - 31.08.2016, 12:11
Re: OnVehicleSpawn - Crashdetect and code - by ThatFag - 31.08.2016, 14:12
Re: OnVehicleSpawn - Crashdetect and code - by Shinja - 31.08.2016, 14:15
Re: OnVehicleSpawn - Crashdetect and code - by PrO.GameR - 31.08.2016, 15:04
Re: OnVehicleSpawn - Crashdetect and code - by Shinja - 31.08.2016, 15:07
Re: OnVehicleSpawn - Crashdetect and code - by PrO.GameR - 31.08.2016, 15:11
Re: OnVehicleSpawn - Crashdetect and code - by Shinja - 31.08.2016, 15:16
Re: OnVehicleSpawn - Crashdetect and code - by ThatFag - 31.08.2016, 18:18
Re: OnVehicleSpawn - Crashdetect and code - by PrO.GameR - 31.08.2016, 23:35

Forum Jump:


Users browsing this thread: 1 Guest(s)