Register for your free account! | Forgot your password?

You last visited: Today at 07:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[HELP]QuizShow

Discussion on [HELP]QuizShow within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
[HELP]QuizShow

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;
}
}
}
}
airborne. is offline  
Old 11/24/2009, 23:52   #2
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
#bump
airborne. is offline  
Old 11/24/2009, 23:59   #3


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
You bumped your thread almost immediately after you posted it, what the hell for?

And my advice would be to change them back?
Korvacs is offline  
Old 11/25/2009, 00:02   #4
 
Zion~'s Avatar
 
elite*gold: 20
Join Date: Aug 2009
Posts: 1,344
Received Thanks: 651
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.
Zion~ is offline  
Old 11/25/2009, 00:03   #5
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
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.
airborne. is offline  
Old 11/25/2009, 00:09   #6
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
how about you all stop flaming and help instead. #reported
airborne. is offline  
Old 11/25/2009, 00:13   #7


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
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?
Korvacs is offline  
Old 11/25/2009, 00:17   #8
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
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..
airborne. is offline  
Old 11/25/2009, 00:21   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
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?
Korvacs is offline  
Old 11/25/2009, 00:22   #10
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
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)
airborne. is offline  
Old 11/25/2009, 00:23   #11


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Re-check my post, i edited =o
Korvacs is offline  
Old 11/25/2009, 00:25   #12
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
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
airborne. is offline  
Old 11/25/2009, 00:32   #13


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Most unusual, my line of thinking was that you were using some in-app restart which was ******** 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.
Korvacs is offline  
Old 11/25/2009, 00:50   #14
 
airborne.'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
Quote:
Originally Posted by Korvacs View Post
Most unusual, my line of thinking was that you were using some in-app restart which was ******** 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.
airborne. is offline  
Old 11/25/2009, 01:47   #15
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
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
-Shunsui- is offline  
Reply


Similar Threads Similar Threads
[Fix]QuizShow
12/28/2010 - CO2 PServer Guides & Releases - 28 Replies
I hear a lot of people saying how quiz show does not work. Well I decided to go through the source and find out what the problem is. It's really simple so here it is. You're going to go to Database.cs and search for public static void LoadQuestions() Under that you should see this{ { string AllLines = System.IO.File.ReadAllLines("C:\\OldCODB\\Qui zShow.txt"); int questionscount = AllLines.Length; for (int x = 0; x <...
QuizShow,
12/28/2009 - CO2 Private Server - 1 Replies
Alrite i want to get to the bottom of this, My Quiz Show at one point whas working fine i do /quizshow with a PM Account BAM! it starts, few days latter i try it again nothing seems to happen i want to know, if anyone had this expirience howd they fix it?,
[QUESTION]How do you start Quizshow
11/23/2009 - CO2 Private Server - 7 Replies
title.. on the 5165 source that was released these past few days? I've tried /quizshow start /quizshow /quiztest77 and more similar. Is it even working?
QuizShow Status
10/30/2009 - CO2 Private Server - 8 Replies
Hello. Does someone know how to see the QuizShow status ( Professor, Master, etc ...) when spawning a character. I suppose that's in the SpawnCharacter xD But i Don't know where.... =/ Thanks for reply ~Chris
Quizshow
10/22/2009 - EO PServer Hosting - 0 Replies
Any one know how add his ivent?



All times are GMT +1. The time now is 07:52.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.