SA-MP Forums Archive
Help - 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 (/showthread.php?tid=653441)



Help - DowSkippeR - 04.05.2018

I have problem wich cmd gulaz in gamemode dont show erros but in server.log when i use command gulaz write error in server.log

my script
Код:
CMD:gulaz(playerid, params[]) {
    new id = GetNearestGarage(playerid);
    if(id == -1) return Error(playerid, "Nema garaze u blizini.");
    new gtype = GarazaInfo[id][garageType];
	if(GarazaInfo[id][garageLocked] == true) return Error(playerid, "Ova garaza je zakljucana.");
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
		JBC_SetPlayerPos(playerid, GarageInteriors[gtype][0], GarageInteriors[gtype][1], GarageInteriors[gtype][2]);
	 	UsaoInt[playerid] = 1;
	    GameTextForPlayer(playerid, "~g~Ucitavanje objekata", 2500, 4);
	    SetTimerEx("UnfreezemeMacko", 2000, false, "i", playerid);
		TogglePlayerControllable(playerid, false);
	   	SetCameraBehindPlayer(playerid);
	    SetPlayerInterior(playerid, floatround(GarageInteriors[gtype][4]));
		SetPlayerVirtualWorld(playerid, GarazaInfo[id][garageVW]);
		SetPlayerFacingAngle(playerid, GarageInteriors[gtype][3]);
		EnteredGarage[playerid] = id;
		SendInfoMessage(playerid, "Da izadjete iz garaze kucajte /gizlaz.");
	}
   	else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
		new vehicle = GetPlayerVehicleID(playerid);
		LinkVehicleToInterior(vehicle, floatround(GarageInteriors[gtype][4]));
		SetVehicleVirtualWorld(vehicle, GarazaInfo[id][garageVW]);
		JBC_SetVehiclePos(vehicle, GarageInteriors[gtype][0], GarageInteriors[gtype][1], GarageInteriors[gtype][2]);
        UsaoInt[playerid] = 1;
	    GameTextForPlayer(playerid, "~g~Ucitavanje objekata", 2500, 4);
	    SetTimerEx("UnfreezemeMacko", 2000, false, "i", playerid);
		TogglePlayerControllable(playerid, false);
	   	SetCameraBehindPlayer(playerid);
		SetPlayerInterior(playerid, floatround(GarageInteriors[gtype][4]));
		SetPlayerVirtualWorld(playerid, GarazaInfo[id][garageVW]);
		SetVehicleZAngle(vehicle, GarageInteriors[gtype][3]);
		EnteredGarage[playerid] = id;
		SendInfoMessage(playerid, "Da izadjete iz garaze kucajte /gizlaz.");
	}
	else return Error(playerid, "Komandu mozes koristiti samo ako si na nogama ili na vozacevom mestu.");
	return true;
}
Код:
[22:36:57] [debug] Run time error 4: "Array index out of bounds"
[22:36:57] [debug]  Attempted to read/write array element at index 3 in array of size 3
[22:36:57] [debug] AMX backtrace:
[22:36:57] [debug] #0 0068f284 in public cmd_gulaz (0, 37433560) from JMRP.amx
[22:36:57] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:36:57] [debug] #2 00002740 in public OnPlayerCommandText (0, 37433532) from JMRP.amx
[22:37:05] [debug] Run time error 4: "Array index out of bounds"
[22:37:05] [debug]  Attempted to read/write array element at index 3 in array of size 3
[22:37:05] [debug] AMX backtrace:
[22:37:05] [debug] #0 0068f284 in public cmd_gulaz (0, 37433560) from JMRP.amx
[22:37:05] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:37:05] [debug] #2 00002740 in public OnPlayerCommandText (0, 37433532) from JMRP.amx
[22:37:07] [debug] Run time error 4: "Array index out of bounds"
[22:37:07] [debug]  Attempted to read/write array element at index 3 in array of size 3
[22:37:07] [debug] AMX backtrace:
[22:37:07] [debug] #0 0068f284 in public cmd_gulaz (0, 37433560) from JMRP.amx
[22:37:07] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:37:07] [debug] #2 00002740 in public OnPlayerCommandText (0, 37433532) from JMRP.amx
[22:37:34] [debug] Run time error 4: "Array index out of bounds"
[22:37:34] [debug]  Attempted to read/write array element at index 3 in array of size 3
[22:37:34] [debug] AMX backtrace:
[22:37:34] [debug] #0 0068eec4 in public cmd_gulaz (0, 37433560) from JMRP.amx
[22:37:34] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:37:34] [debug] #2 00002740 in public OnPlayerCommandText (0, 37433532) from JMRP.amx
[22:41:07] [debug] Run time error 4: "Array index out of bounds"
[22:41:07] [debug]  Attempted to read/write array element at index 3 in array of size 3
[22:41:07] [debug] AMX backtrace:
[22:41:07] [debug] #0 0068eec4 in public cmd_gulaz (0, 37433560) from JMRP.amx
[22:41:07] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:41:07] [debug] #2 00002740 in public OnPlayerCommandText (0, 37433532) from JMRP.amx



Re: Help - CyNiC - 05.05.2018

"Attempted to read/write array element at index 3 in array of size 3"

Probably you have more garages than array supports, so increase the array size.