local storage = 41000
local rands = {
[1] = 41001,
[2] = 41002,
[3] = 41003,
[4] = 41004,
[5] = 41005,
[6] = 41006,
[7] = 41007,
[8] = 41008,
[9] = 41009,
[10] = 41010
}
function onSay(cid, words, param, channel)
if getPlayerAccess(cid) < 6 then
doPlayerSendCancel(cid, "Cannot execute this talkaction.")
return true
end
if (param == "start") then
if getGlobalStorageValue(storage) < 1 then
setGlobalStorageValue(storage, 1)
local rand1 = math.random(1, 100)
local rand2 = math.random(1, 100)
local rand3 = math.random(1, 100)
local rand4 = math.random(1, 100)
local rand5 = math.random(1, 100)
local rand6 = math.random(1, 100)
local rand7 = math.random(1, 100)
local rand8 = math.random(1, 100)
local rand9 = math.random(1, 100)
local rand10 = math.random(1, 100)
setGlobalStorageValue(rands[1], rand1)
setGlobalStorageValue(rands[2], rand2)
setGlobalStorageValue(rands[3], rand3)
setGlobalStorageValue(rands[4], rand4)
setGlobalStorageValue(rands[5], rand5)
setGlobalStorageValue(rands[6], rand6)
setGlobalStorageValue(rands[7], rand7)
setGlobalStorageValue(rands[8], rand8)
setGlobalStorageValue(rands[9], rand9)
setGlobalStorageValue(rands[10], rand10)
for i, v in ipairs(getPlayersOnline()) do
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The first person to type the numbers wins. Type: !numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The numbers are: "..rand1..", "..rand2..", "..rand3..", "..rand4..", "..rand5..", "...rand6..", "..rand7..", "..rand8..", "..rand9..", "..rand10)
end
else
doPlayerSendCancel(cid, "The numbers event is already running.")
return true
end
end
t = string.explode(param, ",")
num1 = t[1]
num2 = t[2]
num3 = t[3]
num4 = t[4]
num5 = t[5]
num6 = t[6]
num7 = t[7]
num8 = t[8]
num9 = t[9]
num10 = t[10]
if getGlobalStorageValue(storage) == 1 then
if num1 == getGlobalStorageValue(rands[1]) then
if num2 == getGlobalStorageValue(rands[2]) then
if num3 == getGlobalStorageValue(rands[3]) then
if num4 == getGlobalStorageValue(rands[4]) then
if num5 == getGlobalStorageValue(rands[5]) then
if num6 == getGlobalStorageValue(rands[6]) then
if num7 == getGlobalStorageValue(rands[7]) then
if num8 == getGlobalStorageValue(rands[8]) then
if num9 == getGlobalStorageValue(rands[9]) then
if num10 == getGlobalStorageValue(rands[10]) then
setGlobalStorageValue(storage, 0)
for i = 1, #rands do
setGlobalStorageValue(rands[i], 0)
end
doBroadcastMessage("Player: "..getPlayerName(cid).." has typed all the number first!")
end
end
end
end
end
end
end
end
end
end
else
doPlayerSendCancel(cid, "The numbers event is not running.")
return true
end
return true
end