123Tails Source Version 5369 Simple Code - important for me :)

06/03/2011 17:29 _DreadNought_#16
Quote:
Originally Posted by abdeen View Post
here is pic of problem

[Only registered and activated users can see links. Click Here To Register...]

and here is a pic if i edited it

[Only registered and activated users can see links. Click Here To Register...]
foreach(ClientState in Kernel.GamePool.Values)
{
if (player.entity.map == 1002)
if (player.entity.alive)
}
06/03/2011 18:57 BaussHacker#17
You want to check how many players there is in a map?
Do a foreach and then use an integer that counts.

If you do not understand such simple things, then you could learn some basic C#? :)
06/03/2011 19:19 abdeen#18
Quote:
Originally Posted by BaussHacker View Post
You want to check how many players there is in a map?
Do a foreach and then use an integer that counts.

If you do not understand such simple things, then you could learn some basic C#? :)
im trying to learining C# , but now i need the fixed code to check if the alive players in the current map == 1 or not , code .

thanks dude , i hope you post the code here . :)

Quote:
Originally Posted by _DreadNought_ View Post
foreach(ClientState in Kernel.GamePool.Values)
{
if (player.entity.map == 1002)
if (player.entity.alive)
}
this code will check count of alive players in the current map ?
06/04/2011 14:29 Kiyono#19
This should work, it checks how many players are alive in the map where you use the command.
Code:
case "aliveinmap":
                                        {
                                            int alive = 0;
                                            foreach (Receivers.ClientState players in ServerBase.Kernel.GamePool.Values)
                                                if (players.Entity.MapID == client.Entity.MapID && (!players.Entity.Dead))
                                                        alive++;
                                            client.Send(new Message("Alive: " + alive, System.Drawing.Color.Magenta, GamePackets.Message.Talk));
                                            break;
                                        }
06/04/2011 16:53 abdeen#20
Quote:
Originally Posted by Kiyono View Post
This should work, it checks how many players are alive in the map where you use the command.
Code:
case "aliveinmap":
                                        {
                                            int alive = 0;
                                            foreach (Receivers.ClientState players in ServerBase.Kernel.GamePool.Values)
                                                if (players.Entity.MapID == client.Entity.MapID && (!players.Entity.Dead))
                                                        alive++;
                                            client.Send(new Message("Alive: " + alive, System.Drawing.Color.Magenta, GamePackets.Message.Talk));
                                            break;
                                        }

thanks i`l try this one .