Created
September 25, 2015 16:43
-
-
Save TORISOUP/00f01522b23f18123655 to your computer and use it in GitHub Desktop.
F7キーを押したら車を生成する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows.Forms; | |
using GTA; | |
using GTA.Math; | |
using GTA.Native; | |
/// <summary> | |
/// F7キーが押された時にブリスタをプレイヤの近くに出現させる | |
/// </summary> | |
public class VehicleSpanwer : Script | |
{ | |
public VehicleSpanwer() | |
{ | |
//キー入力イベントにHook | |
KeyDown += VehicleSpanwerKeyDown; | |
} | |
private void VehicleSpanwerKeyDown(object sender, KeyEventArgs e) | |
{ | |
//押されたキーがF7以外なら何もしない | |
if (e.KeyCode != Keys.F7) return; | |
//プレイヤを取得 | |
var player = Game.Player.Character; | |
//プレイヤの現在座標を取得 | |
var currentPlayerPosition = player.Position; | |
//プレイヤの5m隣にブリスタを出現させる | |
World.CreateVehicle(new Model(VehicleHash.Blista), currentPlayerPosition + new Vector3(5, 0, 0)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment