How do I make code run continously

Harold.com

Civil Gamers Expert
Jan 24, 2021
5
8
91
Hi so I am trying to design a security program but cannot make it so the code is always running and checking for events (i.e player started using terminal)

Heres my source code:

using System;
using Console;
using Application;
using Player;
using Event;
using Peripheral;

StringResult result = Application.CreateDesktopIcon("https://images2.imgbox.com/9b/14/qiAQqMha_o.jpg");

string AcceptedSteamID = "STEAM_0:0:176101358";
string userID = "";
number i = 10;
///Locks PC when another user starts to use it
function OnPlayerStoppedUsing(Player ply){
Console.WriteLine(ply.GetName().." has stopped using the terminal.");
System.Lock();
}


using VentzCoin;



number value = VentzCoin.GetValue();
Console.WriteLine("VC Value: "..value);

Event.AddListener("PlayerStoppedUsing", "using", "OnPlayerStoppedUsing");

///Detects when VCMiner wallet changes and sets it back to mine
function OnVCMinerWalletChanged(VCMiner miner, string newWallet, bool isWalletValid){
Console.WriteLine("A VCMiner wallet changed");
Console.WriteLine("vcmine set_wallet 3AO4458DVS5GVGA476241X24X767321D");
}

Event.AddListener("VCMinerWalletChanged", "vcminer_stopped", "OnVCMinerWalletChanged");

///Detects when Player starts using and checks if SteamID matches mine
function OnPlayerStartedUsing(Player ply){
Console.WriteLine(ply.GetName().." has started using the terminal.");
userID = System.GetUserSteamID();
if (userID != AcceptedSteamID){
System.Lock();
Event.AddListener("PlayerStartedUsing", "using", "OnPlayerStartedUsing");
}
}

while (i > 0){

}


Thanks