[HELP]QuizShow

11/24/2009 23:21 airborne.#1
I changed like 2-3 things from false to true and it worked but when i restarted server then tried it didn't work again. Anyone know why? (source 5165)

Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.Features
{
public class QuizShow
{
public static Dictionary<ushort, Question> AllQuestions = new Dictionary<ushort, Question>();
public static Dictionary<ushort, Question> Questions = new Dictionary<ushort, Question>();
static System.Timers.Timer Timer;
public static ushort QuestionNO = 0;
public static QuizShowScore[] Scores = new QuizShowScore[500];
public static bool QuizON = false;
public static bool QuizON1 = true;
static List<int> Container;
public static void Start()
{
QuizON = true;
Random Rand = new Random();
Container = new List<int>();
for(int x = 0; x < 20;x++)
{
Again:
int Gen = Rand.Next(0, 83);
if (!Container.Contains(Gen))
{
Question Q = (Question)AllQuestions[(ushort)Gen];
Answer[] RealAnswers = new Answer[4];
bool[] Set = new bool[4];
for (int i = 0; i < 4; i++)
{
int e = Rand.Next(0, 4);
while(Set[e])
e = Rand.Next(0, 4);
RealAnswers[i] = Q.Answers[e];
Set[e] = true;
}
Q.Answers = RealAnswers;
Questions.Add((ushort)x, Q);
Container.Add(Gen);
}
else
goto Again;
}
Timer = new System.Timers.Timer();
Timer.Interval = 30000;
Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
foreach (NewestCOServer.Game.Character Char in NewestCOServer.Game.World.H_Chars.Values)
{
Char.MyClient.AddSend(Packets.QuizShowStart((ushor t)Questions.Count));
Char.QuizShowInfo = new Info();
}
Scores = new QuizShowScore[500];
for (int x = 0; x < 501; x++)
{ try { Scores[x] = new QuizShowScore(); } catch { continue; } }
Program.MainQuizShowInfo = new MainInfo();
Juststarted = true;
QuestionNO = 0;
Timer.Start();
Timer.AutoReset = true;

}
public static void Stop()
{
Juststarted = false;
QuizON = true;
Timer.AutoReset = false;
}
static bool Juststarted = false;

static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (Juststarted)
{
foreach (NewestCOServer.Game.Character Char in NewestCOServer.Game.World.H_Chars.Values)
{
Char.MyClient.AddSend(Packets.QuizQuestion(0, 0, 0, 0, 1, Questions[0], Questions[0].Answers[0], Questions[0].Answers[1], Questions[0].Answers[2], Questions[0].Answers[3]));
Char.QuizShowInfo.LastAnswer = Environment.TickCount;

}
QuestionNO++;
Juststarted = false;
}
else
{
if (Features.QuizShow.Questions.ContainsKey((ushort)( QuestionNO)))
{
ushort nextq = QuestionNO;
nextq++;
foreach (Game.Character Chrr in Game.World.H_Chars.Values)
{
Main.GameClient GC = Chrr.MyClient;

GC.AddSend(Packets.QuizQuestion(GC.MyChar.QuizShow Info.Score, GC.MyChar.QuizShowInfo.Time,
(ushort)(800 * GC.MyChar.QuizShowInfo.Score / 100), 1, nextq, Features.QuizShow.Questions[QuestionNO], Features.QuizShow.Questions[QuestionNO].Answers[0], Features.QuizShow.Questions[QuestionNO].Answers[1], Features.QuizShow.Questions[QuestionNO].Answers[2], Features.QuizShow.Questions[QuestionNO].Answers[3]));
GC.MyChar.QuizShowInfo.LastAnswer = Environment.TickCount;
}
}
else
{
try
{
foreach (Game.Character Chr in Game.World.H_Chars.Values)
{
Chr.MyClient.AddSend(Packets.QuizShowEnd(Chr.Name, Chr.QuizShowInfo.Score, Chr.QuizShowInfo.Time, Chr.QuizShowInfo.Rank, (ushort)(800 * Chr.QuizShowInfo.Score / 100)));
}
Timer.Elapsed -= Timer_Elapsed;
Timer.Stop();
Timer.Dispose();
}
catch { }
QuizON = true;
}
QuestionNO++;
}

}
public class QuizShowScore
{
public uint EntityID = 0;
public uint Score = 0;
}
public class MainInfo
{
public string[] Name;
public ushort[] Time;
public ushort[] Score;
public MainInfo()
{
Name = new string[3];
Time = new ushort[3];
Score = new ushort[3];
Name[0] = "none";
Name[1] = "none";
Name[2] = "none";
Time[0] = 0;
Time[1] = 0;
Time[2] = 0;
Score[0] = 0;
Score[1] = 0;
Score[2] = 0;
}
}
public class Info
{
public int LastAnswer;
public ushort Time;
public ushort Score;
public ushort QNo;
public byte[] Answers;
public ushort Rank;
public Info()
{
LastAnswer = 0;
Time = 0;
Score = 0;
QNo = 1;
Answers = new byte[Questions.Count];
Rank = 0;
}
}
public class Question
{
public string m_Question;
public Answer[] Answers;
public Question(string question, Answer[] answers)
{
m_Question = question;
Answers = answers;
}
public static implicit operator string(Question q)
{
return q.m_Question;
}
}
public class Answer
{
public string m_Answer;
public ushort Points;
public Answer(string answer, ushort points)
{
m_Answer = answer; Points = points;
}
public static implicit operator string(Answer q)
{
return q.m_Answer;
}
}
}
}
11/24/2009 23:52 airborne.#2
#bump
11/24/2009 23:59 Korvacs#3
You bumped your thread almost immediately after you posted it, what the hell for?

