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

Restricted Access Levels


bunny123
 Share

Recommended Posts

Advanced version of [this tutorial](http://www.touchofdeathforums.com/smf2/index.php/topic,78800.0.html).

**Server Side**

In frmServer, open the Control tab and add a new frame captioned "Restricted Access Levels". In that frame add the following checkboxes:

| **Name** | **Caption** |
| chkPlayer | Player |
| chkMonitor | Monitor |
| chkMapper | Mapper |
| chkDeveloper | Developer |

Open modHandleData. Search for:

```
            If IsMultiAccounts(Name) Then

                Call AlertMsg(index, "Multiple account logins is not authorized.")

                Exit Sub

            End If
```
Under that add:

```
Select Case Player(index).Access

Case 0

If frmServer.chkPlayer.Value = 1 Then

Call AlertMsg(index, "Your access level is currently not allowed. Try again later.")

Exit Sub

End If

Case 1

If frmServer.chkMonitor.Value = 1 Then

Call AlertMsg(index, "Your access level is currently not allowed. Try again later.")

Exit Sub

End If

Case 2

If frmServer.chkMapper.Value = 1 Then

Call AlertMsg(index, "Your access level is currently not allowed. Try again later.")

Exit Sub

End If

Case 3

If frmServer.chkDeveloper.Value = 1 Then

Call AlertMsg(index, "Your access level is currently not allowed. Try again later.")

Exit Sub

End If

End Select
```
(Joost had the idea for the Select Case. Thanks!)

**How to use**

Check the appropriate boxes to prevent that access level from entering.
Link to comment
Share on other sites

should be in source. This is easy addition. You might want to add it where if anyone who is under access level they should be kicked. I am not sure but something like this,
```
for i = 1 to MAX_PLAYERS
if i = isplaying then
if i.acess < # then
call  CloseSocket i
next
```
Link to comment
Share on other sites

Hey, I kind of took the liberty to make the code a bit neater. It uses Select Case instead of all the If statements. It looks better and I'm fairly sure it's faster too.

```
Select Case Player(Index).Access

    Case 0
            If frmServer.chkPlayer.Value = 1 Then
                Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
                Exit Sub
            End If

    Case 1
            If frmServer.chkMonitor.Value = 1 Then
                Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
                Exit Sub
            End If

    Case 2
            If frmServer.chkMapper.Value = 1 Then
                Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
                Exit Sub
            End If

    Case 3
            If frmServer.chkDeveloper.Value = 1 Then
                Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
                Exit Sub
            End If
End Select
```
Link to comment
Share on other sites

@Joost:

> Hey, I kind of took the liberty to make the code a bit neater. It uses Select Case instead of all the If statements. It looks better and I'm fairly sure it's faster too.
>
> ```
> Select Case Player(Index).Access
>
>     Case 0
>             If frmServer.chkPlayer.Value = 1 Then
>                 Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
>                 Exit Sub
>             End If
>            
>     Case 1
>             If frmServer.chkMonitor.Value = 1 Then
>                 Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
>                 Exit Sub
>             End If
>            
>     Case 2
>             If frmServer.chkMapper.Value = 1 Then
>                 Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
>                 Exit Sub
>             End If
>            
>     Case 3
>             If frmServer.chkDeveloper.Value = 1 Then
>                 Call AlertMsg(Index, "Your access level is currently not allowed. Try again later.")
>                 Exit Sub
>             End If
> End Select
> ```

Thanks! I added that into the code!
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

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