-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheBird.cs
More file actions
executable file
·170 lines (152 loc) · 7.28 KB
/
TheBird.cs
File metadata and controls
executable file
·170 lines (152 loc) · 7.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
using GTA;
using GTA.Native;
using System;
using System.Windows.Forms;
namespace GTA5M
{
public class TheBird : Script
{
Keys activationKey;
bool flippingOff = false;
Ped fightingPed;
Blip fightingPedBlip;
Ped fleeingPed;
public TheBird()
{
ScriptSettings localSettings = ScriptSettings.Load(".\\scripts\\TheBird.ini");
Keys activationKeySetting;
string activationKeyStr = localSettings.GetValue("Preferences", "ActivationKey", "J");
if (Enum.TryParse(activationKeyStr, out activationKeySetting))
{
activationKey = activationKeySetting;
}
else
{
activationKey = Keys.J;
}
KeyDown += OnKeyDown;
KeyUp += OnKeyUp;
Tick += OnTick;
Interval = 100;
}
void OnKeyDown(object o, KeyEventArgs e)
{
// User is pressing the activation key
if (e.KeyCode == activationKey)
{
// If not currently fighting a ped and the player is alive and available
if (fightingPed == null && !flippingOff && Game.Player.IsAlive && Game.Player.CanStartMission && Game.Player.Character.Weapons.Current.Hash == WeaponHash.Unarmed)
{
flippingOff = true;
// Play middle finger animation
Function.Call(Hash._PLAY_AMBIENT_SPEECH1, Game.Player.Character, "GENERIC_FUCK_YOU", "SPEECH_PARAMS_FORCE", 0);
Game.Player.Character.Task.PlayAnimation("mp_player_int_upperfinger", "mp_player_int_finger_02", 2, 750, true, 1);
Wait(750);
Game.Player.Character.Task.PlayAnimation("mp_player_int_upperfinger", "mp_player_int_finger_02_exit", 2, 750, true, 1);
// Is player aiming at ped
Entity aimedEntity = Game.Player.GetTargetedEntity();
if (aimedEntity.IsPed())
{
// Give them some time to react...
Wait(250);
Ped aimedPed = (Ped)aimedEntity;
// If you're flipping off a cop...
if (aimedPed.Type() == PedType.Cop || aimedPed.Type() == PedType.SWAT || aimedPed.Type() == PedType.Army)
{
// Set wanted level to 1 star if you didn't have any already
if (Game.Player.WantedLevel == 0)
{
Game.Player.WantedLevel = 1;
}
}
else if (!aimedPed.IsFleeing)
{
// Prep the ped
bool pedWillFight = false;
aimedPed.Task.ClearAllImmediately();
aimedPed.AlwaysKeepTask = true;
// Use a random number generator to decide what to do
Random randomNumberGenerated = new Random();
// If you're flipping off a man...
if (aimedPed.Gender == Gender.Male)
{
int randomNumber = randomNumberGenerated.Next(4);
// Give him a golf club
if (randomNumber == 2)
{
aimedPed.Weapons.Give(WeaponHash.GolfClub, 1, true, true);
}
// Give him a switchblade
else if (randomNumber == 1)
{
aimedPed.Weapons.Give(WeaponHash.SwitchBlade, 30, true, true);
}
// Give him a bat
else if (randomNumber == 0)
{
aimedPed.Weapons.Give(WeaponHash.Bat, 1, true, true);
}
pedWillFight = true;
}
// If you're flipping off a woman...
else
{
int randomNumber = randomNumberGenerated.Next(2);
// Make her fight
pedWillFight = (randomNumber == 2);
}
// Set the ped to fight you
if (pedWillFight)
{
fightingPed = aimedPed;
fightingPed.IsPersistent = true;
fightingPed.Task.FightAgainst(Game.Player.Character);
Function.Call(Hash._PLAY_AMBIENT_SPEECH1, fightingPed, "GENERIC_INSULT_MED", "SPEECH_PARAMS_FORCE", 0);
// Add a blip for the ped to the map
fightingPedBlip = fightingPed.AddBlip();
}
// Set the ped to flee from you
else
{
fleeingPed = aimedPed;
fleeingPed.IsPersistent = true;
fleeingPed.Task.FleeFrom(Game.Player.Character);
Function.Call(Hash._PLAY_AMBIENT_SPEECH1, aimedPed, "GENERIC_SHOCKED_HIGH", "SPEECH_PARAMS_FORCE", 0);
}
}
}
}
}
}
private void OnKeyUp(object o, KeyEventArgs e)
{
// User released the activation key
if (e.KeyCode == activationKey)
{
flippingOff = false;
}
}
private void OnTick(object o, EventArgs e)
{
// If a fighting ped is dead or you moved to far away from them
if (fightingPed != null && (!Game.Player.IsAlive || !Game.Player.CanStartMission || !fightingPed.IsAlive || !fightingPed.IsNearEntity(Game.Player.Character, new GTA.Math.Vector3(100, 100, 100))))
{
// Destroy ped
fightingPed.Destroy();
fightingPed = null;
// Destroy blip
if (fightingPedBlip != null)
{
fightingPedBlip.Remove();
fightingPedBlip = null;
}
}
// If a fleeing ped is dead or you moved to far away from them
if (fleeingPed != null && (!Game.Player.IsAlive || !Game.Player.CanStartMission || !fleeingPed.IsAlive || !fleeingPed.IsNearEntity(Game.Player.Character, new GTA.Math.Vector3(100, 100, 100)))) {
// Destroy ped
fleeingPed.Destroy();
fleeingPed = null;
}
}
}
}