// --- Events public static void onEntityEnterColShape(ColShape shape, NetHandle entity) { if (shape != ArmouryInteractionColShape) { return; } Client PlayerC = API.shared.getPlayerFromHandle(entity); if (PlayerC == null) { return; } Player Player = Player.PlayerData[PlayerC]; PlayersInInteraction.Add(Player); if (IsGettingItem) { return; } if (PlayersInInteraction.Count == 1) { bool isAuthorised = FactionManager.IsPlayerAnOfficer(Player); ArmouryGuy.Speak(GetRandomMessageFromArray(isAuthorised ? AuthorizedEnterStatements : UnauthorizedEnterStatements)); } }
public void CuffPlayer(Client player, string target, bool cuff) { if (!FactionManager.IsPlayerAnOfficer(Player.PlayerData[player])) { Message.NotAuthorised(player); return; } Player trg = target == "" ? player.GetClosestPlayer(1) : Player.GetPlayerData(target); if (trg.Client == player) { API.SendErrorNotification(player, "You can't " + (cuff ? "cuff" : "uncuff") + " yourself."); return; } if (trg != null) { trg.IsCuffed = cuff; API.sendNativeToPlayer(trg.Client, Hash.SET_ENABLE_HANDCUFFS, trg.Client, trg.IsCuffed); if (trg.IsCuffed) { API.playPlayerAnimation(trg.Client, (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "mp_arresting", "idle"); } else { API.stopPlayerAnimation(trg.Client); } } }
private static void onEntityEnterColShape(ColShape colshape, NetHandle entity) { if ((colshape != CellEntrance) || (API.shared.getEntityType(entity) != EntityType.Player)) { return; } if (isCurrentlyEscorting) { return; } Client playerC = API.shared.getPlayerFromHandle(entity); if (playerC == null) { return; } Player player; Player.PlayerData.TryGetValue(playerC, out player); if (player == null) { return; } if (FactionManager.IsPlayerAnOfficer(player)) { return; } API.shared.SendCloseMessage(CellGuard, 15f, CellGuardName + " says: You're not supposed to be here, leave. Now."); }
public static void onPlayerChatMessage(Client sender, string message, CancelEventArgs e) { e.Cancel = true; Player Player = Player.PlayerData[sender]; if (!PlayersInInteraction.Contains(Player)) { return; } bool isAuthorised = FactionManager.IsPlayerAnOfficer(Player); if (IsGettingItem) { ArmouryGuy.Speak(GetRandomMessageFromArray(BusyStatements)); return; } if (!isAuthorised) { ArmouryGuy.Speak(GetRandomMessageFromArray(UnauthorizedEnterStatements)); return; } string ItemName = ParseMessageForItemName(message); string InOut = ParseMessageForSigning(message); Console.WriteLine("Name: " + ItemName + " | InOut: " + InOut); if (ItemName == "UNKNOWN" && InOut == "UNKNOWN") { ArmouryGuy.Speak(GetRandomMessageFromArray(MisunderstoodStatements)); return; } if (ItemName == "UNKNOWN") { ArmouryGuy.Speak("You need to tell me what you want to sign for"); return; } if (InOut == "UNKNOWN") { ArmouryGuy.Speak("Are you signing in or signing out? It's a vital detail."); return; } bool IsSigningIn = (InOut == "IN"); if (IsSigningIn) { SignInItem(Player, ItemName); } else { SignOutItem(Player, ItemName); } e.Cancel = true; return; }
public void LockCellCommand(Client player) { if (!FactionManager.IsPlayerAnOfficer(Player.PlayerData[player])) { Message.NotAuthorised(player); return; } int cellID = PDManager.GetClosestCellIDToPosition(player.position); if (cellID == -1) { Message.Syntax(player, "You are not close enough to any cell"); return; } PDManager.CellDoor cell = PDManager.Cells[cellID]; bool isLocked = PDManager.ToggleCellLock(ref cell); API.SendCloseMessage(player, 15.0f, "~#C2A2DA~", API.shared.getPlayerName(player) + " places a key inside the lock of the cell door and " + (isLocked ? "locks" : "unlocks") + " it."); Utils.SetEntityFacingVector(player, cell.position); }
public void GivePlayerTicket(Client player, string target) { if (!FactionManager.IsPlayerAnOfficer(Player.PlayerData[player])) { Message.NotAuthorised(player); return; } Player trg = Player.GetPlayerData(target); if (trg != null) { if (player.position.DistanceTo(trg.Client.position) > 1.76) { API.SendErrorNotification(player, "You are too far away from that player.", 5); return; } API.ShowInputPrompt(player, "OnTicketChargeReason", "Reason for ticket", "Please enter the reason for ticketing " + trg.Username.Roleplay() + ":", "Next", "Cancel"); Player.PlayerData[player].PlayerInteractingWith = trg; } else { Message.PlayerNotConnected(player); return; } }
public void FriskPlayer(Client player, string target = "") { if (!FactionManager.IsPlayerAnOfficer(Player.PlayerData[player])) { Message.NotAuthorised(player); return; } Player p = Player.PlayerData[player]; Player trg = target == "" ? player.GetClosestPlayer(1) : Player.GetPlayerData(target); //if (trg.Client == player) { API.SendErrorNotification(player, "You can't frisk yourself."); return; } if (trg != null) { if (player.position.DistanceTo(trg.Client.position) > 1.76) { API.SendErrorNotification(player, "You are too far away from that player.", 5); return; } API.SendInfoNotification(player, string.Format("Awaiting {0}'s response to your request, please wait...", trg.Client.name), 8); API.ShowPopupPrompt(trg.Client, "OnPlayerFriskResponse", "Frisk Request", string.Format("{0} {1} wants to frisk you, do you accept?", p.Faction.Ranks[p.FactionRank].Title, p.Username.Roleplay()), "Accept", "Decline"); p.PlayerInteractingWith = trg; trg.PlayerInteractingWith = p; p.InEvent = PlayerEvent.AccessingInventory; } }