How can i check players in map ?

03/02/2020 08:52 cocoemre#1
i want make new event. i was finished all but i need just check how many players in map before enter the event. i can check players in same map. But i dont want this. For example im in twincity i can check how many players have in twincity. i want when im in twincity i want check how many players have in apecity. How can i do this guys. Please help me im new for c# Thank you for your help.. Have a good day..
03/02/2020 10:01 KraHen#2
Moved to this section.
03/02/2020 18:17 Asphy×ia#3
Check for ApeCity's mapId instead of Tc lol

Seriously though, there's a few ways to do that.. What source are you using?
03/02/2020 18:22 Spirited#4
Are you asking how to count players within the city on the map? Without adding another data representation of the player's coordinate points, I think your only option would be to compare coordinates or cell flags. Either set a flag on the cell that indicates that it's an event trigger or manually compare cell coordinates against a range.
03/02/2020 21:29 cocoemre#5
i was make 1vs1 arena and have 4 room. for example Room1 have 2 players. and someone want to enter Room1. i want check Romm1 and if have 2 players in map someone cant enter Room1. this is possible ?
03/02/2020 21:54 pintinho12#6
Anything is possible if you're capable of making an algorithm for this. And that means that it's impossible for you.
Probably your server does have a Dictionary with all your maps and it might just be a check like this
Code:
if (Kernel.Maps[1002].Players.Count < 2) {
   doSomething();
}
or something that wont throw an exception like
Code:
if (Kernel.Maps.TryGetValue(1002, out Map map) && map.Players.Count < 2) {
   doSomething();
}
03/03/2020 00:10 Spirited#7
Quote:
Originally Posted by cocoemre View Post
i was make 1vs1 arena and have 4 room. for example Room1 have 2 players. and someone want to enter Room1. i want check Romm1 and if have 2 players in map someone cant enter Room1. this is possible ?
Yes, that's possible. I'm not sure why you'd need to check that though for an arena system. Normally, you'd create a new instance of the arena map, put the two players in that map, and then have a timer job or on death trigger that awards the winner, removes and revives the players, and cleans up the map. It sounds like this might be a bit too advanced for you right now though. Maybe start with NPCs and try creating other type of events while you learn. You'll learn pretty quickly, as long as you take a lot of time to learn the basics and how to navigate your server's source code.
03/06/2020 17:26 cocoemre#8
Thank you for everything. i was fix it this problem. I think I'm starting to understand :)
03/06/2020 18:21 pintinho12#9
Quote:
Originally Posted by Spirited View Post
Yes, that's possible. I'm not sure why you'd need to check that though for an arena system. Normally, you'd create a new instance of the arena map, put the two players in that map, and then have a timer job or on death trigger that awards the winner, removes and revives the players, and cleans up the map. It sounds like this might be a bit too advanced for you right now though. Maybe start with NPCs and try creating other type of events while you learn. You'll learn pretty quickly, as long as you take a lot of time to learn the basics and how to navigate your server's source code.
Your patience really surprises me. I admire it.
03/07/2020 21:22 Spirited#10
Quote:
Originally Posted by pintinho12 View Post
Your patience really surprises me. I admire it.
You never know who else is reading and learning from misinformation. Plus, if you treat someone like an idiot for asking a question, then they're going to stop asking questions. I give a lot of people shit here for not trying their hardest or doing things they shouldn't be doing, but asking real questions isn't one of those things. And as I said, you never know who else is benefiting from those answers. I was definitely one of those people in the background getting started here.
03/08/2020 16:10 cocoemre#11
you are absolutely right. Thanks to your I can achieve this thing.
I sometimes find things that can help me in the comments when I research topics.. will help those who are researching similar topics. Thanks for helping