Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
if (m.Type == "left")
{
EEName Player = Players.Find(
delegate(EEName plr)
{
return plr.UserId == m.GetInt(0);
}
);
if (Player != null)
{
if (PlayersPlaying.Contains(Player))
PlayersPlaying.Remove(Player);
Players.Remove(Player);
}
}
Why won't this work properly? Sometimes it just tends to, not remove players?
Also, EEName is a class for EE Players, wich stores wins, userid and name. Any help?
List<EEName> Players = new List<EEName>();
List<EEName> PlayersPlaying = new List<EEName>(); //used to determine who is currently on map in Volcanic Earth
shh i have returned
Offline
What are
PlayersPlaying
Player
and Players
I can help if you state those.
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
Player
wtf.
EEName Player = Players.Find(
delegate(EEName plr)
{
return plr.UserId == m.GetInt(0);
}
);
shh i have returned
Offline
U made it all complicated, just do Player.Remove(m.GetInt(0));
.-.
Offline
Your answer is useless as you cannot REMOVE an integer, but only an EEName class. pls.
shh i have returned
Offline
you need to make a dictionary called "names" so that it works on every case.
the dictionary you use will be integer,string.
your int is the id of the player in number
your string is the name of the player in text
on case add, add it into the names
so that when your player leaves remove it from the names using the id. I think @srna wanted to mean
Sample Text.
Doritos/Mountain Dew eater.
420 No scoping 69 scrubs per day
Always smoke weed everyday.
Known for: #getrekt Bot (possible revive with new stuff?)
Offline
you need to make a dictionary called "names" so that it works on every case.
the dictionary you use will be integer,string.
your int is the id of the player in number
your string is the name of the player in text
on case add, add it into the names
so that when your player leaves remove it from the names using the id. I think @srna wanted to mean
How would this make the code any different? I use a List with a class. It changes nothing.
I believe it is the "left" message that does not stack when some things lag, but I believe I might have a mistake in my code so I asked the forums.
shh i have returned
Offline
do people even debug nowadays?
if you can read this....good for you
Offline
That delegate looks suspicious to me.
Post the Players.Find method.
Also, about the list remove, you should override equaly in EEName class to work properly.
Everybody edits, but some edit more than others
Offline
That delegate looks suspicious to me.
Post the Players.Find method.Also, about the list remove, you should override equaly in EEName class to work properly.
public bool Equals(EEName other)
{
return this.UserName == other.UserName;
}
why are you doing this to me ;(
delegate() works fine.
do people even debug nowadays?
yes. but i can't be sure if its the "left" or my code
shh i have returned
Offline
It is the full code. Stop getting used to switch(m.Type) pls.
it's just
if
no
case "left":
shh i have returned
Offline
its your code...
Everybody edits, but some edit more than others
Offline
its your code...
How can you be so sure?
Tell me. A reason is expected.
shh i have returned
Offline
http://forums.everybodyedits.com/viewtopic.php?id=27255
Why don't you make me a one if this one doesn't fit...
if (m.Type == "left")
{
EEName Player = Players.Find(
delegate(EEName plr)
{
return plr.UserId == m.GetInt(0);
}
);
if (Player != null)
{
if (PlayersPlaying.Contains(Player))
PlayersPlaying.Remove(Player);
Players.Remove(Player);
}
}
shh i have returned
Offline
Zumza wrote:its your code...
How can you be so sure?
Tell me. A reason is expected.
Its your code.
Reason: Nobody else have this 'bug', 'error' or how you want to name it.
Why don't you make me a one if this one doesn't fit...
Just take ewoke and mine advices and stop duplicating topics insinuating that is a problem outside your code.
Because Im and probably others too, are offended because people like you feel that we are in some way obligated to help, and accept this?
Everybody edits, but some edit more than others
Offline
madiik wrote:Zumza wrote:its your code...
How can you be so sure?
Tell me. A reason is expected.
Its your code.
Reason: Nobody else have this 'bug', 'error' or how you want to name it.madiik (duplicated topic) wrote:Why don't you make me a one if this one doesn't fit...
Just take ewoke and mine advices and stop duplicating topics insinuating that is a problem outside your code.
Because Im and probably others too, are offended because people like you feel that we are in some way obligated to help, and accept this?
If I use a custom class with a List, how else am I supposed to find "something" in that list? delegate is the way to see inside classes.
- oh wait, i could just do LINQ too, but it would still probably be the same.
Players.Find(nm => nm.UserId == m.GetInt(0));
shh i have returned
Offline
Zumza wrote:madiik wrote:Zumza wrote:its your code...
How can you be so sure?
Tell me. A reason is expected.
Its your code.
Reason: Nobody else have this 'bug', 'error' or how you want to name it.madiik (duplicated topic) wrote:Why don't you make me a one if this one doesn't fit...
Just take ewoke and mine advices and stop duplicating topics insinuating that is a problem outside your code.
Because Im and probably others too, are offended because people like you feel that we are in some way obligated to help, and accept this?If I use a custom class with a List, how else am I supposed to find "something" in that list? delegate is the way to see inside classes.
- oh wait, i could just do LINQ too, but it would still probably be the same.
Players.Find(nm => nm.UserId == m.GetInt(0));
just dont do all that **** they tell u to do ^
||
and code with a simple and shortened way:
public Dictionary<name, id> Players = new Dictionary<name, id>{ };
not sure about name, id but u surely know how to do it
Usage:
Players[m.GetInt(0)]
Add:
Players.AddKey(m.GetString(1), m.GetInt(0))
Left:
Players.RemoveValue(m.GetString(1))
or however it's done
Offline
just dont do all that **** they tell u to do ^
||and code with a simple and shortened way:
public Dictionary<name, id> Players = new Dictionary<name, id>{ };
not sure about name, id but u surely know how to do it
Usage:
Players[m.GetInt(0)]
Add:
Players.AddKey(m.GetString(1), m.GetInt(0))
Left:
Players.RemoveValue(m.GetString(1))
or however it's done
madiik want with she's own classes, why you want to limitate her?
Everybody edits, but some edit more than others
Offline
if (Player != null)
I haven't done any coding in a long time, but why would Player ever be null if you've just defined it as something? Also, is there any point in even having that there? Can't you just get rid of that if statement altogether? If you have received the message "left" and you know which player left, then you can just remove them from your PlayersPlaying and your Players straight away.
thx for sig bobithan
Online
struct Player { public string Name; public int Wins; public bool isPlaying;}
Dictionary<int, Player> Players = new Dictionary<int, Player>();
Dictionary<string, int> wins = new Dictionary<string, int>();
//...
// TODO: Read the wins file and save it to the wins dictionary.
//...
if (e.Type == "add")
{
Players.Add(e.GetInt(0), new Player(){Name = e.GetString(1), Wins = wins[e.GetString(1)], isPlaying = false});
}
// Set isPlaying to true once the player joins the playing area, and whenever you wanna check, do
// foreach (var player in Players) { if (player.isPlaying) {/*Do whatever you want.*/}}
// Or, if you want a specific player
// foreach (var player in Players) { if (player.isPlaying && player.Name == Players[e.GetInt(0)].Name) {/*More random stuff*/} }
if (e.Type == "left")
{
Players.Remove(e.GetInt(0)); // Player is removed, along with their "isPlaying" status.
}
Offline
or make a easy void/string
public string getName(int id)
{
foreach(EEName t in players)
{
if(EEName.id == id)
{
return id;
}
}
return null;
}
if(m.Type=="left")
{
do something with getName(m.GetInt(0));
}
if you can read this....good for you
Offline
[ Started around 1732812476.8626 - Generated in 0.088 seconds, 12 queries executed - Memory usage: 1.69 MiB (Peak: 1.92 MiB) ]