public void jailPlayer(Client player, int seconds) { API.setEntityData(player, "Jailed", true); API.resetPlayerNametagColor(player); API.setEntityPosition(player, JailCenter); API.setEntityData(player, "WantedLevel", 0); API.setPlayerWantedLevel(player, 0); API.resetEntityData(player, "Crimes"); API.setEntityData(player, "JailTime", seconds); API.removeAllPlayerWeapons(player); CopUtil.UnCuff(player); if (player.model == (int)PedHash.FreemodeMale01) { CharacterCreator.setSpecialOutfit(player, "MPrisoner.xml"); } if (player.model == (int)PedHash.FreemodeFemale01) { CharacterCreator.setSpecialOutfit(player, "FPrisoner.xml"); } lock (JailTimes) JailTimes.Set(player, API.TickCount + seconds * 1000); }
public void ScriptEvent(Client sender, string eventName, object[] args) { if (eventName == "cuffUpdate") { var player = API.getPlayerFromHandle((NetHandle)args[0]); API.shared.playPlayerAnimation(player, 49, "mp_arresting", "idle"); } if (eventName == "GroupMenuKeyPressed") { if (Database.IsPlayerLoggedIn(sender)) { if (API.getEntityData(sender, "IS_COP")) { object[] argumentList = new object[15]; argumentList[0] = COP_ROOT; argumentList[1] = "Police"; argumentList[2] = null; argumentList[3] = false; argumentList[4] = 4; argumentList[5] = "Report"; argumentList[6] = "Fine"; argumentList[7] = "Arrest"; argumentList[8] = "Cuff/Uncuff"; for (var i = 0; i < 4; i++) { argumentList[9 + i] = ""; } API.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } } } else if (eventName == "menu_handler_select_item") { var callbackId = (int)args[0]; var index = (int)args[1]; if (callbackId == COP_ROOT) { if (index == 0) { var itemsLen = WantedLevelDataProvider.Crimes.Count; object[] argumentList = new object[5 + itemsLen + itemsLen]; argumentList[0] = COP_REPORTCRIME; argumentList[1] = "Report"; argumentList[2] = "Select crime:"; argumentList[3] = false; argumentList[4] = itemsLen; var i = 0; foreach (KeyValuePair <int, CrimeData> entry in WantedLevelDataProvider.Crimes) { argumentList[5 + i] = entry.Value.Name; if (entry.Value.TicketCost != 0) { argumentList[5 + itemsLen + i] = "~b~Ticket, $" + entry.Value.TicketCost; } else { argumentList[5 + itemsLen + i] = "~r~Arrest"; } i++; } API.shared.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } else if (index == 1) { var nearbylist = API.getPlayersInRadiusOfPlayer(20, sender); nearbylist.Remove(sender); API.setEntityData(sender, "NearbyList", nearbylist); var itemsLen = nearbylist.Count; object[] argumentList = new object[5 + itemsLen + itemsLen]; argumentList[0] = COP_TICKETCRIMINAL; argumentList[1] = "Fine"; argumentList[2] = "Select ~r~suspect:"; argumentList[3] = false; argumentList[4] = itemsLen; var i = 0; foreach (Client player in nearbylist) { argumentList[5 + i] = player.name; argumentList[5 + itemsLen + i] = ""; i++; } API.shared.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } else if (index == 2) { var nearbylist = API.getPlayersInRadiusOfPlayer(5, sender); nearbylist.Remove(sender); API.setEntityData(sender, "NearbyList", nearbylist); var itemsLen = nearbylist.Count; API.shared.consoleOutput(itemsLen.ToString()); object[] argumentList = new object[5 + itemsLen + itemsLen]; argumentList[0] = COP_ARRESTCRIMINAL; argumentList[1] = "Arrest"; argumentList[2] = "Select ~r~suspect:"; argumentList[3] = false; argumentList[4] = itemsLen; var i = 0; foreach (Client player in nearbylist) { argumentList[5 + i] = player.name; argumentList[5 + itemsLen + i] = ""; i++; } API.shared.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } else if (index == 3) { var nearbylist = API.getPlayersInRadiusOfPlayer(5, sender); nearbylist.Remove(sender); API.setEntityData(sender, "NearbyList", nearbylist); var itemsLen = nearbylist.Count; API.shared.consoleOutput(itemsLen.ToString()); object[] argumentList = new object[5 + itemsLen + itemsLen]; argumentList[0] = COP_CUFFCRIMINAL; argumentList[1] = "Cuff"; argumentList[2] = "Select ~r~suspect:"; argumentList[3] = false; argumentList[4] = itemsLen; var i = 0; foreach (Client player in nearbylist) { argumentList[5 + i] = player.name; argumentList[5 + itemsLen + i] = ""; i++; } API.shared.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } } else if (callbackId == COP_TICKETCRIMINAL) { var nearbylist = API.getEntityData(sender, "NearbyList"); TicketPlayer(sender, nearbylist[index]); API.resetEntityData(sender, "NearbyList"); } else if (callbackId == COP_ARRESTCRIMINAL) { var nearbylist = API.getEntityData(sender, "NearbyList"); ArrestPlayer(sender, nearbylist[index]); API.resetEntityData(sender, "NearbyList"); } else if (callbackId == COP_CUFFCRIMINAL) { var nearbylist = API.getEntityData(sender, "NearbyList"); if (API.hasEntityData(nearbylist[index], "Cuffs")) { CopUtil.UnCuff(nearbylist[index]); } else { CopUtil.Cuff(nearbylist[index]); API.resetEntityData(sender, "NearbyList"); } } else if (callbackId == COP_REPORTCRIMINAL) { var nearbylist = API.getEntityData(sender, "NearbyList"); var item = API.getEntityData(sender, "LastSelectedItem"); CopUtil.ReportPlayer(nearbylist[index], item); API.resetEntityData(sender, "NearbyList"); } else if (callbackId == COP_REPORTCRIME) { API.setEntityData(sender, "LastSelectedItem", index); if (API.getPlayersInRadiusOfPlayer(50, sender) == null) { return; } var nearbylist = API.getPlayersInRadiusOfPlayer(50, sender); nearbylist.Remove(sender); API.setEntityData(sender, "NearbyList", nearbylist); var itemsLen = nearbylist.Count; API.shared.consoleOutput(itemsLen.ToString()); object[] argumentList = new object[5 + itemsLen + itemsLen]; argumentList[0] = COP_REPORTCRIMINAL; argumentList[1] = "Report"; argumentList[2] = "Select ~r~suspect:"; argumentList[3] = false; argumentList[4] = itemsLen; for (var i = 0; i < nearbylist.Count; i++) { argumentList[5 + i] = nearbylist[i].name; argumentList[5 + itemsLen + i] = ""; } API.shared.triggerClientEvent(sender, "menu_handler_create_menu", argumentList); } } }