added a basic anticheat
This commit is contained in:
4
assets/lang/en/warnings.json
Normal file
4
assets/lang/en/warnings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"cheatalert_message": "This game closed any suspicious software automatically. If this causes problems, please exit the game and contact support for help immediately.",
|
||||
"cheatalert_title": "Cheat process detected in your operating system! D:<"
|
||||
}
|
@@ -22,6 +22,7 @@ config/icon="res://assets/textures/debug/dummy-player-normal.png"
|
||||
Essential="res://src/essential.cs"
|
||||
PlayerVariables="*res://src/player_variables.cs"
|
||||
Console="*res://scenes/gui/console.tscn"
|
||||
Anticheat="*res://src/anticheat.cs"
|
||||
|
||||
[display]
|
||||
|
||||
@@ -134,6 +135,7 @@ cheat_start={
|
||||
[internationalization]
|
||||
|
||||
locale/translation_remaps={}
|
||||
locale/translations_pot_files=PackedStringArray()
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
29
src/anticheat.cs
Normal file
29
src/anticheat.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Diagnostics;
|
||||
using Godot;
|
||||
|
||||
public partial class anticheat : Node
|
||||
{
|
||||
string[] suspiciousProcesses = { "cheat", "wemod" };
|
||||
string alertMessage;
|
||||
string alertTitle;
|
||||
public override void _Ready()
|
||||
{
|
||||
var lang = Json.ParseString(FileAccess.Open("res://assets/lang/en/warnings.json", FileAccess.ModeFlags.Read).GetAsText()).AsGodotDictionary();
|
||||
alertMessage = lang["cheatalert_message"].ToString();
|
||||
alertTitle = lang["cheatalert_title"].ToString();
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
foreach (Process p in Process.GetProcesses())
|
||||
foreach (string s in suspiciousProcesses)
|
||||
{
|
||||
if (p.ProcessName.Find(s) >= 0) //cheat gets detected
|
||||
{
|
||||
GetTree().Paused = true;
|
||||
OS.Kill(p.Id);
|
||||
OS.Alert(alertMessage, alertTitle);
|
||||
GetTree().Paused = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user