private async void Assistance_PlayerKeyStateChanged(object sender, SampSharp.GameMode.Events.KeyStateChangedEventArgs e) { if (!(sender is Player player)) { return; } if (player.PlayerClass != PlayerClassType.Assistance) { return; } if (KeyUtils.HasPressed(e.NewKeys, e.OldKeys, SampSharp.GameMode.Definitions.Keys.Aim)) { await FixPlayerVehicleAsync(player); } if (KeyUtils.HasPressed(e.NewKeys, e.OldKeys, SampSharp.GameMode.Definitions.Keys.Fire)) { FixOwnVehicle(player); } }
private async void Police_PlayerKeyStateChanged(object sender, SampSharp.GameMode.Events.KeyStateChangedEventArgs e) { if (!(sender is Player player)) { return; } if (player.PlayerClass != PlayerClassType.Police) { return; } if (KeyUtils.HasPressed(e.NewKeys, e.OldKeys, SampSharp.GameMode.Definitions.Keys.Aim) && player.Vehicle == null) { await FineNearbyPlayersAsync(player); return; } if (KeyUtils.HasPressed(e.NewKeys, e.OldKeys, SampSharp.GameMode.Definitions.Keys.Action) && player.Vehicle != null) { WarnNearbyPlayers(player); } }
private void Player_KeyStateChanged(object sender, SampSharp.GameMode.Events.KeyStateChangedEventArgs e) { if (editingTDName != "") { //if(!e.NewKeys.Equals("0")) Console.WriteLine("TextdrawCreator.cs - Player_KeyStateChanged:I: key: " + e.NewKeys.ToString()); switch (e.NewKeys) { case Keys.Submission: { ShowTextdrawDialog(); break; } case Keys.Fire: { layers[layerIndex].SwitchTextdrawMode(editingTDName); tdHUD.SetMode(layers[layerIndex].GetEditingMode(editingTDName).ToString()); break; } case Keys.No: { moveSpeed -= 0.5f; player.GameText("Speed: " + moveSpeed.ToString(), 500, 3); break; } case Keys.Yes: { moveSpeed += 0.5f; player.GameText("Speed: " + moveSpeed.ToString(), 500, 3); break; } case Keys.AnalogLeft: { if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.Position) { layers[layerIndex].Move(editingTDName, new Vector2(-1.0 * moveSpeed, 0.0)); } else if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.WidthHeight) { layers[layerIndex].Resize(editingTDName, new Vector2(-1.0 * moveSpeed, 0.0)); } break; } case Keys.AnalogRight: { if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.Position) { layers[layerIndex].Move(editingTDName, new Vector2(1.0 * moveSpeed, 0.0)); } else if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.WidthHeight) { layers[layerIndex].Resize(editingTDName, new Vector2(1.0 * moveSpeed, 0.0)); } break; } case Keys.AnalogUp: { if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.Position) { layers[layerIndex].Move(editingTDName, new Vector2(0.0, -1.0 * moveSpeed)); } else if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.WidthHeight) { layers[layerIndex].Resize(editingTDName, new Vector2(0.0, -1.0 * moveSpeed)); } break; } case Keys.AnalogDown: { if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.Position) { layers[layerIndex].Move(editingTDName, new Vector2(0.0, 1.0 * moveSpeed)); } else if (layers[layerIndex].GetEditingMode(editingTDName) == TextdrawLayer.EditingMode.WidthHeight) { layers[layerIndex].Resize(editingTDName, new Vector2(0.0, 1.0 * moveSpeed)); } break; } } } }
private void Player_KeyStateChanged(object sender, SampSharp.GameMode.Events.KeyStateChangedEventArgs e) { //if (e.NewKeys.ToString() != "0") player.GameText(e.NewKeys.ToString(), 100, 3); switch (e.NewKeys) { case Keys.AnalogLeft: { switch (editingMode) { case EditingMode.Checkpoints: { if (checkpointIndex > 0) { checkpointIndex--; } if (checkpointIndex == 0) { hud.SetSelectedIdx("S", editingMode); player.GameText("CP: Start", 500, 3); } else { hud.SetSelectedIdx(checkpointIndex.ToString(), editingMode); player.GameText("CP: " + checkpointIndex, 500, 3); } UpdatePlayerCheckpoint(); break; } case EditingMode.SpawnPos: { if (spawnIndex > 0) { spawnIndex--; } hud.SetSelectedIdx(spawnIndex.ToString(), editingMode); UpdatePlayerSpawnMover(); break; } } break; } case Keys.AnalogRight: { switch (editingMode) { case EditingMode.Checkpoints: { if (checkpointIndex < editingRace.checkpoints.Count - 1) { checkpointIndex++; } if (checkpointIndex == editingRace.checkpoints.Count - 1) { hud.SetSelectedIdx("F", editingMode); player.GameText("CP: Finish", 500, 3); } else { hud.SetSelectedIdx(checkpointIndex.ToString(), editingMode); player.GameText("CP: " + checkpointIndex, 500, 3); } UpdatePlayerCheckpoint(); break; } case EditingMode.SpawnPos: { if (spawnIndex < Race.MAX_PLAYERS_IN_RACE) { spawnIndex++; } hud.SetSelectedIdx(spawnIndex.ToString(), editingMode); UpdatePlayerSpawnMover(); break; } } break; } case Keys.Submission: { ShowRaceDialog(); break; } } }