And my advice would be to change them back?
11/25/2009 00:02 Zion~#4
Quote:
Originally Posted by Korvacs View Post
You bumped your thread almost immediately after you posted it, what the hell for?

And my advice would be to change them back?
Exactly if it worked before you made changes its clear that you changing a few bools caused the problem.
11/25/2009 00:03 airborne.#5
ok. it didn't work when didn't edit anything. then i edited something and it worked. but then after i restarted server it didn't work.
11/25/2009 00:09 airborne.#6
how about you all stop flaming and help instead. #reported
11/25/2009 00:13 Korvacs#7
Quote:
Originally Posted by airborne. View Post
ok. it didn't work when didn't edit anything. then i edited something and it worked. but then after i restarted server it didn't work.
How are you restarting the server?
11/25/2009 00:17 airborne.#8
Quote:
Originally Posted by Korvacs View Post
How are you restarting the server?
the only way. clicking the x on the top right and then reopening it..
11/25/2009 00:21 Korvacs#9
Quote:
Originally Posted by airborne. View Post
the only way. clicking the x on the top right and then reopening it..
So you arnt using Visual studio to debug it, you arnt building in between by hitting F6, your closing and opening the executable. Right?

I would go recheck the changes that you made in visual studio, hit F6 to build, then debug with F5 and see if it works then.

If that doesnt work, which folder are you running the executable from?
11/25/2009 00:22 airborne.#10
Quote:
Originally Posted by Korvacs View Post
So you arnt using Visual studio to debug it, you arnt building in between by hitting F6, your closing and opening the executable.

I would go recheck the changes that you made in visual studio, hit F6 to build, then debug with F5 and see if it works then.
lol ofc i use debug but not f6 (build)
11/25/2009 00:23 Korvacs#11
Re-check my post, i edited =o
11/25/2009 00:25 airborne.#12
Quote:
Originally Posted by Korvacs View Post
Re-check my post, i edited =o
ok well i'm doing it right. done it before on other stuff, but this time i did it and it worked at first but when i closed and open the server it doesn't work anymore.. btw i just used f6 and still doesn't work
11/25/2009 00:32 Korvacs#13
Most unusual, my line of thinking was that you were using some in-app restart which was screwing something up, my other line of thinking was that you had first tried to debug and then closed and started using the release .exe which would not be the same .exe

So i guess its a problem with the code -shrugs- keep trying i guess, sorry i cant help ya.
11/25/2009 00:50 airborne.#14
Quote:
Originally Posted by Korvacs View Post
Most unusual, my line of thinking was that you were using some in-app restart which was screwing something up, my other line of thinking was that you had first tried to debug and then closed and started using the release .exe which would not be the same .exe

So i guess its a problem with the code -shrugs- keep trying i guess, sorry i cant help ya.

i don't understand.
11/25/2009 01:47 -Shunsui-#15
to save changes you did with that source it works for me debugin then building and it should update ur Source\Bin\Release start the server with that one not the one in the Debug folder but the one in your Release folder