Jump to content

Loop a function every 5 seonds while the script is running


RawrOmg
 Share

Recommended Posts

#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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...