PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: krayzie_t17 on 30 December, 2004, 04:12:04

Title: Re : VoteBot with user's comment
Post by: krayzie_t17 on 30 December, 2004, 04:12:04
Please somebody finish the script that has been started at tha treahd before  ..please i need it  :D thanx
Title:
Post by: bastya_elvtars on 30 December, 2004, 04:32:48
please post that script here :)
Title:
Post by: krayzie_t17 on 30 December, 2004, 14:28:21
sBot = "Poll-Bot"

poll = {}
pollsv = "pollsv.dat"
ended = {}
endedsv = "ended.dat"

function Main()
frmHub:RegBot(sBot)
end

function OnExit()
if (readfrom(pollsv) ~= nil and poll[1] == nil) then
LoadFromFile(pollsv)
end
if (readfrom(endedsv) ~= nil and ended[1] == nil) then
LoadFromFile(endedsv)
end
SaveToFile(pollsv , poll , "poll")
SaveToFile(endedsv , ended , "ended")
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!createvote" and user.bOperator) then
local s,e,quest = strfind(data, "%b<>%s+%S+%s+(.*)")
if (quest == "") then
user:SendPM(sBot, "Syntax Error, !creatvote , you must write a question.")
else
AddPoll(quest)
user:SendPM(sBot, "The Poll is open.")
end
return 1
elseif (cmd == "!addoption" and user.bOperator) then
local s,e,opt = strfind(data, "%b<>%s+%S+%s+(.*)")
if (quest == "") then
user:SendPM(sBot, "Syntax Error, !addoption




1  And  i would like that a poll be sent to mainchat on a timer once every hour and if there are say 2 or 3 polls have them sent to main chat on a timer randomly.what do ya think?

2 That files that are create 1.poll, 1.vot, can created in a folder like 'polls' ....please edit bot for me thanx 8) and add and that option on main chat timer random if 2 polls
And the command to delete polls that you want Master !delpoll