Jump to content
  • 0
BlueskyVPS

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

Question

20 answers to this question

Recommended Posts

  • 0

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

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

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

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

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

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

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.