• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction [0.4] Pop quiz script

btw TeckMan You could edit to to be like this
Code:
question=X:S:A:G:T:B:N:G, answer = XSAGTBNG
doBroadcastMessage(Answer Without Colons (:), 1)
and such other
 
I put it in my mods folder -> scripts and when i write /quiz ingame, it doesnt doanything, like if my mods wasnt working, but they do work
 
Tibia seems to have used a lot of different type of bones in names for cities etc.
Tibia = lower leg bone (shin bone)
Fibula = lower leg bone
Mt. sternum = chest bone attached to ribs
Femur = upper leg bone (thigh bone)

xd
Tibia itself does not mean bone. It IS a bone

- - - Updated - - -

- nice work anyway :D
 
Tibia seems to have used a lot of different type of bones in names for cities etc.
Tibia = lower leg bone (shin bone)
Fibula = lower leg bone
Mt. sternum = chest bone attached to ribs
Femur = upper leg bone (thigh bone)

xd
Tibia itself does not mean bone. It IS a bone

- - - Updated - - -

- nice work anyway :D
Thanks :)

Well everyone can change questions to fit their server anyways. :p
 
Here's my pop quiz script. There's a question drawn, and the first person who answers the question gets the prize.

If you know any questions I could add, post them with comments! :)


/mods/popquiz.xml

