Problem with DJSon
#1

Well, i made a vehicle system, it uses djson, i had like 50 cars and the loaded fine, now i have open the server and now it has like 170 cars, i decided to restart the server to implement something, kow it is just bugged, it is because of the car save file, when i open the samp_server.exe with the new car file, i use the crashdetect plugin ant it gives this:

Код:
[20:13:20] [debug] Run time error 4: "Array index out of bounds"
[20:13:20] [debug]  Accessing element at index 65535 past array upper bound 399
[20:13:20] [debug] AMX backtrace:
[20:13:20] [debug] #0 001d21d4 in ?? () from CiudadPacifica.amx
[20:13:20] [debug] #1 00050994 in public S@@_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #2 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #3 0001c6a4 in public ScriptInit_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #4 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #5 0001580c in public zcmd_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #6 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #7 00015204 in public SSCANF_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #8 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #9 0000f4e0 in public Streamer_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #10 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #11 0000ec2c in public Itter_OnGameModeInit () from CiudadPacifica.amx
[20:13:20] [debug] #12 native CallLocalFunction () [00472c00] from samp-server.exe
[20:13:20] [debug] #13 00008f7c in public OnGameModeInit () from CiudadPacifica.amx
It only loads 10 vehicle models, i have set max_vehicles to 400, as you can see there is a 399, i have also set max_vehicles to 800 and it gives 799, so i dont know what is happenig, there are only 170 cars, so i dont think it has reached the 800, here i leave the loadcars code

