31.08.2013, 12:36
how to convert .json to .in? (read & write)
i think using .json make my GM LAG
code:
i think using .json make my GM LAG
code:
Код:
LoadcDealerships() { new idx, idx2; new string[128]; new owner[MAX_PLAYER_NAME]; new message[128]; djAutocommit(false); while (idx < sizeof(CarDealershipInfo)) { format(string, sizeof(string), "%d/owned", idx); CarDealershipInfo[idx][cdOwned] = djInt("cardealerships.json", string); format(string, sizeof(string), "%d/owner", idx); format(owner, sizeof(owner), "%s", dj("cardealerships.json", string)); strmid(CarDealershipInfo[idx][cdOwner], owner, 0, strlen(owner), 255); format(string, sizeof(string), "%d/entrance/x", idx); CarDealershipInfo[idx][cdEntranceX] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/entrance/y", idx); CarDealershipInfo[idx][cdEntranceY] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/entrance/z", idx); CarDealershipInfo[idx][cdEntranceZ] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/exit/x", idx); CarDealershipInfo[idx][cdExitX] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/exit/y", idx); CarDealershipInfo[idx][cdExitY] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/exit/z", idx); CarDealershipInfo[idx][cdExitZ] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/message", idx); format(message, sizeof(message), "%s", dj("cardealerships.json", string)); strmid(CarDealershipInfo[idx][cdMessage], message, 0, strlen(message), 255); format(string, sizeof(string), "%d/till", idx); CarDealershipInfo[idx][cdTill] = djInt("cardealerships.json", string); format(string, sizeof(string), "%d/interior", idx); CarDealershipInfo[idx][cdInterior] = djInt("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawn/x", idx); CarDealershipInfo[idx][cdVehicleSpawn][0] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawn/y", idx); CarDealershipInfo[idx][cdVehicleSpawn][1] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawn/z", idx); CarDealershipInfo[idx][cdVehicleSpawn][2] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawn/a", idx); CarDealershipInfo[idx][cdVehicleSpawn][3] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/radius", idx); CarDealershipInfo[idx][cdRadius] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/price", idx); CarDealershipInfo[idx][cdPrice] = djInt("cardealerships.json", string); while (idx2 < MAX_DEALERSHIPVEHICLES) { format(string, sizeof(string), "%d/vehicleangle/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleSpawnAngle][idx2] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawnx/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleSpawnX][idx2] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawny/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleSpawnY][idx2] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclespawnz/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleSpawnZ][idx2] = djFloat("cardealerships.json", string); format(string, sizeof(string), "%d/vehiclecost/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleCost][idx2] = djInt("cardealerships.json", string); format(string, sizeof(string), "%d/vehicletypes/%d", idx, idx2); CarDealershipInfo[idx][cdVehicleModel][idx2] = djInt("cardealerships.json", string); idx2++; } idx2 = 0; idx++; } djAutocommit(true); return 1; } SavecDealership(id) { new idx2; new string[128]; printf("Saving Car Dealership %d.", id); //djAutocommit(false); format(string, sizeof(string), "%d/owned", id); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdOwned]); format(string, sizeof(string), "%d/owner", id); djSet("cardealerships.json", string, CarDealershipInfo[id][cdOwner]); format(string, sizeof(string), "%d/entrance/x", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdEntranceX]); format(string, sizeof(string), "%d/entrance/y", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdEntranceY]); format(string, sizeof(string), "%d/entrance/z", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdEntranceZ]); format(string, sizeof(string), "%d/exit/x", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdExitX]); format(string, sizeof(string), "%d/exit/y", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdExitY]); format(string, sizeof(string), "%d/exit/z", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdExitZ]); format(string, sizeof(string), "%d/message", id); djSet("cardealerships.json", string, CarDealershipInfo[id][cdMessage]); format(string, sizeof(string), "%d/till", id); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdTill]); format(string, sizeof(string), "%d/interior", id); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdInterior]); format(string, sizeof(string), "%d/vehiclespawn/x", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawn][0]); format(string, sizeof(string), "%d/vehiclespawn/y", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawn][1]); format(string, sizeof(string), "%d/vehiclespawn/z", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawn][2]); format(string, sizeof(string), "%d/vehiclespawn/a", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawn][3]); format(string, sizeof(string), "%d/radius", id); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdRadius]); format(string, sizeof(string), "%d/price", id); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdPrice]); while (idx2 < MAX_DEALERSHIPVEHICLES) { format(string, sizeof(string), "%d/vehicleangle/%d", id, idx2); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawnAngle][idx2]); format(string, sizeof(string), "%d/vehiclespawnx/%d", id, idx2); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawnX][idx2]); format(string, sizeof(string), "%d/vehiclespawny/%d", id, idx2); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawnY][idx2]); format(string, sizeof(string), "%d/vehiclespawnz/%d", id, idx2); djSetFloat("cardealerships.json", string, CarDealershipInfo[id][cdVehicleSpawnZ][idx2]); format(string, sizeof(string), "%d/vehiclecost/%d", id, idx2); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdVehicleCost][idx2]); format(string, sizeof(string), "%d/vehicletypes/%d", id, idx2); djSetInt("cardealerships.json", string, CarDealershipInfo[id][cdVehicleModel][idx2]); idx2++; } //djAutocommit(true); return 1; }