|
You last visited: Today at 17:12
Advertisement
[Fix]QuizShow
Discussion on [Fix]QuizShow within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
12/07/2009, 12:30
|
#1
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
[Fix]QuizShow
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
Code:
public static void LoadQuestions()
Under that you should see this
Code:
{
{
string[] AllLines = System.IO.File.ReadAllLines("C:\\OldCODB\\QuizShow.txt");
int questionscount = AllLines.Length;
for (int x = 0; x < questionscount; x++)
{
string[] Info = AllLines[x].Split('#');
string Question = Info[0];
Features.QuizShow.Answer[] Answers = new NewestCOServer.Features.QuizShow.Answer[4];
Answers[0] = new NewestCOServer.Features.QuizShow.Answer(Info[1].Split(':')[0], ushort.Parse(Info[1].Split(':')[1]));
Answers[1] = new NewestCOServer.Features.QuizShow.Answer(Info[2].Split(':')[0], ushort.Parse(Info[2].Split(':')[1]));
Answers[2] = new NewestCOServer.Features.QuizShow.Answer(Info[3].Split(':')[0], ushort.Parse(Info[3].Split(':')[1]));
Answers[3] = new NewestCOServer.Features.QuizShow.Answer(Info[4].Split(':')[0], ushort.Parse(Info[4].Split(':')[1]));
Features.QuizShow.Question Q = new NewestCOServer.Features.QuizShow.Question(Question, Answers);
Features.QuizShow.AllQuestions.Add((ushort)x, Q);
}
}
}
Replace it with this.
Code:
{
if (File.Exists(@"C:\OldCODB\QuizShow.txt"))
{
string[] AllLines = System.IO.File.ReadAllLines(@"C:\OldCODB\QuizShow.txt");
int questionscount = AllLines.Length;
for (int x = 0; x < questionscount; x++)
{
string[] Info = AllLines[x].Split('#');
string Question = Info[0];
Features.QuizShow.Answer[] Answers = new NewestCOServer.Features.QuizShow.Answer[4];
Answers[0] = new NewestCOServer.Features.QuizShow.Answer(Info[1].Split(':')[0], ushort.Parse(Info[1].Split(':')[1]));
Answers[1] = new NewestCOServer.Features.QuizShow.Answer(Info[2].Split(':')[0], ushort.Parse(Info[2].Split(':')[1]));
Answers[2] = new NewestCOServer.Features.QuizShow.Answer(Info[3].Split(':')[0], ushort.Parse(Info[3].Split(':')[1]));
Answers[3] = new NewestCOServer.Features.QuizShow.Answer(Info[4].Split(':')[0], ushort.Parse(Info[4].Split(':')[1]));
Features.QuizShow.Question Q = new NewestCOServer.Features.QuizShow.Question(Question, Answers);
Features.QuizShow.AllQuestions.Add((ushort)x, Q);
}
}
}
Hope this helps.
|
|
|
12/07/2009, 13:20
|
#2
|
elite*gold: 0
Join Date: Aug 2009
Posts: 39
Received Thanks: 2
|
nice work but is res on 4botters =) keep it up
|
|
|
12/07/2009, 15:48
|
#3
|
elite*gold: 0
Join Date: Sep 2008
Posts: 259
Received Thanks: 64
|
edit doesn't seem to work :s
|
|
|
12/07/2009, 16:13
|
#4
|
elite*gold: 0
Join Date: Dec 2009
Posts: 21
Received Thanks: 8
|
There is already source on 4botters that quizshow works.
|
|
|
12/07/2009, 18:59
|
#5
|
elite*gold: 0
Join Date: Dec 2009
Posts: 116
Received Thanks: 42
|
When you add it it has many errors you might wanna fix this ><
|
|
|
12/08/2009, 03:29
|
#6
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
Wow people seriously its not that hard at all
Just add to make sure QuizShow.txt is there thats it -.-
if you do not know how to do that then just quit.
btw good release
|
|
|
12/08/2009, 03:35
|
#7
|
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
|
Congratz bro. Going to test it now.
|
|
|
12/08/2009, 13:33
|
#8
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
What problems are you guys getting?
Because I just extracted a fresh source to try it out and it works perfectly.
|
|
|
12/08/2009, 15:06
|
#9
|
elite*gold: 0
Join Date: Sep 2008
Posts: 617
Received Thanks: 38
|
Quote:
Originally Posted by Tiku
What problems are you guys getting?
Because I just extracted a fresh source to try it out and it works perfectly.
|
big thanks to yųo from my xD i trai add timer and ivents start in taime gw quz show dis city for now fail wen i finish it i will realais xD
|
|
|
12/08/2009, 15:26
|
#10
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by .Donavon
There is already source on 4botters that quizshow works.
|
Yeah but some people don't want to download an entire source just for one little thing.
|
|
|
12/08/2009, 18:17
|
#11
|
elite*gold: 0
Join Date: Dec 2009
Posts: 116
Received Thanks: 42
|
Quote:
Originally Posted by Tiku
Yeah but some people don't want to download an entire source just for one little thing.
|
Tiku this does not fix QuizShow at all you have to go to QuizShow.cs and fix a line
|
|
|
12/08/2009, 19:34
|
#12
|
elite*gold: 0
Join Date: Jul 2007
Posts: 30
Received Thanks: 0
|
stil dnt work for me
its give a quizshow line 29 error
and
npcdialog line 3798
npcdialog
Code:
#region lantern npc
case 300003:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Do you want to Start Quiz Show I can do that but You need to pay me 10000 CPs."));
GC.AddSend(Packets.NPCLink("Yeah.", 1));
GC.AddSend(Packets.NPCLink("Just passing by", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 1)
{
if (GC.MyChar.CPs >= 10000)
{
GC.MyChar.CPs -= 10000;
Features.QuizShow.Start();
GC.AddSend(Packets.NPCSay("Ther Hapy Now"));
GC.AddSend(Packets.NPCLink("Ok then.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("As i said... you need 10000 CPs. Why do i need to repeat myself?"));
GC.AddSend(Packets.NPCLink("Alright alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
break;
}
#endregion
quizshow
Code:
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((ushort)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 = false;
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.QuizShowInfo.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 = false;
}
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;
}
}
}
}
and the void
Code:
public static void LoadQuestions()
{
{
if (File.Exists(@"C:\OldCODB\QuizShow.txt"))
{
string[] AllLines = System.IO.File.ReadAllLines(@"C:\OldCODB\QuizShow.txt");
int questionscount = AllLines.Length;
for (int x = 0; x < questionscount; x++)
{
string[] Info = AllLines[x].Split('#');
string Question = Info[0];
Features.QuizShow.Answer[] Answers = new NewestCOServer.Features.QuizShow.Answer[4];
Answers[0] = new NewestCOServer.Features.QuizShow.Answer(Info[1].Split(':')[0], ushort.Parse(Info[1].Split(':')[1]));
Answers[1] = new NewestCOServer.Features.QuizShow.Answer(Info[2].Split(':')[0], ushort.Parse(Info[2].Split(':')[1]));
Answers[2] = new NewestCOServer.Features.QuizShow.Answer(Info[3].Split(':')[0], ushort.Parse(Info[3].Split(':')[1]));
Answers[3] = new NewestCOServer.Features.QuizShow.Answer(Info[4].Split(':')[0], ushort.Parse(Info[4].Split(':')[1]));
Features.QuizShow.Question Q = new NewestCOServer.Features.QuizShow.Question(Question, Answers);
Features.QuizShow.AllQuestions.Add((ushort)x, Q);
}
}
}
}
|
|
|
12/08/2009, 19:52
|
#13
|
elite*gold: 0
Join Date: Dec 2009
Posts: 116
Received Thanks: 42
|
Code:
Questions.Add((ushort)x, Q);
That code needx fix and quiz will work
|
|
|
01/22/2010, 01:00
|
#14
|
elite*gold: 0
Join Date: Dec 2009
Posts: 62
Received Thanks: 0
|
Quote:
Originally Posted by Hepatitis C
Hope this helps.
|
Got no errors but the when i " /quiz " nothing happens.
Thanks for help.
|
|
|
01/22/2010, 04:40
|
#15
|
elite*gold: 0
Join Date: May 2009
Posts: 157
Received Thanks: 15
|
Quote:
Originally Posted by Hitsugaya Toshiro
Code:
Questions.Add((ushort)x, Q);
That code needx fix and quiz will work
|
Maybe you should release that fix? :P
and Awesome Post Thanks Bro ++
|
|
|
|
|
Similar Threads
|
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?,
|
[HELP]QuizShow
11/25/2009 - CO2 Private Server - 16 Replies
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)
|
[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 +2. The time now is 17:12.
|
|