Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Destroy Banlist (MS4)
#1
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?
Reply
#2
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.
Reply
#3
Thanks a lot, I didn't know there was a if fileexist, function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)