Mirage Source
Destroy Banlist (MS4) - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+----- Thread: Destroy Banlist (MS4) (/showthread.php?tid=2146)



Destroy Banlist (MS4) - Nean - 20-09-2008

Code:
Case CBanDestroy
            ' Prevent hacking
            If GetPlayerAccess(Index) < ADMIN_CREATOR Then
                Call HackingAttempt(Index, "Admin Cloning")
                Exit Sub
            End If
            
            Call Kill(App.Path & "\data\banlist.txt")
            Call PlayerMsg(Index, "Ban list destroyed.", White)
            Exit Sub

This is a pretty non-important error, but nonetheless, it'd be nice to get it fixed. When you try to destroy the banlist, it does. However, if you try a second, time when you have already destroyed it, it gives you an error, and shuts the server down, because there is nothing there to destroy. How can I make it so that, it checks to see if its there, and if it is, then destroy, else it exits the sub?


Re: Destroy Banlist (MS4) - Mattyw - 20-09-2008

I fixed it earlier:

Code:
Case CBanDestroy
            ' Prevent hacking
            If GetPlayerAccess(Index) < ADMIN_CREATOR Then
                Call HackingAttempt(Index, "Admin Cloning")
                Exit Sub
            End If
                If FileExist("\data\banlist.txt") Then
                    Call Kill(App.Path & "\data\banlist.txt")
                    Call PlayerMsg(Index, "Ban list destroyed.", White)
                End If
            Exit Sub

Enjoy.


Re: Destroy Banlist (MS4) - Nean - 20-09-2008

Thanks a lot, I didn't know there was a if fileexist, function.