public void SetUp() { fakeClient = new FakeBotClient(); register = new CommandRegister(fakeClient); register.RegisterCommand("ping", new Ping()); register.RegisterCommand("fake", new Ping()); }
public BindableEmotes(Client client) : base(client) { client.RegisterTickHandler(OnTick); CommandRegister.RegisterCommand("bind", cmd => { var key = cmd.GetArgAs(0, ""); var emote = cmd.GetArgAs(1, ""); if (controlToString.FirstOrDefault(o => o.Value.ToLower() == key.ToLower()).Value != null) { if (EmoteManager.playerAnimations.ContainsKey(emote)) { client.TriggerServerEvent("Emotes.BindEmote", key.ToUpper(), emote); Log.ToChat("[Info]", $"Bound {key.ToUpper()} to emote {emote}", ConstantColours.Info); } else { Log.ToChat("[Info]", $"The emote {emote} doesn't exist", ConstantColours.Info); } } else { Log.ToChat("[Info]", $"The key {key.ToUpper()} cannot be bound", ConstantColours.Info); } }); }
public EngineToggle(Client client) : base(client) { client.Get <InteractionUI>().RegisterInteractionMenuItem(engineItem, () => Cache.PlayerPed.IsInVehicle() && Cache.PlayerPed.CurrentVehicle.Driver == Cache.PlayerPed, 500); client.RegisterEventHandler("Vehicle.SetEngineState", new Action <bool>(setEngineState)); client.RegisterTickHandler(OnTick); CommandRegister.RegisterCommand("engine", handleEngineCommand); }
public DragHandler(Server server) : base(server) { //server.RegisterEventHandler("Drag.StartDrag", new Action<Player, int>(HandleDragRequest)); server.RegisterEventHandler("Drag.RequestUnDrag", new Action <Player>(OnUnDragRequest)); CommandRegister.RegisterCommand("drag", OnDragCommand); }
public VehicleDoorCommands(Client client) : base(client) { Enum.GetValues(typeof(VehicleDoorIndex)).Cast <VehicleDoorIndex>().ToList().ForEach(o => { CommandRegister.RegisterCommand(o.ToString().Replace("Door", "").Replace("Back", "Rear").ToLower(), cmd => ToggleVehicleDoor(o)); }); }
public Billing() { CommandRegister.RegisterJobCommand("bill", OnBillCommand, JobType.Police); CommandRegister.RegisterJobCommand("paytow", OnPayTow, JobType.Police); CommandRegister.RegisterCommand("showbill|showdebt", cmd => Log.ToClient("[Bill]", $"Bill to state: ${cmd.Session.GetGlobalData("Character.Bill", 0)}", ConstantColours.Housing, cmd.Player)); CommandRegister.RegisterCommand("paystate", OnPayBill); }
public static void CreateRestrictedCommand <T>(string commandName, Action <Command> commandFunc, T specifiedLevel, bool specifiedLevelOnly = false) where T : struct, Enum { var commandAliases = commandName.Split('_')[0].Split('|'); var specifiedLevelValue = (int)(object)specifiedLevel; var levels = Enum.GetValues(typeof(T)); var adminLevels = new List <int>(); foreach (int i in levels) { adminLevels.Add(i); } commandAliases.ToList().ForEach(o => { Log.Debug($"Adding restricted command {o} for group {Enum.GetName(typeof(T), specifiedLevelValue)}"); if (!specifiedLevelOnly) { adminLevels.ForEach(level => { if (level >= specifiedLevelValue) { ExecuteCommand($"add_ace group.{Enum.GetName(typeof(T), level)} command.{o} allow"); } }); } else { ExecuteCommand($"add_ace group.{Enum.GetName(typeof(T), specifiedLevelValue)} command.{o} allow"); } }); CommandRegister.RegisterCommand(commandName, commandFunc, true); }
public Outfits(Client client) : base(client) { outfitMenu = new MenuModel { headerTitle = "Outfits", menuItems = new List <MenuItem> { new MenuItemStandard { Title = "You have no outfits" } } }; client.Get <InteractionUI>().RegisterInteractionMenuItem(new MenuItemSubMenu { Title = "Outfits", SubMenu = outfitMenu, OnActivate = updateOutfitList }, InRangeOfOutfitChange, 550); CommandRegister.RegisterCommand("useoutfit", cmd => { var outfitName = string.Join(" ", cmd.Args); if (InRangeOfOutfitChange()) { Client.TriggerServerEvent("Outfit.AttemptChange", outfitName); } }); MarkerHandler.AddMarkerAsync(outfitChangeLocations); }
public Radar() { Client.RegisterEventHandler("Police.ToggleRadar", new Action(ToggleRadar)); CommandRegister.RegisterCommand("radar", cmd => { ToggleRadar(); }); }
public BankHandler(Server server) : base(server) { CommandRegister.RegisterCommand("cash|balance", HandleBalanceRequest); server.RegisterEventHandler("Bank.AttemptWithdraw", new Action <Player, int>(OnWithdrawRequest)); server.RegisterEventHandler("Bank.AttemptDeposit", new Action <Player, int>(OnDepositRequest)); server.RegisterTickHandler(SaveTick); loadAccountIDs(); }
public Phones(Server server) : base(server) { contact = Server.Get <Contacts>(); CommandRegister.RegisterCommand("text", OnTextCommand); CommandRegister.RegisterCommand("phonenumber|phone", cmd => { Log.ToClient("[Phone]", IntToPhoneNumber(cmd.Session.GetGlobalData <int>("Character.CharID")), ConstantColours.Phone, cmd.Player); }); }
public Banks(Client client) : base(client) { CommandRegister.RegisterCommand("withdraw", OnWithdrawRequest); CommandRegister.RegisterCommand("deposit", OnDepositRequest); client.RegisterEventHandler("Player.CheckForInteraction", new Action(OnInteraciton)); client.RegisterEventHandler("Robbery.UpdateRobberyPosition", new Action(OnCoordRequest)); client.RegisterEventHandler("Bank.ShowVaultMarker", new Action <string>(OnShowVaultMarker)); LoadBlips(); }
public PaymentHandler(Server server) : base(server) { CommandRegister.RegisterCommand("setpaymenttype|setpaymentmethod|paywith", OnPaymentMethodSet); server.RegisterEventHandler("Job.RequestDeliveryPayment", new Action <Player, List <object>, List <object>, string>(OnDeliveryPayReq)); server.RegisterEventHandler("Job.RequestPayForJob", new Action <Player, string, string>(OnJobPayReq)); server.RegisterEventHandler("Job.RequestRemoteJobPayment", new Action <Player, int, string>(OnRemoteJobPay)); server.RegisterEventHandler("Payment.PayForItem", new Action <Player, int, string>(OnRemotePay)); server.RegisterEventHandler("Payment.CanPayForItem", new Action <Player, int>(OnCheckCanPay)); server.RegisterEventHandler("Payment.GivePlayerCash", new Action <Player, int, int>(OnGiveCash)); server.RegisterTickHandler(PaycheckTick); }
public LoginHandler(Server server) : base(server) { server.RegisterEventHandler("Login.RequestCharacters", new Action <Player>(OnCharactersRequest)); server.RegisterEventHandler("Login.CreateCharacter", new Action <Player, string, string, string>(OnCreateRequest)); server.RegisterEventHandler("Login.LoadCharacter", new Action <Player, int>(OnLoadRequest)); server.RegisterEventHandler("Login.DeleteCharacter", new Action <Player, int>(OnCharacterDelete)); CommandRegister.RegisterAdminCommand("logout", cmd => OnCharactersRequest(cmd.Player), AdminLevel.Developer); CommandRegister.RegisterCommand("showlogin", cmd => { OnCharactersRequest(cmd.Player); }); }
public SkinHandler(Client client) : base(client) { client.RegisterEventHandler("Skin.LoadPlayerSkin", new Action <dynamic>(data => { CharacterEditorMenu.handleSkinCreate(data == null ? CharacterEditorMenu.skinData : data); })); client.RegisterEventHandler("Skin.StartCharacterCreation", new Action <int>(async playerHome => { CharacterEditorMenu charMenu = new CharacterEditorMenu(); while (charMenu.Observer.CurrentMenu != null) { Client.Get <Arrest>().DisableActions(); Game.PlayerPed.Task.ClearAll(); await BaseScript.Delay(0); } //if (playerHome != 0) TriggerEvent("spawnPlayerHome", playerHome); })); client.RegisterEventHandler("Skin.UpdatePlayerSkinData", new Action <dynamic>(skinData => CharacterEditorMenu.skinData = skinData)); client.RegisterEventHandler("Skin.SaveCurrentOutfit", new Action <string>(handleOutfitCreate)); client.Get <InteractionUI>().RegisterInteractionMenuItem(new MenuFramework.MenuItemStandard { Title = "Clothing Store", OnActivate = state => { new CharacterEditorMenu(true); InteractionUI.Observer.CloseMenu(true); } }, () => clothingStoreLocaitons.Any(o => o.DistanceToSquared(Game.PlayerPed.Position) < 5.0f), 500); BlipHandler.AddBlip("Clothing store", clothingStoreLocaitons, new BlipOptions { Sprite = BlipSprite.Clothes }); MarkerHandler.AddMarker(clothingStoreLocaitons); client.RegisterEventHandler("Skin.RefreshSkin", new Action(RefreshPlayerSkin)); client.RegisterEventHandler("Player.OnLoginComplete", new Action(RefreshPlayerSkin)); client.RegisterEventHandler("Player.CheckForInteraction", new Action(() => { if (clothingStoreLocaitons.Any(o => o.DistanceToSquared(Game.PlayerPed.Position) < 5.0f)) { new CharacterEditorMenu(true); } })); client.RegisterEventHandler("Player.OnSkinLoaded", new Action(() => canRefreshSkin = false)); CommandRegister.RegisterCommand("refreshskin", async cmd => { if (!canRefreshSkin) { return; } await cmd.Session.UpdateData("Character.SkinData"); RefreshPlayerSkin(); }); }
public JobCalling() { CommandRegister.RegisterCommand("taxi", OnTaxiMessage); CommandRegister.RegisterJobCommand("taxir", OnTaxiRespond, JobType.Taxi); CommandRegister.RegisterJobCommand("towr", OnTowRespond, JobType.Tow); CommandRegister.RegisterCommand("calltow", OnCallTow); CommandRegister.RegisterCommand("taxis", CheckAvailableTaxis); CommandRegister.RegisterCommand("tows", CheckAvailableTows); Server.RegisterEventHandler("Job.SendTowVehicle", new Action <Player, string>(OnRecieveTow)); }
public InventoryMenuHandler(Client client) : base(client) { RegisterInventoryMenu("PlayerInventory", new PlayerInventoryMenu("")); RegisterInventoryMenu("VehicleInventory", new VehicleInventoryMenu("")); RegisterInventoryMenu("PropertyInventory", new PropertyInventoryMenu("")); CommandRegister.RegisterCommand("inv|inventory", cmd => { OpenInventoryMenu("PlayerInventory"); }); CommandRegister.RegisterCommand("vehinv|vehicleinventory", new Action <Command>(cmd => { OpenInventoryMenu("VehicleInventory"); })); }
public VoipRanges(Client client) : base(client) { CommandRegister.RegisterCommand("voip", changeVoipRange); voipTypes.ToList().ForEach(o => voipRanges.Add(o.Value)); client.RegisterTickHandler(OnTick); voiceText = new ScreenText("Voice: ", 31, 1026, 0.25f, TextThread, System.Drawing.Color.FromArgb(255, 200, 200, 200), Font.ChaletLondon, Alignment.Left); rangeText = new ScreenText(currentVoipName, 78, 1026, 0.25f, VoipRangeTick, System.Drawing.Color.FromArgb(255, 200, 200, 200), Font.ChaletLondon, Alignment.Left); CitizenFX.Core.Native.API.NetworkSetTalkerProximity(voipTypes["Nearby"]); client.RegisterEventHandler("Session.Loaded", new Action(() => { CitizenFX.Core.Native.API.NetworkSetTalkerProximity(voipTypes["Nearby"]); CitizenFX.Core.Native.API.NetworkClearVoiceChannel(); })); }
public CallBlips(Client client) : base(client) { client.RegisterEventHandler("Blip.CreateEmergencyBlip", new Action <int>(CreateEmgerencyBlip)); client.RegisterEventHandler("Blip.CreateJobBlip", new Action <string, int, int>(CreateJobBlip)); client.RegisterTickHandler(RemoveBlipTick); CommandRegister.RegisterCommand("remblip|delblip", cmd => { var targetBlip = cmd.GetArgAs(0, 0); if (playersBlips.ContainsKey(targetBlip)) { playersBlips[targetBlip].Delete(); playersBlips.Remove(targetBlip); } }); }
public ToggleableClothing(Client client) : base(client) { client.RegisterEventHandler("Player.OnSkinLoaded", new Action(() => { glassesPropIndex = Game.PlayerPed.Style[PedProps.Glasses].Index; glassesTextureIndex = Game.PlayerPed.Style[PedProps.Glasses].Index; hatPropIndex = Game.PlayerPed.Style[PedProps.Hats].Index; hatTextureIndex = Game.PlayerPed.Style[PedProps.Hats].TextureIndex; maskPropIndex = Game.PlayerPed.Style[PedComponents.Head].Index; maskTextureIndex = Game.PlayerPed.Style[PedComponents.Head].TextureIndex; })); CommandRegister.RegisterCommand("glasses", handleGlassesCommand); CommandRegister.RegisterCommand("hat", handleHatCommand); CommandRegister.RegisterCommand("mask", handleMaskCommand); }
public VehicleHandler(Client client) : base(client) { client.RegisterEventHandler("Vehicle.SetBoughtVehID", new Action <int>(SetBoughtVehId)); client.RegisterEventHandler("Vehicle.SpawnGarageVehicle", new Action <string, int, string>(OnSpawnRequest)); client.RegisterEventHandler("Vehicle.ReceiveExternalVehID", new Action <int>(SetVehicleVehId)); client.RegisterTickHandler(SaveVehicleTick); EntityDecoration.RegisterProperty("Vehicle.ID", DecorationType.Int); /*CommandRegister.RegisterCommand("testadd", cmd => * { * var closeVeh = GTAHelpers.GetClosestVehicle(); * Magicallity.Client.Client.Instance.TriggerServerEvent("Vehicle.CreateExternalVehicle", VehicleDataPacker.PackVehicleData(closeVeh)); * }); * CommandRegister.RegisterCommand("getvehid", cmd => * { * Log.ToChat(GTAHelpers.GetClosestVehicle().GetDecor<int>("Vehicle.ID").ToString()); * });*/ CommandRegister.RegisterCommand("givekeys", OnGiveKeysCommand); CommandRegister.RegisterCommand("giveveh|givevehicle", OnGiveVehCommand); }
public SharedEmergencyItems() { CommandRegister.RegisterJobCommand("duty", OnDutyRequest, JobType.Police | JobType.EMS | JobType.Mechanic, true); CommandRegister.RegisterCommand("911", on911Command); CommandRegister.RegisterJobCommand("911r", on911Reply, JobType.Police | JobType.EMS); CommandRegister.RegisterCommand("311", on311Command); CommandRegister.RegisterJobCommand("311r", on311Reply, JobType.Police | JobType.EMS); CommandRegister.RegisterJobCommand("cv", cmd => cmd.Player.TriggerEvent("Job.SpawnServiceVehicle", cmd.GetArgAs(0, 1) - 1), JobType.Police | JobType.EMS); CommandRegister.RegisterJobCommand("impound", cmd => cmd.Player.TriggerEvent("Job.DeleteVehicle", true), JobType.Police | JobType.EMS | JobType.Mechanic | JobType.Tow); CommandRegister.RegisterJobCommand("fix", cmd => cmd.Player.TriggerEvent("Job.FixVehicle"), JobType.Police | JobType.EMS | JobType.Mechanic); CommandRegister.RegisterJobCommand("dv", cmd => cmd.Player.TriggerEvent("Job.DeleteVehicle"), JobType.Police | JobType.EMS); CommandRegister.RegisterAdminCommand("dv", cmd => cmd.Player.TriggerEvent("Job.DeleteVehicle"), AdminLevel.Moderator); CommandRegister.RegisterJobCommand("13", OnPanicButton, JobType.Police | JobType.EMS); CommandRegister.RegisterJobCommand("slimjim", cmd => cmd.Player.TriggerEvent("Lockpick.StartVehicleLockpick", 2), JobType.EMS | JobType.Police | JobType.Mechanic); CommandRegister.RegisterJobCommand("extra", cmd => cmd.Player.TriggerEvent("Job.SetVehicleExtra", cmd.GetArgAs(0, "1"), cmd.GetArgAs(1, "false")), JobType.Police | JobType.EMS); CommandRegister.RegisterJobCommand("setspawn", OnSetSpawn, JobType.EMS | JobType.Police, true); CommandRegister.RegisterJobCommand("resetspawn", OnResetSpawn, JobType.EMS | JobType.Police, true); CommandRegister.RegisterJobCommand("discount", cmd => cmd.Player.TriggerEvent("LSC:magicmechanic"), JobType.Mechanic); CommandRegister.RegisterJobCommand("setcallsign", OnSetCallsign, JobType.Police | JobType.EMS); }
public UIEvents(Server server) : base(server) { CommandRegister.RegisterCommand("setmenulocation", async cmd => { var menuLocationName = cmd.GetArgAs(0, "topright"); if (interactionMenuLocations.ContainsKey(menuLocationName)) { var playerSettings = cmd.Session./*GetPlayerSettings()*/ PlayerSettings; var menuLocation = interactionMenuLocations[menuLocationName]; playerSettings["Interaction.Menu.X"] = menuLocation.Item1; playerSettings["Interaction.Menu.Y"] = menuLocation.Item2; cmd.Session./*SetPlayerSettings()*/ PlayerSettings = playerSettings; cmd.Session.TriggerEvent("UI.UpdateInteractionMenuLocation", playerSettings["Interaction.Menu.X"], playerSettings["Interaction.Menu.Y"]); Log.ToClient("[Info]", $"Set interacion menu location to {menuLocationName}", ConstantColours.Info, cmd.Player); } }); }
public OutfitHandler(Server server) : base(server) { CommandRegister.RegisterCommand("saveoutfit", cmd => { var outfitName = string.Join(" ", cmd.Args); var playerSession = cmd.Session; var playerSettings = playerSession.GetGlobalData("Character.Settings", "") == "" ? new Dictionary <string, dynamic>() : JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(playerSession.GetGlobalData("Character.Settings", "")); var currentOutfits = GetPlayerOutfits(playerSession); if (!currentOutfits.ContainsKey(outfitName)) { currentOutfits[outfitName] = playerSession.GetGlobalData <string>("Character.SkinData"); playerSettings["Outfits"] = currentOutfits; playerSession.SetGlobalData("Character.Settings", JsonConvert.SerializeObject(playerSettings)); } else { Log.ToClient("[Info]", $"An outfit with the name ^2{outfitName}^0 already exists", ConstantColours.Info, cmd.Player); } }); CommandRegister.RegisterCommand("removeoutfit|deleteoutfit|deloutfit", cmd => { var playerSession = cmd.Session; var outfitName = string.Join(" ", cmd.Args); var playerSettings = playerSession.GetGlobalData("Character.Settings", "") == "" ? new Dictionary <string, dynamic>() : JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(playerSession.GetGlobalData("Character.Settings", "")); var currentOutfits = GetPlayerOutfits(cmd.Session); if (currentOutfits.ContainsKey(outfitName)) { currentOutfits.Remove(outfitName); playerSettings["Outfits"] = currentOutfits; playerSession.SetGlobalData("Character.Settings", JsonConvert.SerializeObject(playerSettings)); Log.ToClient("[Info]", $"Deleted outfit ^2{outfitName}^0", ConstantColours.Info, cmd.Player); } }); Server.RegisterEventHandler("Outfit.AttemptChange", new Action <Player, string>(OnChangeOutfit)); }
public Taxi() { returnVehicleItem = new MenuItemStandard { Title = "Return Job Vehicle", OnActivate = async item => { if (Game.PlayerPed.Position.DistanceToSquared(vehicleSpawnLocation) < 200.0f && JobVehicle != null && (JobVehicle.Position.DistanceToSquared(vehicleSpawnLocation) < 200.0f || JobVehicle.IsDead)) { if (Game.PlayerPed.IsInVehicle() && Game.PlayerPed.CurrentVehicle == JobVehicle) { Game.PlayerPed.Task.LeaveVehicle(JobVehicle, true); } Log.ToChat("[Job]", "Returning job vehicle", ConstantColours.Job); await BaseScript.Delay(3000); EndJob(); Client.Get <InteractionUI>().RemoveInteractionMenuItem(returnVehicleItem); } } }; CommandRegister.RegisterCommand("canceltaxijob", new Action <Command>(cmd => { if (inTaxiJob) { Log.ToChat("[Job]", "You cancelled your current taxi job", ConstantColours.Job); endTaxiJob(); } else { Log.ToChat("[Job]", "You must have a fare to cancel your job", ConstantColours.Job); } })); Client.RegisterEventHandler("Player.CheckForInteraction", new Action(OnInteraction)); LoadBlips(); //Client.Instance.RegisterTickHandler(JobTick); //Client.Instance.RegisterTickHandler(taxiSearchTick); }
public Tow() { returnVehicleItem = new MenuItemStandard { Title = "Return Job Vehicle", OnActivate = async item => { if (Game.PlayerPed.Position.DistanceToSquared(towDropoffPoint) < 200.0f && currentTowTruck != null && (currentTowTruck.Position.DistanceToSquared(towDropoffPoint) < 200.0f || currentTowTruck.IsDead)) { if (Game.PlayerPed.IsInVehicle() && Game.PlayerPed.CurrentVehicle == currentTowTruck) { Game.PlayerPed.Task.LeaveVehicle(currentTowTruck, true); } Log.ToChat("[Job]", "Returning job vehicle", ConstantColours.Job); await BaseScript.Delay(3000); EndJob(); Client.Get <InteractionUI>().RemoveInteractionMenuItem(returnVehicleItem); } } }; Client.RegisterTickHandler(VehicleGetTick); Client.RegisterTickHandler(JobTick); Client.RegisterEventHandler("Player.CheckForInteraction", new Action(OnInteraction)); Client.RegisterEventHandler("Job.GetTowRequest", new Action(OnTowRequest)); CommandRegister.RegisterCommand("tow", handleTowCommand); CommandRegister.RegisterCommand("canceltowjob", handleTowJobCancel); BlipHandler.AddBlip("Tow yard", towMarkerLocation, new BlipOptions { Sprite = BlipSprite.TowTruck }); MarkerHandler.AddMarker(towMarkerLocation, new MarkerOptions { ScaleFloat = 4.0f }); }
public FuelManager(Client client) : base(client) { EntityDecoration.RegisterProperty("Vehicle.Fuel", DecorationType.Float); client.RegisterEventHandler("baseevents:enteredVehicle", new Action <int, int, string>(async(veh, seat, name) => { var vehicle = Cache.PlayerPed.CurrentVehicle; vehicleFuel = -1; if (vehicle.HasDecor("Vehicle.ID")) { client.TriggerServerEvent("Vehicle.RequestFuelLevel", vehicle.GetDecor <int>("Vehicle.ID")); } await BaseScript.Delay(1000); client.RegisterTickHandler(FuelTick); })); client.RegisterEventHandler("baseevents:leftVehicle", new Action <int, int, string>((veh, seat, name) => { vehicleFuel = -1; client.DeregisterTickHandler(FuelTick); })); client.RegisterEventHandler("Vehicle.RecieveFuelLevel", new Action <float>(fuel => { Log.Verbose($"Recieved a fuel level of {fuel}%"); vehicleFuel = fuel; })); client.RegisterTickHandler(CheckForPumps); client.Get <InteractionUI>().RegisterInteractionMenuItem(new MenuItemStandard { Title = "Refuel vehicle", OnActivate = item => PumpRefuel() }, () => isNearFuelPump && !Game.PlayerPed.IsInVehicle(), 500); CommandRegister.RegisterCommand("refuel", OnRefuelCommand); }
public HousingManager(Server server) : base(server) { server.RegisterEventHandler("Player.OnInteraction", new Action <Player>(OnInteraction)); // server.RegisterEventHandler("Housing.CheckCanStoreVeh", new Action<Player>(OnAttemptStoreVehicle)); CommandRegister.RegisterCommand("showhouse|showhouses", OnShowHouse); RegisterHousingCommand("enter", OnHouseEnter); RegisterHousingCommand("exit", OnHouseExit); RegisterHousingCommand("allow", OnAllowEntry); RegisterHousingCommand("disallow", OnDisallowEntry); RegisterHousingCommand("buy", OnBuyCommand); RegisterHousingCommand("sell", OnSellCommand); CommandRegister.RegisterCommand("house", cmd => { var cmdName = cmd.GetArgAs(0, ""); if (housingCommands.ContainsKey(cmdName)) { cmd.Args.RemoveAt(0); housingCommands[cmdName](cmd); } }); loadHouseOwners(); }
public MiscEvents(Client client) : base(client) { client.RegisterEventHandler("Player.UpdateLocation", new Action(OnUpdateLocation)); client.RegisterEventHandler("Player.UpdatePosition", new Action(OnUpdatePosition)); client.RegisterEventHandler("Player.OnLoginComplete", new Action(() => { BaseScript.TriggerEvent("chat:addTemplate", "tweet", "<img src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxz%0D%0AdmcKICB2aWV3Ym94PSIwIDAgMjAwMCAxNjI1LjM2IgogIHdpZHRoPSIyMDAwIgogIGhlaWdodD0i%0D%0AMTYyNS4zNiIKICB2ZXJzaW9uPSIxLjEiCiAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAv%0D%0Ac3ZnIj4KICA8cGF0aAogICAgZD0ibSAxOTk5Ljk5OTksMTkyLjQgYyAtNzMuNTgsMzIuNjQgLTE1%0D%0AMi42Nyw1NC42OSAtMjM1LjY2LDY0LjYxIDg0LjcsLTUwLjc4IDE0OS43NywtMTMxLjE5IDE4MC40%0D%0AMSwtMjI3LjAxIC03OS4yOSw0Ny4wMyAtMTY3LjEsODEuMTcgLTI2MC41Nyw5OS41NyBDIDE2MDku%0D%0AMzM5OSw0OS44MiAxNTAyLjY5OTksMCAxMzg0LjY3OTksMCBjIC0yMjYuNiwwIC00MTAuMzI4LDE4%0D%0AMy43MSAtNDEwLjMyOCw0MTAuMzEgMCwzMi4xNiAzLjYyOCw2My40OCAxMC42MjUsOTMuNTEgLTM0%0D%0AMS4wMTYsLTE3LjExIC02NDMuMzY4LC0xODAuNDcgLTg0NS43MzksLTQyOC43MiAtMzUuMzI0LDYw%0D%0ALjYgLTU1LjU1ODMsMTMxLjA5IC01NS41NTgzLDIwNi4yOSAwLDE0Mi4zNiA3Mi40MzczLDI2Ny45%0D%0ANSAxODIuNTQzMywzNDEuNTMgLTY3LjI2MiwtMi4xMyAtMTMwLjUzNSwtMjAuNTkgLTE4NS44NTE5%0D%0ALC01MS4zMiAtMC4wMzksMS43MSAtMC4wMzksMy40MiAtMC4wMzksNS4xNiAwLDE5OC44MDMgMTQx%0D%0ALjQ0MSwzNjQuNjM1IDMyOS4xNDUsNDAyLjM0MiAtMzQuNDI2LDkuMzc1IC03MC42NzYsMTQuMzk1%0D%0AIC0xMDguMDk4LDE0LjM5NSAtMjYuNDQxLDAgLTUyLjE0NSwtMi41NzggLTc3LjIwMywtNy4zNjQg%0D%0ANTIuMjE1LDE2My4wMDggMjAzLjc1LDI4MS42NDkgMzgzLjMwNCwyODQuOTQ2IC0xNDAuNDI5LDEx%0D%0AMC4wNjIgLTMxNy4zNTEsMTc1LjY2IC01MDkuNTk3MiwxNzUuNjYgLTMzLjEyMTEsMCAtNjUuNzg1%0D%0AMSwtMS45NDkgLTk3Ljg4MjgsLTUuNzM4IDE4MS41ODYsMTE2LjQxNzYgMzk3LjI3LDE4NC4zNTkg%0D%0ANjI4Ljk4OCwxODQuMzU5IDc1NC43MzIsMCAxMTY3LjQ2MiwtNjI1LjIzOCAxMTY3LjQ2MiwtMTE2%0D%0ANy40NyAwLC0xNy43OSAtMC40MSwtMzUuNDggLTEuMiwtNTMuMDggODAuMTc5OSwtNTcuODYgMTQ5%0D%0ALjczOTksLTEzMC4xMiAyMDQuNzQ5OSwtMjEyLjQxIgogICAgc3R5bGU9ImZpbGw6IzAwYWNlZCIv%0D%0APgo8L3N2Zz4K' height='16'> <b style='color:#00BFFF'>{0}</b>: {1}"); BaseScript.TriggerEvent("chat:addTemplate", "chop", "<div style='background-color: rgba(66, 244, 179, 0.7); border-radius: 10px; width: 100%; text-align: center; vertical-align: middle;'><p style='opacity: 1.0; color: rgb(255, 255, 255);'>{0}</p><p style='text-size: 12px; text-align: right; padding-right: 5px;'>Time remaining: {1}</p></div>"); })); client.RegisterEventHandler("Player.ExecuteCommand", new Action <string>(ExecuteCommand)); client.RegisterEventHandler("Player.SetPosition", new Action <Vector3>(SetPosition)); client.RegisterEventHandler("Player.PlayTextAnim", new Action(() => textAnim.PlayFullAnim())); client.RegisterEventHandler("Player.PlayRadioAnim", new Action(() => callAnim.PlayFullAnim())); client.RegisterEventHandler("Player.SetHeading", new Action <float>(heading => Game.PlayerPed.Heading = heading)); client.RegisterEventHandler("Player.DoSmoke", new Action(() => EmoteManager.playerAnimations["smoke"].PlayFullAnim())); client.RegisterEventHandler("Player.DoDrink", new Action(() => EmoteManager.playerAnimations["drink"].PlayFullAnim())); client.RegisterEventHandler("Player.DoDrunkEffect", new Action <string>(OnDoDrunk)); client.RegisterEventHandler("Vehicle.WashVehicle", new Action(() => Cache.PlayerPed.CurrentVehicle.DirtLevel = 0.0f)); CommandRegister.RegisterCommand("givecash", OnGiveCash); CommandRegister.RegisterCommand("dirt", cmd => { Cache.PlayerPed.CurrentVehicle.DirtLevel = 15.0f; }); }
public ItemSeizing() { CommandRegister.RegisterCommand("seizevehitems|seizevehicleitems", OnSeizeVehItems); }