Created
May 15, 2019 15:25
-
-
Save samhains/0933b60b850842176e97a16da6b75101 to your computer and use it in GitHub Desktop.
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 GTA; | |
using System; | |
using GTA.Native; | |
using System.Windows.Forms; | |
public class ScriptTutorial : Script | |
{ | |
bool isBotEngaged = true; | |
public ScriptTutorial() | |
{ | |
this.Tick += onTick; | |
this.KeyUp += onKeyUp; | |
this.KeyDown += onKeyDown; | |
this.Interval = 5000; | |
} | |
void onTick(object sender, EventArgs e) | |
{ | |
if (isBotEngaged) | |
{ | |
Random random = new Random(); | |
int randomNumber = random.Next(0, 100); | |
Ped player = Game.Player.Character; | |
int areaSize = random.Next(20,60); | |
if (randomNumber > 20) | |
{ | |
player.Task.WanderAround(player.Position + (areaSize-1)*player.ForwardVector, areaSize); | |
} else | |
{ | |
int runSize = random.Next(10, 40); | |
player.Task.ClearAll(); | |
player.Task.RunTo(player.ForwardVector * runSize + player.Position); | |
} | |
} | |
} | |
void onKeyDown(object sender, KeyEventArgs e) | |
{ | |
} | |
void onKeyUp(object sender, KeyEventArgs e) | |
{ | |
if (e.KeyCode == Keys.H) | |
{ | |
Ped player = Game.Player.Character; | |
player.Task.ClearAll(); | |
isBotEngaged = !isBotEngaged; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment