Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Test = {}
- --[[CONFIGS]]----[[CONFIGS]]----[[CONFIGS]]----[[CONFIGS]]----[[CONFIGS]]----[[CONFIGS]]----[[CONFIGS]]--
- --ONLY ONE OF THE FOLLOWING MAY BE TRUE
- IsRewardItem = false -- Change this to true if the reward is an item.
- IsRewardGold = false -- Change this to true if the reward is gold.
- IsRewardXP = false -- Change this to true if the reward is XP.
- --ONLY change the following two IF IsRewardItem = true, if its not true make sure they are nil.
- RewardItemId = nil -- Change nil with the item id you want to be added to the winners backpack.
- RewardItemAmount = nil -- Change nil to the the amount of items of the specified id will be added to the winners backpack.
- RewardItemName = nil -- Change nil with the Item name of the item id you put in as RewardItemId
- --ONLY change the following IF IsRewardGold = true, if its not true make sure this is nil.
- RewardGoldAmount = nil -- Change nil with the amount of gold you would like to add to the winner, ex 5 = 5g.
- --ONLY change the following IF IsRewardXP = true, if its not true make sure this is nil.
- RewardXPAmount = nil -- Change nil to the amount of experiance you want to be added to the winner of the math equasion.
- --[[END OF CONFIGS]]----[[END OF CONFIGS]]----[[END OF CONFIGS]]----[[END OF CONFIGS]]----[[END OF CONFIGS]]--
- Awsnerable = false
- Start = false
- function Test.OnChat(event, player, message, type, language)
- local LCM = message:lower()
- if (LCM == ".test math") then
- if(player:IsGm() == true) then
- if (Start == false) then
- Start = true
- RegisterTimedEvent("Test.mathhook", 10000, 0, player)
- elseif (Start == true) and
- (player:IsGm() == true) then
- player:SendAreaTriggerMessage("|cFF03E6FFThe math quiz is already in session, please type .test stop to stop it")
- end
- end
- return 0
- elseif (LCM == ""..tonumber(Awsner).."") then
- if (Awsnerable == true) then
- --if (player:IsGm() == false) then
- if (IsRewardItem == true) then
- Awsnerable = false
- player:AddItem(RewardItemId, RewardItemAmount)
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]:|r "..player:GetName().." Has Won this math question and has been awarded "..RewardItemAmount.." X of "..RewItemName.."!")
- end
- elseif (IsRewardGold == true) then
- player:DealGoldMerit(RewardGoldAmount*10000)
- Awsnerable = false
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]:|r "..player:GetName().." Has Won this math question and has been awarded "..RewardGoldAmount.." Gold!")
- end
- elseif (IsRewardXP == true) then
- player:GiveXp(RewardXPAmount)
- Awsnerable = false
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]:|r "..player:GetName().." Has Won this math question and has been awarded "..RewardXPAmount.." Experiance!")
- end
- end
- --end
- end
- elseif (LCM == ".test stop") and
- (player:IsGm() == true) and
- (Start == true) then
- Start = false
- Awsnerable = false
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]:|r The math quiz has ended! Better luck next time!")
- end
- return 0
- end
- end
- RegisterServerHook(16, "Test.OnChat")
- function Test.mathhook(player, event)
- if (Start == true) and
- (Awsnerable == false) then
- WhatType = math.random(3)
- if (WhatType == 1) then
- Number1 = math.random(400)
- Number2 = math.random(1000)
- Awsner = Number2 - Number1
- Awsnerable = true
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]|r: What is "..Number2..", Minus "..Number1.."??")
- end
- elseif (WhatType == 2) then
- Number1 = math.random(400)
- Number2 = math.random(1000)
- Awsner = Number2 + Number1
- Awsnerable = true
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]|r: What is "..Number2..", Plus "..Number1.."??")
- end
- elseif (WhatType == 3) then
- Number1 = math.random(50)
- Number2 = math.random(10)
- Awsner = Number1 * Number2
- Awsnerable = true
- for k, v in pairs(GetPlayersInWorld()) do
- v:SendBroadcastMessage("|cFFF2FF03[|r|cFF03E6FFMath Script|cFFF2FF03]|r: What is "..Number2..", Times "..Number1.."??")
- end
- end
- end
- end
- if (IsRewardItem == true) and
- (RewardItemId == nil) then
- logcol(4+8)
- print("The math test script has not loaded correctly, Please Check the Item configs!!")
- logcol(7)
- elseif (IsRewardItem == true) and
- (RewardItemAmount == nil) then
- logcol(4+8)
- print("The math test script has not loaded correctly, Please Check the Item configs!!")
- logcol(7)
- elseif (IsRewardItem == true) and
- (RewardItemName == nil) then
- logcol(4+8)
- print("The math test script has not loaded correctly, Please Check the Item configs!!")
- logcol(7)
- elseif (IsRewardGold == true) and
- (RewardGoldAmount == nil) then
- logcol(4+8)
- print("The math test script has not loaded correctly, Please Check the Gold configs!!")
- logcol(7)
- elseif (IsRewardXP == true) and
- (RewardXPAmount == nil) then
- logcol(4+8)
- print("The math test script has not loaded correctly, Please Check the Experiance configs!!")
- logcol(7)
- else
- logcol(4+8)
- print("The math test script has sucessfully loaded!, made by brathus!")
- logcol(7)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement