Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Account limiting


azurth
 Share

Recommended Posts

Yea prolly change the thing in modHandleData on server named Packet_NewAccount to this, this only checks if the account is called a word not if it contains it, that would be a much longer code

```
Public Sub Packet_NewAccount(ByVal Index As Long, ByVal Username As String, ByVal Password As String, ByVal Email As String)
    If Not IsLoggedIn(Index) Then
        If LenB(Username) < 6 Then
            Call PlainMsg(Index, "Your username must be at least three characters in length.", 1)
            Exit Sub
        End If

        If LenB(Password) < 6 Then
            Call PlainMsg(Index, "Your password must be at least three characters in length.", 1)
            Exit Sub
        End If

    If Username = "Word" Then
            Call PlainMsg(Index, "Your username contains an inappropriate word, please change it and try again", 1)
            Exit Sub
        End If

        If EMAIL_AUTH = 1 Then
            If LenB(Email) = 0 Then
                Call PlainMsg(Index, "Your email address cannot be blank.", 1)
                Exit Sub
            End If
        End If

        If Not IsAlphaNumeric(Username) Then
            Call PlainMsg(Index, "Your username must consist of alpha-numeric characters!", 1)
            Exit Sub
        End If

        If Not IsAlphaNumeric(Password) Then
            Call PlainMsg(Index, "Your password must consist of alpha-numeric characters!", 1)
            Exit Sub
        End If

        If Not AccountExists(Username) Then
            Call AddAccount(Index, Username, Password, Email)
            Call PlainMsg(Index, "Your account has been created!", 0)
        Else
            Call PlainMsg(Index, "Sorry, that account name is already taken!", 1)
        End If
    End If
End Sub
```

Might be able to use a Do Until statement to check against multiple words but I'm kinda lazy Replace "Word" with the word you want to block make sure its in quotes
might also be able to do a function to check

Code to check if it contains a word

```
Public Sub Packet_NewAccount(ByVal Index As Long, ByVal Username As String, ByVal Password As String, ByVal Email As String)
  Dim num as Integer
  Dim StringToFind as String
  num = 0
  StringToFind = "Word"
    If Not IsLoggedIn(Index) Then
        If LenB(Username) < 6 Then
            Call PlainMsg(Index, "Your username must be at least three characters in length.", 1)
            Exit Sub
        End If

        If LenB(Password) < 6 Then
            Call PlainMsg(Index, "Your password must be at least three characters in length.", 1)
            Exit Sub
        End If

Do Until Mid(Username, num, LenB(StringToFind)) = StringToFind Or num = LenB(StringToFind)
        If Mid(Username, num, LenB(StringToFind)) = StringToFind Then
            Call PlainMsg(Index, "Your username contains an inappropriate word, please change it and try again", 1)
            Exit Sub
        End If
Loop

        If EMAIL_AUTH = 1 Then
            If LenB(Email) = 0 Then
                Call PlainMsg(Index, "Your email address cannot be blank.", 1)
                Exit Sub
            End If
        End If

        If Not IsAlphaNumeric(Username) Then
            Call PlainMsg(Index, "Your username must consist of alpha-numeric characters!", 1)
            Exit Sub
        End If

        If Not IsAlphaNumeric(Password) Then
            Call PlainMsg(Index, "Your password must consist of alpha-numeric characters!", 1)
            Exit Sub
        End If

        If Not AccountExists(Username) Then
            Call AddAccount(Index, Username, Password, Email)
            Call PlainMsg(Index, "Your account has been created!", 0)
        Else
            Call PlainMsg(Index, "Sorry, that account name is already taken!", 1)
        End If
    End If
End Sub

```
Link to comment
Share on other sites

well is there any way to send someone a message while they are offline so when they log in they recieve it. this way you can just look at the account list and see who has made an account that u dont want
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

×
×
  • Create New...