-
Notifications
You must be signed in to change notification settings - Fork 0
/
AFK_Cheat.cs
191 lines (149 loc) · 5.69 KB
/
AFK_Cheat.cs
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Memory;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
namespace SAMP_CHEAT_KRANE
{
class AFK_Cheat
{
Mem mem;
string[] WASD = { "00B72D76", "00B72D4A", "00B72D6E", "00B72D50" };
string chatlogLocation = @"C:\Users\" + Environment.UserName + @"\Documents\GTA San Andreas User Files\SAMP\chatlog.txt";
public string TextLog = "";
int process_ID_San_Andreeas;
public void init()
{
System.IO.File.Delete(this.chatlogLocation);
mem = new Mem();
process_ID_San_Andreeas = Process.GetProcessesByName("gta_sa")[0].Id;
mem.OpenProcess(process_ID_San_Andreeas);
/*
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = @"C:\";
ofd.Title = "SAMP -> chatlog.txt";
ofd.ShowDialog();
this.chatlogLocation = ofd.FileName;
*/
}
public void SendKey(char key)
{
switch (key)
{
case 'W':
{
mem.writeMemory(WASD[0], "int", "255");
mem.writeMemory(WASD[1], "int", "0");
mem.writeMemory(WASD[2], "int", "0");
mem.writeMemory(WASD[3], "int", "0");
break;
}
case 'A':
{
mem.writeMemory(WASD[1], "int", "255");
mem.writeMemory(WASD[0], "int", "0");
mem.writeMemory(WASD[2], "int", "0");
mem.writeMemory(WASD[3], "int", "0");
break;
}
case 'S':
{
mem.writeMemory(WASD[2], "int", "255");
mem.writeMemory(WASD[1], "int", "0");
mem.writeMemory(WASD[0], "int", "0");
mem.writeMemory(WASD[3], "int", "0");
break;
}
case 'D':
{
mem.writeMemory(WASD[3], "int", "255");
mem.writeMemory(WASD[1], "int", "0");
mem.writeMemory(WASD[2], "int", "0");
mem.writeMemory(WASD[0], "int", "0");
break;
}
}
}
public void chatLog()
{
while(true)
{//daca dezactivezi toate togurile nu o sa ai treaba
Thread.Sleep(1000);
string[] text;
try
{
text = System.IO.File.ReadAllText(this.chatlogLocation).Split('\n');
System.IO.File.Delete(this.chatlogLocation);
foreach(string s in text)
{
this.TextLog += s + "\n";
if (s.Contains("PC") || s.Contains("esti") || s.Contains("Esti") || s.Contains("pc") || s.Contains("cf") || s.Contains("ce faci"))
{
//trigger the save
Process.GetProcessById(process_ID_San_Andreeas).Kill();
}
}
}
catch
{
}
}
}
public void moveAround()
{
int endTime = DateTime.Now.Second + 2;
bool TriggerChange = false;
char CurrentKey = 'W';
Random random = new Random();
int randomNr = 0;
while (true)
{
Thread.Sleep(1000 / 60);
//get random nr
//get current time + 4 seconds to mvoe for 4 seconds 1 direction
int currentTime = DateTime.Now.Second;
//Console.WriteLine("End: " + endTime.ToString() + " C: " + currentTime);
if (endTime > 59)
{
endTime = 1;
}
if (currentTime == endTime)
{
endTime = currentTime + 2;
TriggerChange = true;
randomNr = random.Next(1, 5);
//Console.Write("CHANGED");
}
if (TriggerChange)
{
if (randomNr == 0)
{
randomNr = 1;
}
switch(randomNr)
{
case 1:
CurrentKey = 'S';
break;
case 2:
CurrentKey = 'W';
break;
case 3:
CurrentKey = 'D';
break;
case 4:
CurrentKey = 'A';
break;
}
TriggerChange = false;
}
SendKey(CurrentKey);
//Console.WriteLine("Current Key: " + CurrentKey + " TriggerChange: " + TriggerChange + " TimeC: " + currentTime + "EndTime: " + endTime);
}
}
}
}