21.06.2014, 13:46
So, mine script has been lagging alot, that's why I've enabled debug and checkd what could cause it, this is what I've got spammed all over my log.
I've never had something like this before, so I dont really know what code do I have to show in order for you to help me but I am guessing it's OnGameModeInit and OnVehicleSpawn.
And here is the ongamemodeinit
Код:
[15:51:57] [debug] AMX backtrace: [15:51:57] [debug] #0 001709f4 in ?? (0x0000004a) from ZRP.amx [15:51:57] [debug] #1 00035b0c in public OnVehicleSpawn (0x0000004a) from ZRP.amx [15:51:57] [debug] #2 native SetVehicleToRespawn () [080d3eb0] from samp03svr [15:51:57] [debug] #3 0002d130 in public RL_OnGameModeInit () from ZRP.amx [15:51:57] [debug] #4 native CallLocalFunction () [080dc700] from samp03svr [15:51:57] [debug] #5 0000ad94 in public zcmd_OnGameModeInit () from ZRP.amx [15:51:57] [debug] #6 native CallLocalFunction () [080dc700] from samp03svr [15:51:57] [debug] #7 000085d4 in public SSCANF_OnGameModeInit () from ZRP.amx [15:51:57] [debug] #8 0000293c in public Itter_OnGameModeInit () from ZRP.amx [15:51:57] [debug] #9 native CallLocalFunction () [080dc700] from samp03svr [15:51:57] [debug] #10 00001e98 in public OnGameModeInit () from ZRP.amx [15:51:57] [debug] Run time error 4: "Array index out of bounds" [15:51:57] [debug] Accessing element at index 9 past array upper bound 8
Код:
public OnVehicleSpawn(vehicleid) { if(vehicleid != 509 && vehicleid != 481 && vehicleid != 510) { SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0); foreach(Player, i) { if(vehicleid == PlayerInfo[i][pVeh]) { if(PlayerInfo[i][vLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0); ChangeVehiclePaintjob(PlayerInfo[i][pVeh], PlayerInfo[i][vPJ]); for(new x=0; x<14; i++) { AddVehicleComponent(PlayerInfo[i][pVeh], PlayerInfo[i][pVehMod][x]); } } if(vehicleid == PlayerInfo[i][pVVeh]) { if(PlayerInfo[i][vVLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0); ChangeVehiclePaintjob(PlayerInfo[i][pVVeh], PlayerInfo[i][vVPJ]); for(new x=0; x<14; i++) { AddVehicleComponent(PlayerInfo[i][pVVeh], PlayerInfo[i][pVVehMod][x]); } } } if(IsTruckerVehicle(vehicleid)) { TruckPackages[vehicleid] = -1; } if(Siren[vehicleid]) { Siren[vehicleid] = 0; DestroyDynamicObject(SirenObject[vehicleid]); } } return 1; }
Код:
public OnGameModeInit() { UsePlayerPedAnims(); CheckFiles(); SetGameModeText(SERVER_GM_TEXT); SendRconCommand("hostname Asgard RPG"); SendRconCommand("weburl www.Asgard-RPG.com"); SendRconCommand("mapname San Andreas"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); EnableStuntBonusForAll(0); DisableInteriorEnterExits(); ShowPlayerMarkers(1); UsePlayerPedAnims(); LoadStaticVehicles(); LoadObjects(); LoadFactions(); LoadFamilies(); LoadPoints(); LoadBiz(); LoadHouses(); LoadDoors(); LoadGates(); LoadMapIcons(); LoadArrestPoint(); LoadDrugs(); LoadProducts(); LoadPickups(); LoadMOTDS(); // Animations txtAnimHelper = TextDrawCreate(610.0, 400.0, "~r~~k~~PED_SPRINT~ ~w~to stop the animation"); TextDrawUseBox(txtAnimHelper, 0); TextDrawFont(txtAnimHelper, 2); TextDrawSetShadow(txtAnimHelper,0); // no shadow TextDrawSetOutline(txtAnimHelper,1); // thickness 1 TextDrawBackgroundColor(txtAnimHelper,0x000000FF); TextDrawColor(txtAnimHelper,0xFFFFFFFF); TextDrawAlignment(txtAnimHelper,3); // align right // report bug SetTimer("Bug", 300000, true); // Time TimeTD = TextDrawCreate(633.000000,428.000000,"Time"); TextDrawFont(TimeTD,1); TextDrawSetShadow(TimeTD,0); TextDrawSetOutline(TimeTD,1); TextDrawAlignment(TimeTD,3); TextDrawLetterSize(TimeTD,0.399999,1.500000); TextDrawColor(TimeTD,0x00B2EEFF); // Website // Time WebTD = TextDrawCreate(633.000000,412.000000,"~w~www.asgard-rpg.com"); TextDrawFont(WebTD,1); TextDrawSetShadow(WebTD,0); TextDrawSetOutline(WebTD,1); TextDrawAlignment(WebTD,3); TextDrawLetterSize(WebTD,0.399999,1.500000); TextDrawColor(WebTD,COLOR_WHITE); // Tutorial Blackbox TutorialTD = TextDrawCreate(424.000000, 3.000000, " "); TextDrawBackgroundColor(TutorialTD, 255); TextDrawFont(TutorialTD, 1); TextDrawLetterSize(TutorialTD, 0.500000, 1.000000); TextDrawColor(TutorialTD, -1); TextDrawSetOutline(TutorialTD, 0); TextDrawSetProportional(TutorialTD, 1); TextDrawSetShadow(TutorialTD, 1); TextDrawUseBox(TutorialTD, 1); TextDrawBoxColor(TutorialTD, 255); TextDrawTextSize(TutorialTD, 14.000000, 0.000000); // Bank Robbery Textdraw0 = TextDrawCreate(490.000000, 155.000000, "~r~Bank Robbers:"); TextDrawBackgroundColor(Textdraw0, 255); TextDrawFont(Textdraw0, 1); TextDrawLetterSize(Textdraw0, 0.450000, 1.300000); TextDrawColor(Textdraw0, -1); TextDrawSetOutline(Textdraw0, 1); TextDrawSetProportional(Textdraw0, 1); Textdraw1 = TextDrawCreate(490.000000, 171.000000, "Robber 1"); TextDrawBackgroundColor(Textdraw1, 255); TextDrawFont(Textdraw1, 1); TextDrawLetterSize(Textdraw1, 0.450000, 1.300000); TextDrawColor(Textdraw1, -1); TextDrawSetOutline(Textdraw1, 1); TextDrawSetProportional(Textdraw1, 1); Textdraw2 = TextDrawCreate(490.000000, 185.000000, "Robber 2"); TextDrawBackgroundColor(Textdraw2, 255); TextDrawFont(Textdraw2, 1); TextDrawLetterSize(Textdraw2, 0.450000, 1.300000); TextDrawColor(Textdraw2, -1); TextDrawSetOutline(Textdraw2, 1); TextDrawSetProportional(Textdraw2, 1); Textdraw3 = TextDrawCreate(490.000000, 199.000000, "Robber 3"); TextDrawBackgroundColor(Textdraw3, 255); TextDrawFont(Textdraw3, 1); TextDrawLetterSize(Textdraw3, 0.450000, 1.300000); TextDrawColor(Textdraw3, -1); TextDrawSetOutline(Textdraw3, 1); TextDrawSetProportional(Textdraw3, 1); Textdraw4 = TextDrawCreate(490.000000, 213.000000, "Robber 4"); TextDrawBackgroundColor(Textdraw4, 255); TextDrawFont(Textdraw4, 1); TextDrawLetterSize(Textdraw4, 0.450000, 1.300000); TextDrawColor(Textdraw4, -1); TextDrawSetOutline(Textdraw4, 1); TextDrawSetProportional(Textdraw4, 1); Textdraw5 = TextDrawCreate(490.000000, 227.000000, "Robber 5"); TextDrawBackgroundColor(Textdraw5, 255); TextDrawFont(Textdraw5, 1); TextDrawLetterSize(Textdraw5, 0.450000, 1.300000); TextDrawColor(Textdraw5, -1); TextDrawSetOutline(Textdraw5, 1); TextDrawSetProportional(Textdraw5, 1); // Timers SetTimer("Clock", 1000, true); SetTimer("ADTimer", 1000, true); SetTimer("NOPSetPlayerPos", 1000, true); SetTimer("SaveServer", 3600000, true); SetTimer("AltTabTimer", 1000, true); SetTimer("WeaponCheat", 1000, true); SetTimer("FuelTimer", 1000, true); SetTimer("PrisonTimer", 1000, true); SetTimer("LoyalFeatures", 60000, true); for(new i=0; i<MAX_VEHICLES; i++) { Fuel[i] = 100; SetVehicleToRespawn(i); } ConnectNPC("BusDriver", "NPCBus"); NPCBus = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); //MDC TEXTDRAWS Textdraw10 = TextDrawCreate(480.000000, 116.000000, "."); TextDrawBackgroundColor(Textdraw10, 255); TextDrawFont(Textdraw10, 1); TextDrawLetterSize(Textdraw10, 0.500000, 24.399999); TextDrawColor(Textdraw10, 0xFFFFFF00); TextDrawSetOutline(Textdraw10, 0); TextDrawSetProportional(Textdraw10, 1); TextDrawSetShadow(Textdraw10, 0); TextDrawUseBox(Textdraw10, 1); TextDrawBoxColor(Textdraw10, 65535); TextDrawTextSize(Textdraw10, 150.000000, 0.000000); Textdraw11 = TextDrawCreate(161.000000, 120.000000, "San Andreas Police Department Mobile Data Computer"); TextDrawBackgroundColor(Textdraw11, 255); TextDrawFont(Textdraw11, 2); TextDrawLetterSize(Textdraw11, 0.250000, 1.000000); TextDrawColor(Textdraw11, -1); TextDrawSetOutline(Textdraw11, 0); TextDrawSetProportional(Textdraw11, 1); TextDrawSetShadow(Textdraw11, 1); Textdraw13 = TextDrawCreate(488.000000, 104.000000, "."); TextDrawBackgroundColor(Textdraw13, 255); TextDrawFont(Textdraw13, 1); TextDrawLetterSize(Textdraw13, 0.500000, 1.000000); TextDrawColor(Textdraw13, 0xFFFFFF00); TextDrawSetOutline(Textdraw13, 0); TextDrawSetProportional(Textdraw13, 1); TextDrawSetShadow(Textdraw13, 0); TextDrawUseBox(Textdraw13, 1); TextDrawBoxColor(Textdraw13, 33023); TextDrawTextSize(Textdraw13, 141.000000, 0.000000); Textdraw14 = TextDrawCreate(494.000000, 339.000000, "."); TextDrawBackgroundColor(Textdraw14, 255); TextDrawFont(Textdraw14, 1); TextDrawLetterSize(Textdraw14, 0.500000, 1.000000); TextDrawColor(Textdraw14, 0xFFFFFF00); TextDrawSetOutline(Textdraw14, 0); TextDrawSetProportional(Textdraw14, 1); TextDrawSetShadow(Textdraw14, 0); TextDrawUseBox(Textdraw14, 1); TextDrawBoxColor(Textdraw14, 33023); TextDrawTextSize(Textdraw14, 141.000000, 0.000000); Textdraw15 = TextDrawCreate(476.000000, 104.000000, "."); TextDrawBackgroundColor(Textdraw15, 255); TextDrawFont(Textdraw15, 1); TextDrawLetterSize(Textdraw15, 0.000000, 26.100000); TextDrawColor(Textdraw15, 0xFFFFFF00); TextDrawSetOutline(Textdraw15, 0); TextDrawSetProportional(Textdraw15, 1); TextDrawSetShadow(Textdraw15, 0); TextDrawUseBox(Textdraw15, 1); TextDrawBoxColor(Textdraw15, 33023); TextDrawTextSize(Textdraw15, 491.000000, 47.000000); Textdraw16 = TextDrawCreate(144.000000, 104.000000, "."); TextDrawBackgroundColor(Textdraw16, 255); TextDrawFont(Textdraw16, 1); TextDrawLetterSize(Textdraw16, 0.500000, 26.100000); TextDrawColor(Textdraw16, 0xFFFFFF00); TextDrawSetOutline(Textdraw16, 0); TextDrawSetProportional(Textdraw16, 1); TextDrawSetShadow(Textdraw16, 0); TextDrawUseBox(Textdraw16, 1); TextDrawBoxColor(Textdraw16, 33023); TextDrawTextSize(Textdraw16, 159.000000, 34.000000); return 1; }