Skip to content

Commit

Permalink
Update MathQuestions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetkucukonder committed Feb 26, 2019
1 parent 61ec9a5 commit 50eff92
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions MathQuestions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public override TranslationList DefaultTranslations
}
}
//----------------------------------Starter-----------------------------//

//Load
protected override void Load()
{
Expand Down Expand Up @@ -76,7 +77,7 @@ private void Autoquestion()
Automation = this;
if (Configuration.Instance.MathQuestionsEnabled)
try
{
{
if (State == PluginState.Loaded && Configuration.Instance.Interval != 0 && (timer == null || ((DateTime.Now - timer.Value).TotalMinutes > Configuration.Instance.Interval)))
{
number1 = autonumber.Next(8, 85);
Expand Down Expand Up @@ -106,7 +107,7 @@ private void Autoquestion()
timer = DateTime.Now;
NoQuestion = false;
}
}
}
catch (Exception old)
{
Rocket.Core.Logging.Logger.LogException(old);
Expand All @@ -117,16 +118,17 @@ private void Autoquestion()
//ReplyCommand
[RocketCommand("reply", "Know the questions and make money!", "<answer>", AllowedCaller.Player)]
[RocketCommandAlias("re")]
public void ExecuteCommandreply(IRocketPlayer caller, string[] answer)
public void ExecuteCommandcevap(IRocketPlayer caller, string[] answer)
{
if (NoQuestion == true)
{
string noquestion = Translate("mathquestions_no_question");
UnturnedChat.Say(caller, noquestion, UnturnedChat.GetColorFromName(Configuration.Instance.UnfavorableMessageColor, UnityEngine.Color.red));
}

UnturnedPlayer player = (UnturnedPlayer)caller;
if (answer.Length > 0)
{
if (NoQuestion == true)
{
string noquestion = Translate("mathquestions_no_question");
UnturnedChat.Say(caller, noquestion, UnturnedChat.GetColorFromName(Configuration.Instance.UnfavorableMessageColor, UnityEngine.Color.red));
}
if (answer[0] == result.ToString() && NoQuestion == false)
{
NoQuestion = true;
Expand All @@ -144,8 +146,8 @@ public void ExecuteCommandreply(IRocketPlayer caller, string[] answer)
});
}
if (answer[0] != result.ToString() && NoQuestion == false) UnturnedChat.Say(caller, Translate("mathquestions_wrong_answer"), UnturnedChat.GetColorFromName(Configuration.Instance.UnfavorableMessageColor, UnityEngine.Color.red));
}
else UnturnedChat.Say(caller, Translate("mathquestions_invalid_parameter"), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.yellow));
}
}
}
}
}

0 comments on commit 50eff92

Please sign in to comment.