private void API_onResourceStart() { lock (Global.Lock) { // taxi vehicles #region TaxiVehicles new VehInfo(VehicleHash.Taxi, new Vector3(-897.5254f, -2035.502f, 8.904017f), new Vector3(0, 0, -135.3084f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-899.7668f, -2038.035f, 8.90379f), new Vector3(0, 0, -135.3176f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-902.3703f, -2040.493f, 8.903711f), new Vector3(0, 0, -134.8492f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-904.8074f, -2042.999f, 8.903594f), new Vector3(0, 0, -136.4715f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-907.111f, -2045.528f, 8.903583f), new Vector3(0, 0, -136.4113f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-909.6328f, -2047.868f, 8.903583f), new Vector3(0, 0, -135.688f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-912.2091f, -2050.099f, 8.903601f), new Vector3(0, 0, -134.351f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-882.4277f, -2048.99f, 8.903764f), new Vector3(0, 0, 44.82626f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-884.9864f, -2051.37f, 8.90558f), new Vector3(0, 0, 45.86894f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-887.3887f, -2053.851f, 8.911674f), new Vector3(0, 0, 42.99739f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); new VehInfo(VehicleHash.Taxi, new Vector3(-889.7358f, -2056.304f, 8.910381f), new Vector3(0, 0, 44.67617f), 0, 0, 100, Jobs.JOB_TAXI_PARK_ONE, 0); #endregion new BlipInfo(new Vector3(-915.1155, -2038.782, 8.40499), 56, 5, false, 0, "Downtown Cab Co."); MarkerInfo mInfo = new MarkerInfo(1, new Vector3(-915.1155, -2038.782, 8.40499), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 2), 100, 23, 182, 71, 1, 2); mInfo.SetData("JobTaxiAction", 1); new TLabelInfo("Работа в такси", new Vector3(-915.1155, -2038.782, 9.40499), 25, 1); } }
private void onResourceStart() { lock (Global.Lock) { try { var JOB_IMMIGRANT_MARKER = new MarkerInfo(1, new Vector3(84.0330581665039, -1291.85900878906, 28.2591037750244), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 1), 100, 236, 147, 89, 1, 2); JOB_IMMIGRANT_MARKER.SetData("JOB_IMMIGRANT", 1); new BlipInfo(new Vector3(84.0330581665039, -1291.85900878906, 28.2591037750244), 408, 2, true, 0, "Работа иммигранта"); new TLabelInfo("Работа иммигранта", new Vector3(84.0330581665039, -1291.85900878906, 30.2591037750244), 25, 1); } catch (Exception exp) { API.consoleOutput("Произошла ошибка при инициализации миссии иммигранта: " + exp.Message); return; } } }
public void JobGryzClothes(Client player) { PlayerInfo pInfo = API.getEntityData(player.handle, Constants.PlayerAccount); if (pInfo.Job == (int)Jobs.NULL) { pInfo.Job = (int)Jobs.JOB_JOBGRYZ_ONE; API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 200); API.delay(200, true, () => { BlipInfo JobGryzClothes = new BlipInfo(player, new Vector3(-773.26, -2646.6, 13.0), 1, 60, false, 0, "Начать работу", Jobs.JOB_JOBGRYZ_ONE); MarkerInfo JobGryzMarkerInfo = new MarkerInfo(player, 1, new Vector3(-774.0269, -2653.793, 12.83), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 255, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); JobGryzMarkerInfo.SetData("JobGryzAction", 1); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Заберите ящик из зоны разгрузки"); if (pInfo.sex) { // Мужской персонаж API.setPlayerClothes(player, 11, 89, 0); API.setPlayerClothes(player, 8, 59, 1); API.setPlayerAccessory(player, 0, 2, 7); } else { // Женский персонаж API.setPlayerClothes(player, 11, 14, 6); API.setPlayerClothes(player, 3, 0, 0); API.setPlayerClothes(player, 8, 2, 0); API.setPlayerAccessory(player, 0, 29, 2); } MarkerInfo JobGryzZone = new MarkerInfo(player, new Vector3(-748.75, -2601.46, 13.1), 80, 10, Jobs.JOB_JOBGRYZ_ONE); // утанавливаем зону задания, чтобы ящики не воровал. JobGryzZone.SetData("JobGryzZone", 1); API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 750); }); } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сначала завершите предыдущую работу."); } }
private void onMarkerEnter(ColShape colshape, NetHandle entity) { if (colshape.hasData(Constants.MarkerClass)) { MarkerInfo mInfo = colshape.getData(Constants.MarkerClass); Client player; int type = (int)API.getEntityType(entity); if (type == 6) { player = API.getPlayerFromHandle(entity); } else { return; } if (mInfo.local && mInfo.player != player) { return; } if (mInfo.Job == Jobs.JOB_JOBGRYZ_ONE) { if (mInfo.HasData("JobGryzAction")) { Box myBox; switch ((int)mInfo.GetData("JobGryzAction")) { case 1: var BoxTypes = GryzBoxes.Where(i => i.Player == null).GroupBy(d => d.Type).Select(y => y.First()).Distinct().ToList(); // Смотрим какие типы ящиков остались if (BoxTypes.Count == 0) { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~В данный момент товар для отгрузки отсутсвует."); return; } var rnd = new Random(); int BoxType = BoxTypes[rnd.Next(0, BoxTypes.Count)].Type; // Выбираем тип груза и склада куда его отнести myBox = GryzBoxes.Where(i => i.Type == BoxType && i.Player == null).FirstOrDefault(); // Ищем ящик который ни кому не принадлежит if (myBox != null) { myBox.Player = player; PlayerInfo pInfo = API.getEntityData(player.handle, Constants.PlayerAccount); pInfo.FreezePlayer(); API.playPlayerAnimation(player, (int)(AnimationFlags.StopOnLastFrame | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "anim@heists@load_box", "lift_box"); lifeRP_GM.mainClass.Stream(1500, () => { NetHandle BoxObject = myBox.Object; API.attachEntityToEntity(BoxObject, player, "60309", new Vector3(), new Vector3(-70, 2, 0)); API.sendChatMessageToPlayer(player, string.Format("~y~[Server] ~b~Отнесите ящик на {0}-й склад", BoxType)); pInfo.UnFreezePlayer(); }); #region "Маркеры складов" switch (BoxType) { case 1: MarkerInfo minfo1 = new MarkerInfo(player, 0, new Vector3(-772.8375f, -2605.233f, 13.45), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo1.SetData("JobGryzAction", 0); //склад 1 minfo1.SetData("JobGryzSklad", 1); break; case 2: MarkerInfo minfo2 = new MarkerInfo(player, 0, new Vector3(-770.2049, -2600.777, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo2.SetData("JobGryzAction", 0); //склад 2 minfo2.SetData("JobGryzSklad", 2); break; case 3: MarkerInfo minfo3 = new MarkerInfo(player, 0, new Vector3(-767.5933, -2596.403, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo3.SetData("JobGryzAction", 0); //склад 3 minfo3.SetData("JobGryzSklad", 3); break; case 4: MarkerInfo minfo4 = new MarkerInfo(player, 0, new Vector3(-764.9606, -2592.063, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo4.SetData("JobGryzAction", 0); //склад 4 minfo4.SetData("JobGryzSklad", 4); break; case 5: MarkerInfo minfo5 = new MarkerInfo(player, 0, new Vector3(-762.4879, -2587.585, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo5.SetData("JobGryzAction", 0); //склад 5 minfo5.SetData("JobGryzSklad", 5); break; case 6: MarkerInfo minfo6 = new MarkerInfo(player, 0, new Vector3(-759.9476, -2583.071, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo6.SetData("JobGryzAction", 0); //склад 6 minfo6.SetData("JobGryzSklad", 6); break; case 7: MarkerInfo minfo7 = new MarkerInfo(player, 0, new Vector3(-757.3046, -2578.625, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo7.SetData("JobGryzAction", 0); //склад 7 minfo7.SetData("JobGryzSklad", 7); break; case 8: MarkerInfo minfo8 = new MarkerInfo(player, 0, new Vector3(-754.7167, -2574.311, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo8.SetData("JobGryzAction", 0); //склад 8 minfo8.SetData("JobGryzSklad", 8); break; case 9: MarkerInfo minfo9 = new MarkerInfo(player, 0, new Vector3(-752.1079, -2569.722, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo9.SetData("JobGryzAction", 0); //склад 9 minfo9.SetData("JobGryzSklad", 9); break; case 10: MarkerInfo minfo10 = new MarkerInfo(player, 0, new Vector3(-749.6968, -2565.644, 13.28), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 0, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo10.SetData("JobGryzAction", 0); //склад 10 minfo10.SetData("JobGryzSklad", 10); break; } #endregion } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~В данный момент товар для отгрузки отсутсвует."); } break; case 0: if (mInfo.HasData("JobGryzSklad")) { myBox = GryzBoxes.Where(i => i.Player == player).FirstOrDefault(); if (myBox != null) { if ((int)mInfo.GetData("JobGryzSklad") == myBox.Type) { MarkerInfo minfo10 = new MarkerInfo(player, 1, new Vector3(-774.0269, -2653.793, 12.83), new Vector3(), new Vector3(), new Vector3(1f, 1f, 1), 100, 255, 255, 0, 1, 1, Jobs.JOB_JOBGRYZ_ONE); minfo10.SetData("JobGryzAction", 1); API.playPlayerAnimation(player, (int)(AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "anim@heists@load_box", "load_box_2"); PlayerInfo pInfo = API.getEntityData(player.handle, Constants.PlayerAccount); pInfo.FreezePlayer(); lifeRP_GM.mainClass.Stream(1600, () => { API.detachEntity(myBox.Object); API.setEntityPosition(myBox.Object, new Vector3(55.31, -1259.78, -10.0)); API.deleteEntity(myBox.Object); GryzBoxes.Remove(myBox); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Вы положили ящик на склад"); pInfo.UnFreezePlayer(); API.stopPlayerAnimation(player); pInfo.jobMoney = pInfo.jobMoney + Money; }); } } } break; } } else if (mInfo.HasData("JobGryzZone")) { // Работник в зоне, не трогаем, пусть работает. } else { API.triggerClientEvent(player, "JobGryzStart"); } } } else { API.deleteColShape(colshape); } }
private void onMarkerEnter(ColShape colshape, NetHandle entity) { if (colshape.hasData(Constants.MarkerClass)) { MarkerInfo mInfo = colshape.getData(Constants.MarkerClass); Client player; int type = (int)API.getEntityType(entity); if (type == 6) { player = API.getPlayerFromHandle(entity); } else { return; } if (mInfo.local && mInfo.player != player) { return; } PlayerInfo pInfo = API.getEntityData(player.handle, Constants.PlayerAccount); if (mInfo.HasData("JOB_IMMIGRANT_SEARCH")) { var percent = ((pInfo.Bottles * 0.1 + pInfo.Paper + pInfo.Cabel) / 40) * 100; if (percent > 100) { API.sendChatMessageToPlayer(player, "~y~[Server] ~r~Рюкзак переполнен!"); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сдайте ваш инвентарь на завод!"); return; } API.setEntityRotation(player, new Vector3(0, 0, -90)); API.playPlayerAnimation(player, 0, "timetable@maid@cleaning_surface@idle_a", "idle_a"); byte bottles = (byte)SuperRandom.Next(1, 5); pInfo.Bottles += bottles; byte paper = (byte)SuperRandom.Next(0, 3); pInfo.Paper += paper; byte cabel = (byte)SuperRandom.Next(0, 3); pInfo.Cabel += cabel; lifeRP_GM.mainClass.Stream(4500, () => { API.triggerClientEvent(player, "SEND_BOMJ_DATA", pInfo.Bottles.ToString(), pInfo.Paper.ToString(), pInfo.Cabel.ToString()); API.sendChatMessageToPlayer(API.getPlayerFromHandle(entity), string.Format("~y~Вы нашли:\r\nБутылок - {0} шт.!\r\nБумаги - {1} кг.!\r\nЦветного металла - {2} кг.!", bottles, paper, cabel)); }); var binfo = mInfo.GetData("JOB_IMMIGRANT_SEARCH"); mInfo.DeleteMarker(); if (binfo != null) { binfo.DeleteBlip(); } } else if (mInfo.HasData("JOB_IMMIGRANT_CVETMET")) { if (pInfo.Job == (int)Jobs.NULL) { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету рюкзака для продажи."); } else if (pInfo.Job == (int)Jobs.JOB_IMMIGRANT) { if (pInfo.Cabel != 0) { int CabelMoney = pInfo.Cabel * CabelCost; pInfo.money += CabelMoney; pInfo.Cabel = 0; pInfo.UpdateBD(); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Вы продали цветной металл на: ~r~$" + CabelMoney.ToString()); API.triggerClientEvent(player, "SEND_BOMJ_DATA", pInfo.Bottles.ToString(), pInfo.Paper.ToString(), pInfo.Cabel.ToString()); if (pInfo.Bottles == 0 && pInfo.Cabel == 0 && pInfo.Paper == 0) { JobImmigrantYval(player); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету цвет. металла!"); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сначала завершите старую работу."); } return; } else if (mInfo.HasData("JOB_IMMIGRANT_STEKLO")) { if (pInfo.Job == (int)Jobs.NULL) { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету рюкзака для продажи."); } else if (pInfo.Job == (int)Jobs.JOB_IMMIGRANT) { if (pInfo.Bottles != 0) { int BottlesMoney = pInfo.Bottles * BottleCost; pInfo.money += BottlesMoney; pInfo.Bottles = 0; pInfo.UpdateBD(); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Вы продали бутылки на: ~r~$" + BottlesMoney.ToString()); API.triggerClientEvent(player, "SEND_BOMJ_DATA", pInfo.Bottles.ToString(), pInfo.Paper.ToString(), pInfo.Cabel.ToString()); if (pInfo.Bottles == 0 && pInfo.Cabel == 0 && pInfo.Paper == 0) { JobImmigrantYval(player); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету бутылок!"); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сначала завершите старую работу."); } return; } else if (mInfo.HasData("JOB_IMMIGRANT_BUMAGA")) { if (pInfo.Job == (int)Jobs.NULL) { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету рюкзака для продажи."); } else if (pInfo.Job == (int)Jobs.JOB_IMMIGRANT) { if (pInfo.Paper != 0) { int PaperMoney = pInfo.Paper * PaperCost; pInfo.money += PaperMoney; pInfo.Paper = 0; pInfo.UpdateBD(); API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Вы продали бумагу на: ~r~$" + PaperMoney.ToString()); API.triggerClientEvent(player, "SEND_BOMJ_DATA", pInfo.Bottles.ToString(), pInfo.Paper.ToString(), pInfo.Cabel.ToString()); if (pInfo.Bottles == 0 && pInfo.Cabel == 0 && pInfo.Paper == 0) { JobImmigrantYval(player); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~У вас нету бумаги!"); } } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сначала завершите старую работу."); } return; } else if (mInfo.HasData("JOB_IMMIGRANT")) { if (pInfo.Job == (int)Jobs.NULL) { for (byte i = 0; i < TrashCoords.Length; i++) { var mark = new MarkerInfo(player, 1, new Vector3(TrashCoords[i].X, TrashCoords[i].Y, TrashCoords[i].Z), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 1), 100, 236, 147, 89, 1, 1, Jobs.JOB_IMMIGRANT); var blip = new BlipInfo(player, new Vector3(TrashCoords[i].X, TrashCoords[i].Y, TrashCoords[i].Z), 1, 17, true, 0, "Мусорный ящик", Jobs.JOB_IMMIGRANT); mark.SetData("JOB_IMMIGRANT_SEARCH", blip); } new MarkerInfo(player, 1, new Vector3(1083.46, -1974.33, 30.0165), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 2), 100, 236, 147, 89, 1, 2, Jobs.JOB_IMMIGRANT).SetData("JOB_IMMIGRANT_CVETMET", 1); new MarkerInfo(player, 1, new Vector3(1137.99, -2046.25, 30.0165), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 2), 100, 236, 147, 89, 1, 2, Jobs.JOB_IMMIGRANT).SetData("JOB_IMMIGRANT_STEKLO", 1); new MarkerInfo(player, 1, new Vector3(1070.04, -1971.78, 30.0321), new Vector3(1, 1, 1), new Vector3(35.5, 1, 1), new Vector3(1.5, 1.5, 2), 100, 236, 147, 89, 1, 2, Jobs.JOB_IMMIGRANT).SetData("JOB_IMMIGRANT_BUMAGA", 1); new BlipInfo(player, new Vector3(1083.46, -1974.33, 30.0165), 440, 17, true, 0, "Пункт приема цветного металла", Jobs.JOB_IMMIGRANT); new BlipInfo(player, new Vector3(1137.99, -2046.25, 30.0165), 440, 17, true, 0, "Пункт приема стеклотары", Jobs.JOB_IMMIGRANT); new BlipInfo(player, new Vector3(1070.04, -1971.78, 30.0321), 440, 17, true, 0, "Пункт приема бумаги", Jobs.JOB_IMMIGRANT); new TLabelInfo(player, "Пункт приема цветного металла", new Vector3(1083.46, -1974.33, 31.0165), 25, 1, false, 0, Jobs.JOB_IMMIGRANT); new TLabelInfo(player, "Пункт приема стеклотары", new Vector3(1137.99, -2046.25, 31.0165), 25, 1, false, 0, Jobs.JOB_IMMIGRANT); new TLabelInfo(player, "Пункт приема бумаги", new Vector3(1070.04, -1971.78, 31.0321), 25, 1, false, 0, Jobs.JOB_IMMIGRANT); pInfo.PISUN = API.createObject(-2137120552, new Vector3(806.8278, -809.9581, 25.2029), new Vector3(0, 0, 0)); API.sendChatMessageToPlayer(player, "~y~[Server] ~g~Вы устроились на работу."); pInfo.Job = (int)Jobs.JOB_IMMIGRANT; API.attachEntityToEntity(pInfo.PISUN, player.handle, "SKEL_Spine2", new Vector3(0.15, -0.25, 0), new Vector3(-180, -90, -180)); new ServerWayPoint().CreateWayPoint(player, 1073, -1965); pInfo.Bottles += 1; pInfo.Paper += 1; pInfo.Cabel += 1; API.playPlayerAnimation(player, 0, "timetable@maid@cleaning_surface@idle_a", "idle_a"); API.triggerClientEvent(player, "OPEN_TEST_BAG"); lifeRP_GM.mainClass.Stream(4500, () => { API.sendChatMessageToPlayer(player, string.Format("~y~Вы нашли:\r\nБутылок - {0} шт.!\r\nБумаги - {1} кг.!\r\nЦветного металла - {2} кг.!", 1, 1, 1)); API.triggerClientEvent(player, "SEND_BOMJ_DATA", pInfo.Bottles.ToString(), pInfo.Paper.ToString(), pInfo.Cabel.ToString()); }); } else if (pInfo.Job == (int)Jobs.JOB_IMMIGRANT) { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сдайте ваш инвентарь на завод!"); } else { API.sendChatMessageToPlayer(player, "~y~[Server] ~b~Сначала завершите старую работу."); } return; } } }