public void OnClientEvent(Client client, string eventName, params object[] arguments) { List <SpawnPosition> spawnList; switch (eventName) { case "SpawnMove": if (!client.hasData("spawnlist")) { return; } spawnList = client.getData("spawnlist"); API.moveEntityPosition(client, spawnList[(int)arguments[0]].Position, 1000); API.triggerClientEvent(client, "SpawnMovePed"); client.rotation = new Vector3(0, 0, 0); break; case "SpawnSelected": if (!client.hasData("spawnlist")) { return; } spawnList = client.getData("spawnlist"); API.triggerClientEvent(client, "SpawnMenu_Close"); client.rotation = spawnList[(int)arguments[0]].Rotation; spawnList.Clear(); client.resetData("spawnlist"); CharacterService.ShowPlayerHUD(client, true); client.dimension = 0; if (!client.hasData("player")) { return; } Player player = client.getData("player"); if (player.Character.OnDuty) { if (player.Character.Faction != FactionType.Citizen) { switch (player.Character.Faction) { case FactionType.Police: PoliceService.SetOnDuty(client, true); break; case FactionType.EMS: EMSService.SetOnDuty(client, true); break; } } else { player.Character.OnDuty = false; } } CharacterService.GivePlayerWeapons(client); break; } }
public static void ProcessInteractionMenu(Client client, string itemvalue) { if (!client.hasData("player")) { return; } Player player = client.getData("player"); if (player.Character.Faction != FactionType.Citizen) { switch (player.Character.Faction) { case FactionType.Police: PoliceService.ProcessInteractionMenu(client, itemvalue); break; case FactionType.EMS: EMSService.ProcessInteractionMenu(client, itemvalue); break; } } API.shared.triggerClientEvent(client, "PlayerMenu_Close"); switch (itemvalue) { #region Seatbelt Menu Item case "toggleseatbelt": if (!client.isInVehicle) { return; } if (client.seatbelt) { client.seatbelt = false; API.shared.sendNotificationToPlayer(client, "Put ~r~off ~w~Seatbelt"); } else { client.seatbelt = true; API.shared.sendNotificationToPlayer(client, "Put ~g~on ~w~Seatbelt"); } break; #endregion Seatbelt Menu Item case "togglehandsup": PoliceService.TogglePlayerHandsup(player); break; case "openinventory": API.shared.triggerClientEvent(client, "Inventory_Open", JsonConvert.SerializeObject(CharacterService.GetInventoryMenuItems(client))); break; } }
public void OnClientEvent(Client client, string eventName, params object[] arguments) { switch (eventName) { case "KeyboardKey_E_Pressed": if (!client.hasData("player")) { return; } Player player = client.getData("player"); if (player.Character.Faction == FactionType.EMS) { if (client.position.DistanceTo(new Vector3(-446.2191, -328.6706, 34.50191)) <= 1.3f) { EMSService.SetOnDuty(client, !player.Character.OnDuty); } } break; } }
public static List <MenuItem> BuildInteractionMenu(Player player) { List <MenuItem> menuItemList = new List <MenuItem>(); #region Seatbelt Menu Item if (player.Character.Player.isInVehicle) { if (player.Character.Player.seatbelt) { menuItemList.Add(new MenuItem { Title = "Put off seatbeld", Value1 = "toggleseatbelt" }); } else { menuItemList.Add(new MenuItem { Title = "Put seatbelt on", Value1 = "toggleseatbelt" }); } } #endregion Seatbelt Menu Item #region Faction Menu Item if (player.Character.OnDuty && player.Character.Faction != FactionType.Citizen) { switch (player.Character.Faction) { case FactionType.Police: menuItemList.AddRange(PoliceService.BuildInteractionMenu(player)); // Add Police Menu Items break; case FactionType.EMS: menuItemList.AddRange(EMSService.BuildInteractionMenu(player)); // Add EMS Menu Items break; } } #endregion Faction Menu Item #region Inventory Menu Item menuItemList.Add(new MenuItem { Title = "Inventory", Value1 = "openinventory" }); #endregion Inventory Menu Item #region Handsup if (!player.Character.Player.isInVehicle) { if (player.Character.HasHandsup) { menuItemList.Add(new MenuItem { Title = "Hands down", Value1 = "togglehandsup" }); } else { menuItemList.Add(new MenuItem { Title = "Put hands up", Value1 = "togglehandsup" }); } } #endregion Handsup return(menuItemList); }