ShadowCoderKing Posted May 9, 2017 Share Posted May 9, 2017 (edited) C# Teleports to Coords On Button Press Templete for anyone that wants to learn using GTA;using GTA.Math;using GTA.Native;using System;using System.Windows.Forms;using System.Collections.Generic;using System.Linq;public class teleportTest : Script{ Vector3 teleportToPos = new Vector3(55.89523f, -1890.027f, 21.62341f); // sets teleport position coords public teleportTest() { Tick += OnTick; KeyDown += OnKeyDown; KeyUp += OnKeyUp; } private void OnTick(object sender, EventArgs e) { } void OnKeyDown(object sender, KeyEventArgs e) { } void OnKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.U) // if key pressed U then it will fade the screen and teleport to grove street and fade back in { Game.FadeScreenOut(100); Script.Wait(500); Game.Player.Character.Position = teleportToPos; Script.Wait(1000); Game.FadeScreenIn(100); } }} Edited May 10, 2017 by SpiderMight MrGTAmodsgerman 1 Link to comment Share on other sites More sharing options...
Nacorpio Posted May 10, 2017 Share Posted May 10, 2017 Why have you set the script interval to 10? jedijosh920 1 Link to comment Share on other sites More sharing options...
ShadowCoderKing Posted May 10, 2017 Author Share Posted May 10, 2017 thanks for pointing that out, fixed it Link to comment Share on other sites More sharing options...
SteamSilence Posted May 27, 2017 Share Posted May 27, 2017 If you want to "automatically" add Xbox Controller support, you can call the native "IS_CONTROL_PRESSED", like: bool isControlPressed() { bool buttonPress = (Game.IsControlPressed(2, GTA.Control.Cover)); //"Q" or "RB" == GTA.Control.Cover return buttonPress; } That way, if the player is pressing "Q" (or whatever is being used to take cover) on keyboard or "RB" on the controller, you'll get the key press. Link to comment Share on other sites More sharing options...
jedijosh920 Posted May 29, 2017 Share Posted May 29, 2017 If you want to "automatically" add Xbox Controller support, you can call the native "IS_CONTROL_PRESSED", like: bool isControlPressed() { bool buttonPress = (Game.IsControlPressed(2, GTA.Control.Cover)); //"Q" or "RB" == GTA.Control.Cover return buttonPress; } That way, if the player is pressing "Q" (or whatever is being used to take cover) on keyboard or "RB" on the controller, you'll get the key press. Suggestion: bool isControlPressed(){ return (Game.IsControlPressed(2, GTA.Control.Cover)); //"Q" or "RB" == GTA.Control.Cover} Cleaner/less code SteamSilence 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now