Skip to content

Commit

Permalink
zsc
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Sep 6, 2022
1 parent ffba0a5 commit a11a2cf
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 28 deletions.
109 changes: 109 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ edition = "2021"
[dependencies]
reqwest = { version = "0.11", features = ["json"] }
futures = "0.3" # for our async / await blocks
tokio = { version = "1.12.0", features = ["full"] }
tokio = { version = "1.12.0", features = ["full"] }
sysinfo = "0.26.2"
49 changes: 22 additions & 27 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
#![windows_subsystem = "windows"]

use std::process::{Command};
use std::time::{SystemTime, UNIX_EPOCH};
use std::{process, thread, time};
use sysinfo::Process;

#[tokio::main]
async fn main() {
let mut time = get_time_millis();
let five = time::Duration::from_secs(5);
let mut value:bool;
loop {
if get_time_millis() < time + 5000 { continue; }

loop {
let response = reqwest::get("http://97.107.130.20:8888/value").await;
if response.is_err() {
time = get_time_millis();
thread::sleep(five);
continue;
}


let text = response.unwrap().text().await.unwrap();
if text.eq("yes") { value = true; }
else { value = false; }

if !value { kill_valorant() }

time = get_time_millis();
if !value {
/*Command::new("taskkill")
.arg("/IM")
.arg("VALORANT-Win64-Shipping.exe")
.arg("/F")
.spawn().expect("failed");
Command::new("taskkill")
.arg("/IM")
.arg("VALORANT.exe")
.arg("/F")
.spawn().expect("failed");*/
}
thread::sleep(five);
}
}

fn kill_valorant() {
Command::new("taskkill")
.arg("/IM")
.arg("VALORANT-Win64-Shipping.exe")
.arg("/F")
.output()
.expect("Failed to execute process");
Command::new("taskkill")
.arg("/IM")
.arg("VALORANT.exe")
.arg("/F")
.output()
.expect("Failed to execute process");
}

fn get_time_millis() -> u128 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("Time went backwards").as_millis()
fn asd(name: String) -> u32 {
sysinfo::Process::
}

0 comments on commit a11a2cf

Please sign in to comment.