PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: DeathScythe on 02 August, 2005, 20:49:27

Title: Quote System
Post by: DeathScythe on 02 August, 2005, 20:49:27
QuoteBotName="[Chaotic1]"



memoriesline=5



TimeSpanInMinutes = 1

function Main()

frmHub:RegBot(BotName)

SetTimer(TimeSpanInMinutes*60000)

StartTimer()

SendToAll(BotName,"Chaotic1 V 1.0 STaRTeD")

end



function GetCommand(message)

s,e,command=strfind(message,"(%S+)")

return command

end

function GetOneParam(message)

s,e,param1=strfind(message,"%S+%s(.*)")

return param1

end



function DataArrival(curUser, data)

if( strsub(data, 1, 1) == "<" ) then

data=strsub(data,1,strlen(data)-1)

s,e,message = strfind( data, "%b<>%s+(.*)")

command=GetCommand(message)

if (curUser.bOperator)  then

  if (command=="!addmemories") then

text=GetOneParam(message)

if (text~=nil) then

local file=openfile("memories.txt","a")

write(file,text.."\n")

closefile(file)

SendToAll(BotName,"Aggiunta nuova memories... Chi sar? il fortunato???")

         curUser:SendPM(BotName,"Memories aggionato..")

return 1

else

curUser:SendPM(BotName,"Hai cannato qualcosa la sintassi corretta : !addmemories frase")

end

 end

      end



end

end



function OnTimer()

countline=1

numberline=random(1,memoriesline)

readfrom("memories.txt")

while 1 do

line = read()

if line == nil then

break

end

if countline==numberline then

SendToAll(BotName,line)

break

end

countline=countline+1

end

readfrom()

end

this was a "memories" script i found sumwhere in the forum its currently lua4..
jus wonder if anyone can adapt it for my needs in lua5..
im looking for a script for ops and + to add quotes.. to record quotes, what people have said that are amusing at that situation.. (reminds me abit like freshstuff)
so just wondering if someone can make it.. with the follow commands
right clicks and commands
addQuote = add a quote to the database
delQuote = delete a quote from the database
allQuotes = show all quotes in PM from database
rQuote = random quote from database

and quotes are show like this
:: [ID : # ] -- [ Quote: <[ev911^DeathScythe]> blah blah blah a lil test ]

# = number
i can probably guess most of the right click commands jus crap on the whole making thing lol

Cheers Peeps!

DeathScythe
Title:
Post by: Dessamator on 02 August, 2005, 21:36:14
its already been done, search the forum
Title:
Post by: DeathScythe on 03 August, 2005, 16:38:55
dess ive tried a search!!!
i cant find it so post me link lol :D
Title:
Post by: Dessamator on 03 August, 2005, 18:10:29
search for "memories by nightlitch"