Hello, i try to make a script that.. you need pay to broadcast..
For example "/bradcast Hello" <-- this message will be broadcasted.
But.. i write some special commands.. for example..
But my script don't work.. this message appears in the console
Here is my script
Help :]
For example "/bradcast Hello" <-- this message will be broadcasted.
But.. i write some special commands.. for example..
Code:
00:00 Admin[2]: /broadcast quest, Pits Of Inferno 80 300000 After Server Save
00:00 Message from Admin:
Service of Pitfs Of Inferno Quest
Level: 80+
Payment: 300000 gold pieces
Quest start at: After Server Save
But my script don't work.. this message appears in the console
Code:
[24/02/2009 14:21:47] Lua Script Error: [TalkAction Interface]
[24/02/2009 14:21:47] data/talkactions/scripts/payToBroadcast.lua:onSay
[24/02/2009 14:21:47] data/talkactions/scripts/payToBroadcast.lua:11: attempt to index global 't' (a nil value)
[24/02/2009 14:21:47] stack traceback:
[24/02/2009 14:21:47] data/talkactions/scripts/payToBroadcast.lua:11: in function <data/talkactions/scripts/payToBroadcast.lua:1>
Here is my script
Code:
function onSay(cid, words, param)
local config = {
cost = 5000,
cancelMessage = "You don't have enought money",
exhaustTime = 300,
maxLenght = 20,
specialMessages = {
["level"] = "" .. getCreatureName(cid) .. " advanced from Level " .. getPlayerLevel(cid)-1 .. " to Level " .. getPlayerLevel(cid) .. ".",
["magic"] = "" .. getCreatureName(cid) .. " advanced from Level " .. getPlayerMagLevel(cid)-1 .. " to Level " .. getPlayerMagLevel(cid) .. ".",
["quest"] = "Message from " .. getCreatureName(cid) .. ": Service of " .. t[2].. " Quest\nLevel: " .. t[3] .. "+\nPayment: " .. t[4] .. "\nQuest start at: " .. t[5] .. "."
}
}
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
local t = string.explode(param, ",")
local id = tonumber({t[3], t[4], t[5]})
for message, result in pairs(config.specialMessages) do
if exhaustion.check(cid, 2000) == FALSE then
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
doBroadcastMessage(param, MESSAGE_STATUS_CONSOLE_ORANGE)
exhaustion.set(cid, 2000, config.exhaustTime)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.cancelMessage)
end
else
doPlayerSendTextMessage(cid, MESSAGES_TATUS_CONSOLE_BLUE, "You are exhausted.")
end
if param == message then
if exhaustion.check(cid, 2000) == FALSE then
if string.len(t[2]) < config.maxLenght then
if doPlayerRemoveMoney(cid, config.cost) == TRUE then
doBroadcastMessage(result, MESSAGE_STATUS_CONSOLE_ORANGE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "If you want broadcast a message, you need " .. config.cost .. " gold pieces..")
end
else
doPlayerSendTextMessage(cid, MESSAGES_TATUS_CONSOLE_BLUE, "Quest name is too long.")
end
else
doPlayerSendTextMessage(cid, MESSAGES_TATUS_CONSOLE_BLUE, "You are exhausted.")
end
end
end
end
Help :]
Last edited: