public override async void Begin() { await Session.Loading(); var character = Cache.Character; if (character.Metadata.ActiveJailCase == null) { return; } SetActive(character.Metadata.ActiveJailCase); Atlas.AttachTickHandler(OnTick); var marker = new Marker(JailPosition) { Message = "Tryck ~INPUT_CONTEXT~ för att fängsla personen.", Scale = 3f, Condition = self => character.Metadata.Employment == Employment.Police }; marker.Callback += OpenJailMenu; marker.Show(); }
public async void Jail(JailCase jailCase) { API.DoScreenFadeOut(0); var character = Cache.Character; Chat.SendGlobalMessage("Fängelse", $"{character.Fullname} Har blivit fängslad i {jailCase.GetDate(jailCase.IssuedAt)} med {jailCase.GetSecurity().ToLower()} säkerhet:", Color.FromArgb(255, 0, 0)); Chat.SendGlobalMessage($"- {jailCase.Crime}", Color.FromArgb(255, 255, 255)); await Cache.Entity.Teleport(Positions[jailCase.JailSecurity]); SetActive(jailCase); jailCase.Commit(character); LastJailCase = jailCase; Atlas.AttachTickHandler(OnTick); await BaseScript.Delay(3000); API.DoScreenFadeIn(5000); }
public void Show() { Atlas.AttachTickHandler(OnTick); }
public override async void Begin(Job job) { var model = new Model(MerchantModel); if (MerchantModel != 0 && MerchantPosition != null) { var merchantId = $"merchant::{job.Attachment.ToString().ToLower()}"; var package = NetworkPackage.GetModule(); if (Session.IsSpawnHost() && !API.NetworkDoesNetworkIdExist(package.GetLoad <int>(merchantId).Get())) { await model.Request(5000); var ped = API.CreatePed(6, (uint)model.Hash, MerchantPosition.X, MerchantPosition.Y, MerchantPosition.Z, MerchantPosition.Heading, true, false); Merchant = new Merchant(ped) { Important = true, Position = MerchantPosition }; package.GetLoad <int>(merchantId).UpdateAndCommit(Merchant.NetworkModule.GetId()); await SafeTeleport.Teleport(ped, MerchantPosition); Merchant.Movable = false; } else { while ((Merchant = MerchantManager.GetModule() .GetMerchantById(package.GetLoad <int>(merchantId).Get())) == null) { await BaseScript.Delay(1000); } } } await Session.Loading(); var player = Cache.Player; var character = Cache.Character; var marker = new Marker(Armory) { Message = "Tryck ~INPUT_CONTEXT~ för att komma åt förrådet", Color = Color.Transparent, Condition = self => character.Metadata.Employment == job.Attachment }; marker.Callback += async() => { if (MerchantPosition != null && Merchant != null) { await player.Entity.AnimationQueue.PlayDirectInQueue(new AnimationBuilder() .Select("gestures@m@standing@casual", "gesture_hello") .AtPosition(Armory) ); } Callback?.Invoke(); }; marker.Show(); Atlas.AttachTickHandler(OnTick); }