Код:
public OnGameModeInit()
{
	if(!fexist(GCoches))
	{
	    print("*| El archivo de guardado de coches no esta creado |*");
	    print("*| Creando archivo de guardado de coches |*");
	    fcreate(GCoches);
	}
	else
	{
	    new string2[40];
	    UltimaIDVeh = 0;
	    for(new c=0;c<MAX_VEHICLES;c++)
	    {
        	format(string2, sizeof(string2),"Coche_%d",c);
			if(djIsSet(GCoches, string2)) CargarCoches©;
		}
	}
and

Код:
funcion CargarCoches(idcoche) //Trenico
{
    new string[50], string2[50];
    format(string, sizeof(string),"Coche_%d",idcoche);
	if(djIsSet(GCoches,string))
	{
		format(string2, sizeof(string2),"Coche_%d/ID",idcoche); InfoCoche[idcoche][cID] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Aeros",idcoche); InfoCoche[idcoche][cAeros] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Alarma",idcoche); InfoCoche[idcoche][cAlarma] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Arma1",idcoche); InfoCoche[idcoche][cArma1] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Arma2",idcoche); InfoCoche[idcoche][cArma2] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Arma3",idcoche); InfoCoche[idcoche][cArma3] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Arma4",idcoche); InfoCoche[idcoche][cArma4] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Bateria",idcoche); InfoCoche[idcoche][cBateria] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/BateriaT",idcoche); InfoCoche[idcoche][cBateriaT] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Bloqueado",idcoche); InfoCoche[idcoche][cBloqueado] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/BumperD",idcoche); InfoCoche[idcoche][cBumperD] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/BumperT",idcoche); InfoCoche[idcoche][cBumperT] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Capo",idcoche); InfoCoche[idcoche][cCapo] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Chaleco",idcoche); InfoCoche[idcoche][cChaleco] = djFloat(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Color1",idcoche); InfoCoche[idcoche][cColor1] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Color2",idcoche); InfoCoche[idcoche][cColor2] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Comprable",idcoche); InfoCoche[idcoche][cComprable] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Drogas",idcoche); InfoCoche[idcoche][cDrogas] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Dueno",idcoche); strmid(InfoCoche[idcoche][cDueno],dj(GCoches, string2),0,24,24);
		format(string2, sizeof(string2),"Coche_%d/Encendido",idcoche); InfoCoche[idcoche][cEncendido] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Exausto",idcoche); InfoCoche[idcoche][cExausto] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Faccion",idcoche); InfoCoche[idcoche][cFaccion] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Faldones",idcoche); InfoCoche[idcoche][cFaldones] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Gas",idcoche); InfoCoche[idcoche][cGas] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/GasT",idcoche); InfoCoche[idcoche][cGasT] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/GPS",idcoche); InfoCoche[idcoche][cGPS] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Hidraulicos",idcoche); InfoCoche[idcoche][cHidraulicos] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Llantas",idcoche); InfoCoche[idcoche][cLlantas] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Luces",idcoche); InfoCoche[idcoche][cLuces] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Modelo",idcoche); InfoCoche[idcoche][cModelo] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Motor",idcoche); InfoCoche[idcoche][cMotor] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Multa",idcoche); InfoCoche[idcoche][cMulta] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/MultaRazon",idcoche); strmid(InfoCoche[idcoche][cMultaRazon],dj(GCoches, string2),0,25,25);
		format(string2, sizeof(string2),"Coche_%d/MultaPor",idcoche); strmid(InfoCoche[idcoche][cMultaPor],dj(GCoches, string2),0,24,24);
		format(string2, sizeof(string2),"Coche_%d/Mun1",idcoche); InfoCoche[idcoche][cMun1] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Mun2",idcoche); InfoCoche[idcoche][cMun2] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Mun3",idcoche); InfoCoche[idcoche][cMun3] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Mun4",idcoche); InfoCoche[idcoche][cMun4] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Nitro",idcoche); InfoCoche[idcoche][cNitro] = djInt(GCoches, string2);
		format(string2, sizeof(string2),"Coche_%d/Nombre",idcoche); strmid(InfoCoche[idcoche][cNombre],dj(GCoches, string2),0,30,30);
		format(string2, sizeof(string2),"Coche_%d/Paintjob",idcoche); InfoCoche[idcoche][cPaintjob] = djInt(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/Placa",idcoche); strmid(InfoCoche[idcoche][cPlaca],dj(GCoches, string2),0,8,8);
        format(string2, sizeof(string2),"Coche_%d/Spoiler",idcoche); InfoCoche[idcoche][cSpoiler] = djInt(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/Techo",idcoche); InfoCoche[idcoche][cTecho] = djInt(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/Trabajo",idcoche); InfoCoche[idcoche][cTrabajo] = djInt(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/X",idcoche); InfoCoche[idcoche][cX] = djFloat(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/Y",idcoche); InfoCoche[idcoche][cY] = djFloat(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/Z",idcoche); InfoCoche[idcoche][cZ] = djFloat(GCoches, string2);
        format(string2, sizeof(string2),"Coche_%d/A",idcoche); InfoCoche[idcoche][cA] = djFloat(GCoches, string2);
        new idcoche2 = AddStaticVehicleEx(InfoCoche[idcoche][cModelo],InfoCoche[idcoche][cX],InfoCoche[idcoche][cY],InfoCoche[idcoche][cZ],InfoCoche[idcoche][cA],InfoCoche[idcoche][cColor1],InfoCoche[idcoche][cColor2],12000);
        SetVehicleNumberPlate(idcoche,InfoCoche[idcoche2][cPlaca]);
        ResetearVariablesCoches(idcoche2);
        //SetVehicleToRespawn(idcoche2);
        IDCoches[idcoche2] = InfoCoche[idcoche][cID];
        SetVehicleParamsEx(idcoche2,InfoCoche[idcoche][cEncendido],InfoCoche[idcoche][cLuces],0,0,0,0,0);
        AplicarTuning(idcoche);
        if(InfoCoche[idcoche][cID] > UltimaIDVeh)
		{
			UltimaIDVeh = InfoCoche[idcoche][cID];
		}
		return InfoCoche[idcoche][cID];
	}
	return print("*Un coche no pudo ser cargado!");
}
Please help me i had to clse my server because this was bugging everything.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)