Jump to content
  • 0

How do I limit how many players can connect to my server?


BlueskyVPS

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Excluding GM's

OnPCLoginEvent: // Increase Variable on NON GM Logins and Check Against 10
 if (!getgmlvl()) {
   set .player_count, .player_count + 1;
   if (.player_count > 10) {
     set .player_count, 10; // Keep @ 10, to avoid incrementing this further...
     mes "I'm sorry you cannot enter...";
     close2;
     atcommand "@kick " + strcharinfo(0);
   }
 }

OnPCLogoutEvent: // Decrease Variable on NON GM Char Logout
 if (!getgmlevel()) {
set .player_count, .player_count - 1;
 }
}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

depends on what the "Game" is, and how it's ran, but yes, anything's possible...

create a counter variable, either $var or .var

increase it's amount +1 on each character

if ($var or .var == 10) {
 mes "Sorry Max Players reached";
 close;
}

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you mean limit how many players can access to your Server ? or custom game like event ?? hmm

- script Sample -1,{
OnPCLoginEvent:
if( getusers(1) > 10 ) atcommand "@Kick "+strcharinfo(0);
end;
}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

LOL...actually to limit player to connect to your game..there is 1 simple way rather than my script

conf/char_athena.conf

// Maximum users able to connect to the server. Set to 0 for unlimited.
max_connect_user: 0

anyway..for vendor not counting..

erm..not sure..maybe can do a trick like this

when character logon...add +1 to a variable.

then attach a timer to character...

every interval of time check whether player is vending or else..

if yes then detach the timer and -1 to variable.

Edited by Emistry
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

what is a "vendor" ????

you want to differentiate active 10 players vs vendors?

seems kinda pointless right?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

The script Emistry made should do the trick, if not tell us whats wrong, or what isnt the way you want in detail o:

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   47
  • Joined:  11/18/11
  • Last Seen:  

alright how about a script just to limit for only 10player including gm accounts?

There's no need to do such script, as Emistry said.

eathena > conf > char_athena.conf

Just change the values...should be like this

// Maximum users able to connect to the server. Set to 0 for unlimited.
max_connect_user: 10

// Minimum GM level that is allowed to bypass the server limit of users.
gm_allow_level: 100

Will allow to connect 10 users as max, and only GMs level 100 or above will be able to connect.

Since admins are 99 they will still not be able to connect, nor any other lower gms.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

to limit players that can access server ;)

---

edit:

but i wont count venders? is that possible too :D

for this there is the command checkvending() o.o

*checkvending ({"<player name>"})

*checkchatting ({"<Player Name>"})

If the player's name is given, this command checks for that player

to be online and wether he/she is chatting or vending.

When no name is given, the attached player is used for checking.

Returns true or false (1 or 0) when the player is chatting/vending or not.

Example(s):

if (checkVending("Aaron")) mes "Aaron is currently vending!";

//This will check if Aaron is vending, and if so, put a message in front

//of the attached player saying Aaron is vending.

if (checkChatting()) mes "You are currently chatting!";

//This will check if you're in a chat room or not

Well for this to work you would need an array to check the players since it requires an character (obviously o.o),

Regards,

Chris

Edited by llchrisll
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

sorry my first IF check is wrong function name

change

if (!getgmlvl())

to

if (!getgmlevel())

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

remove the double IF

if if does not work

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

was both players non-gm level?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   3
  • Joined:  11/08/11
  • Last Seen:  

SOLVED

Edited by TooTpher
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...