Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // structure
- namespace GMResource
- {
- public class WorkBus
- {
- public class RouteInfo
- {
- public string NAME;
- public int COUNT_POINTS;
- public Dictionary<int, WorkBus.PointInfo> POINT;
- }
- public class PointInfo
- {
- public int ROUTE_ID;
- public int PRIORITY;
- public int TYPE;
- public Vector3 POSITION;
- }
- }
- }
- // global
- namespace GMResource
- {
- public class WorkBusGlobal
- {
- public static void LoadRoutes(DataTable BusRouteData)
- {
- Dictionary<int, WorkBus.RouteInfo> WorkBusGlobal = new Dictionary<int, WorkBus.RouteInfo>();
- foreach(DataRow Row in BusRouteData.Rows)
- {
- WorkBus.RouteInfo Route = new WorkBus.RouteInfo();
- Route.NAME = (string)Row["route_name"];
- Route.COUNT_POINTS = (int)Row["route_points"];
- WorkBusGlobal.Add((int)Row["route_id"], Route);
- API.shared.consoleOutput("[WorkBus] Route (id: " + (int)Row["route_id"] + ") " + Route.NAME + " loaded.");
- }
- // API.shared.setWorldSyncedData("WorkBusGlobal", Misc.TO_JSON(WorkBusGlobal));
- }
- public static void LoadPoints(DataTable PointData)
- {
- Dictionary<int, WorkBus.PointInfo> WorkBusGlobal = new Dictionary<int, WorkBus.PointInfo>();
- foreach(DataRow Row in PointData.Rows)
- {
- WorkBus.PointInfo Point = new WorkBus.PointInfo();
- Point.ROUTE_ID = (int)Row["route_id"];
- Point.PRIORITY = (int)Row["point_priority"];
- Point.TYPE = (int)Row["point_type"];
- Point.POSITION = new Vector3((float)Row["point_x"], (float)Row["point_y"], (float)Row["point_z"]);
- WorkBusGlobal.Add((int)Row["route_id"], Point);
- API.shared.consoleOutput("[WorkBus] Point (route_id: " + (int)Row["route_id"] + ") priority: " + Point.PRIORITY+ " loaded.");
- }
- // API.shared.setWorldSyncedData("WorkBusGlobal", Misc.TO_JSON(WorkBusGlobal));
- }
- }
- }
- // commands
- [Command("create_busroute")]
- [Command("create_busroute")]
- public void Command_create_busroute(Client player, string route_name)
- {
- if(API.getEntityData(player, "BusRouteEditorID") != 0)
- {
- API.sendChatMessageToPlayer(player, "Ошибка: Выйдите из режима редактирования маршрута.");
- return;
- }
- else if(route_name.Length < 5)
- {
- API.sendChatMessageToPlayer(player, "Ошибка: Название маршрута должно быть не менее 5 символов.");
- return;
- }
- else if(route_name.Length > 50)
- {
- API.sendChatMessageToPlayer(player, "Ошибка: Название маршрута должно быть не более 50 символов.");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement