Jump to content
Sign in to follow this  
RawrOmg

Loop a function every 5 seonds while the script is running

Recommended Posts

RawrOmg

#cs
SERVER RESTART SCRIPT, ORIGIONALLY WRITTEN BY BOBDOLE103
MODIFIED TO MY LIKEING ^_^
#ce

    If TimerDiff($starttime) >= $checkerror1 Then
If WinExists("srcds.exe - Application Error") Then
        WinActivate("srcds.exe - Application Error")
    ElseIf WinExists("Engine Error") Then
        WinActivate("Engine Error")
    EndIf
    Send("{ENTER}")
    Sleep(1500)
    run("server.bat")
endif

I want to loop that over and over again every 5 seconds, ive already got the thing down, I just don't know how to make it run constantly.

Share this post


Link to post
Share on other sites
AdmiralAlkex

Hi!

You can use AdlibEnable for that, it would look something like:

#cs
    SERVER RESTART SCRIPT, ORIGIONALLY WRITTEN BY BOBDOLE103
    MODIFIED TO MY LIKEING
#ce

AdlibEnable("_CheckServer", 5000)

While 1
    Sleep(123456789)
WEnd

Func _CheckServer()
    If WinExists("srcds.exe - Application Error") Then
        WinActivate("srcds.exe - Application Error")
    ElseIf WinExists("Engine Error") Then
        WinActivate("Engine Error")
    EndIf
    Send("{ENTER}")
    Sleep(1500)
    Run("server.bat")
EndFunc  ;==>_CheckServer

Share this post


Link to post
Share on other sites
RawrOmg

Thanks, the problem that im having now is that sometimes the server doesn't give an error when it goes down, and so the script doesn't work.

Is there anyway I can check if a program (srcds.exe) is using the internet or connected to something, and in the case of it not being connected for it to restart it?

Share this post


Link to post
Share on other sites
BrettF

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.