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

EO admin only login


Officer Johnson
 Share

Recommended Posts

Now i know this had been made before but in the tutorials i saw none of them worked or had bugs

*****Updated on August 20, 2014*****

**Didn't work as good as it could have before so making it a bit better also making it when check box is clicked the players get auto kicked!**

**ServerSide**

**Step 1**

**ModGlobals**

add this at bottom:

```
Public AdminOnly as boolean

```
Step 2

Create a checkbox on the server form wherever you want

Name it **chkAdminOnly**

click it and **input this:**

```
Dim i as long

AdminOnly = Not AdminOnly

If AdminOnly then
For i = 1 to Player_HighIndex
If Player(i).access = 0 then
if isplaying(i) then
Call AlertMsg(i, "The server is for admin only")
end if
end if
next
end if

```
now go to handlenewaccount

**before:**

```
' Prevent hacking

```
**add:**

```
If AdminOnly Then
Call alertmsg(index, "The Server is for admin only")
end if

```
at handlelogin

**before:**

```
' Check if character data has been created

```
**add:**

```
If AdminOnly Then
If Player(index).Access = 0 then
call alertmsg(index, "The Server is for admin only")
end if
end if

```
ok compile and enjoy :) let me know if it don't work or if theres bugs
Link to comment
Share on other sites

Have you tested your code? 

You're missing two end ifs. Not sure if vb6 will make a fuss of it but you should still add it in. Also remeber never to use hard coded values. Always use variables/constants where possible. Instead of checking if the player access is 1 you could check it against the constant Admin_Monitor. 

**Note: **

I don't think giving your players a message "Only the server admins" is going to be enough. 

My revised/fixed code. 

```
If frmServer.chkGMOnly.Value = vbChecked Then ' You can use 1\. Everyone uses 1\.
If Player(index).Access < Admin_monitor Then
Call AlertMsg(index, "Sorry. The server is accessible to admins only.")
end if
end if

```
Also your instructions to add a form control aren't clear enough. You might want to **bold out statements or properties** names(Caption/Name). 

Not trying to demoralize your or anything. Just giving you some pointers for your next tutorial.
Link to comment
Share on other sites

> Have you tested your code? 
>
> You're missing two end ifs. Not sure if vb6 will make a fuss of it but you should still add it in. Also remeber never to use hard coded values. Always use variables/constants where possible. Instead of checking if the player access is 1 you could check it against the constant Admin_Monitor. 
>
> **Note: **
>
> I don't think giving your players a message "Only the server admins" is going to be enough. 
>
>  
>
> My revised/fixed code. 
>
> ```
> If frmServer.chkGMOnly.Value = vbChecked Then ' You can use 1\. Everyone uses 1\.
> If Player(index).Access < Admin_monitor Then
> Call AlertMsg(index, "Sorry. The server is accessible to admins only.")
> end if
> end if
>
> ```
> Also your instructions to add a form control aren't clear enough. You might want to **bold out statements or properties** names(Caption/Name). 
>
>  
>
> Not trying to demoralize your or anything. Just giving you some pointers for your next tutorial.

yea nothing taking by it but what do you mean it won't be enough care to explain?
Link to comment
Share on other sites

  • 3 weeks later...
just realized this tutorial ain't done as good as it could be currently it only stops new users from registering and logging in and from account owners but it doesnt kick the people who are online already so

im updating main post with new tut redo this if you used it!

this update should make it auto kick when checkbox is clicked

and should improve the registering account and prevent loggin in better 

if you've done it simply delete the code we added from ismulti accoutnts (underneath it) 

and the one we added in handlenewaccount

then redo the tutorial 

enjoy :)
Link to comment
Share on other sites

> Hmm, I found a problem, not sure if it's just the version I'm using or what, but if I have someone as an admin then revoke the adminship they can still get on.

Of course.. According to the code, It only kick players that are admin at that time, if it was revoked after being kicked then they can still play.. it's not done on a loop timer so it can't check if the player is admin or not everytime.

To do the looping thing, on ServerLoop use the code that kick the player
Link to comment
Share on other sites

He forgot to add the exit sub on this line

```
If AdminOnly Then
        If Player(index).Access = 0 then
             call alertmsg(index, "The Server is for admin only")
        end if
end if
```

and here

```
If AdminOnly Then
       Call alertmsg(index, "The Server is for admin only")
end if
```

it must be 

```
If AdminOnly Then
        If Player(index).Access = 0 then
             call alertmsg(index, "The Server is for admin only")
             exit sub
        end if
end if
```

and here

```
If AdminOnly Then
       Call alertmsg(index, "The Server is for admin only")
        exit sub
end if

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