Lua:
<?xml version = "1.0" encoding = "UTF-8"?>
    <mod name = "Pop quiz" version = "1.0" author = "Teckman" enabled = "yes">
        <config name = "config"><![CDATA[
            config = {
                questions = {
                    [1] = {question = "What is 'tibia' in latin?", answer = "bone"},
                    [2] = {question = "What is the incantation for rage of the skies spell?", answer = "exevo gran mas vis"},
                    [3] = {question = "How much health has a rotworm?", answer = "65"},
                    [4] = {question = "When was tibia created?", answer = "1997"},
                    [5] = {question = "How much attack has magic sword?", answer = "48"},
                    [6] = {question = "How many feet toes has a cyclops?", answer = "7"},
                    [7] = {question = "What type of item requires soul to be created?", answer = "rune"},
                    [8] = {question = "How many elements are in tibia?", answer = "6"},
                    [9] = {question = "How many professions are in tibia?", answer = "4"},
                    [10] = {question = "How much gold does promotion cost?", answer = "20000"},
                    [11] = {question = "What is the name of the current king?", answer = "tibianus"},
                    [12] = {question = "What is the name of the 'pyramid city'?", answer = "ankrahmun"},
                    [13] = {question = "How many pharaos exist in tibia?", answer = "9"},
                },
                prize = 50000, -- if you want a random number just add for example {50, 20000}
                storage = 400
            }
        ]]></config>
        <globalevent name="popquiz" interval="20" event="script"><![CDATA[
            domodlib("config")
            function onThink(interval)
                setGlobalStorageValue(cid, config.storage, config.questions[math.random(1, table.maxn(config.questions))].question)
                doBroadcastMessage("[POP QUIZ]: " .. getGlobalStorageValue(config.storage) .. " - to answer the question type '/quiz ANSWER'.", MESSAGE_EVENT_ADVANCE)
                return true
            end
        ]]></globalevent>
        <talkaction words = "/quiz" event = "script"><![CDATA[
            domodlib("config")
            function onSay(cid, words, param)
                if(param) then
                    if(getGlobalStorageValue(config.storage)) then
                        for _, v in pairs(config.questions) do
                            if(v.question == getGlobalStorageValue(config.storage)) then
                                if(string.lower(param) == v.answer) then
                                    doBroadcastMessage("[POP QUIZ]: " .. getPlayerName(cid) .. " has answered the question: " .. v.question .. ", with answer: " .. v.answer .. ". Congratulations to the winner!", MESSAGE_EVENT_ADVANCE)
                                    doPlayerAddMoney(cid, type(config.prize) == "table" and math.random(config.prize[1], config.prize[2]) or config.prize
                                    setGlobalStorageValue(config.storage, nil)
                                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
                                    return true
                                end
                            end
                        end
                    else
                        doPlayerSendCancel(cid, "The quiz has already ended.")
                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                        return true
                    end
                else
                    doPlayerSendCancel(cid, "The answer must be stated in parameter.")
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                    return true
                end
                doPlayerSendCancel(cid, "This answer is wrong.")
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                return true
            end
        ]]></talkaction>
    </mod>
Hello , i've made some changes on your script and made it ontimer + changed item from prize to id prize etc but i got problem when i answer the question with correct answer and receive my reward till now its working fine but when i answer this question with another player or with main one the script keep telling me that (This answer is wrong) but i already answered it and received my reward ,the script must tell me that (The quiz has already ended) but this isn't working
here you are the script after i made some changes with it
Code:
<?xml version = "1.0" encoding = "UTF-8"?>
<mod name = "Pop quiz" version = "1.0" author = "Teckman" enabled = "yes">
<config name = "config"><![CDATA[
config = {
questions = {
[1] = {question = "What is 'tibia' in latin?", answer = "bone"},
[2] = {question = "What is the incantation for rage of the skies spell?", answer = "exevo gran mas vis"},
[3] = {question = "How much health has a rotworm?", answer = "65"},
[4] = {question = "When was tibia created?", answer = "1997"},
[5] = {question = "How much attack has magic sword?", answer = "48"},
[6] = {question = "How many feet toes has a cyclops?", answer = "7"},
[7] = {question = "What type of item requires soul to be created?", answer = "rune"},
[8] = {question = "How many elements are in tibia?", answer = "6"},
[9] = {question = "How many professions are in tibia?", answer = "4"},
[10] = {question = "How much gold does promotion cost?", answer = "20000"},
[11] = {question = "What is the name of the current king?", answer = "tibianus"},
[12] = {question = "What is the name of the 'pyramid city'?", answer = "ankrahmun"},
[13] = {question = "How many pharaos exist in tibia?", answer = "9"},
},
storage = 400
}
]]></config>
<globalevent name="popquiz" time="01:55" event="script"><![CDATA[
domodlib("config")
function onTimer()
setGlobalStorageValue(cid, config.storage, config.questions[math.random(1, table.maxn(config.questions))].question)
doBroadcastMessage("[POP QUIZ]: " .. getGlobalStorageValue(config.storage) .. " - to answer the question type '/quiz ANSWER'.", MESSAGE_EVENT_ADVANCE)
return true
end
]]></globalevent>
<talkaction words = "/quiz" event = "script"><![CDATA[
domodlib("config")
function onSay(cid, words, param)
if(param) then
if(getGlobalStorageValue(config.storage)) then
for _, v in pairs(config.questions) do
if(v.question == getGlobalStorageValue(config.storage)) then
if(string.lower(param) == v.answer) then
doBroadcastMessage("[POP QUIZ]: " .. getPlayerName(cid) .. " has answered the question: " .. v.question .. ", with answer: " .. v.answer .. ". Congratulations to the winner!", MESSAGE_EVENT_ADVANCE)
doPlayerAddItem(cid, 2160, 10) --adds 1 crystal coin               <--------------------- added this
setGlobalStorageValue(config.storage, nil)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
return true
end
end
end
elseif setGlobalStorageValue(config.storage, nil) then           <------------------------ added this
doPlayerSendCancel(cid, "The quiz has already ended.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
else
doPlayerSendCancel(cid, "The answer must be stated in parameter.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
doPlayerSendCancel(cid, "This answer is wrong.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
]]></talkaction>
</mod>
and its same yours didn't work good too :S
sorry for my rude English (not my main language)
 
setGlobalStorageValue() only uses 2 parameters, in this script it has 3, remove cid from that function in the globalevents part of the script and it should work properly for anyone who has the same problem as @Mera Mero

If this works for everyone, send special thanks to @forgee for he is the one who noticed the typo
 
Back
Top