PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Tom on 28 January, 2005, 19:48:16

Title: !pm script
Post by: Tom on 28 January, 2005, 19:48:16
Hi,

I need a script to send a PM with command !pm.

For example - !pm


 Thank you!!!!
Title:
Post by: ??????Hawk?????? on 28 January, 2005, 20:09:27
hi m8  

try this


-- pm-to by ??????Hawk??????
-- simple pm to bot
-- 28-01-2005
-- Command   !pm    


bot = "PM-to"
function Main()
frmHub:RegBot(bot)
end

function DataArrival(user, data)
if strsub(data,1,1) == "<" then
data = strsub(data, 1, (strlen(data)-1))
local s,e,command,sUser,msg = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
if command == "!pm"  then
if sUser ~= nil and msg ~= nil then
SendToNick(sUser, "$To: "..sUser.." From: "..bot.." $<"..bot.."> "..msg)
return 1
else
user.SendData(bot,"Command is !pm [user] [text]")
return 1
end
        end
end
end




??????Hawk??????
Title:
Post by: ??????Hawk?????? on 29 January, 2005, 04:09:20
hi m8


try this  ..  i dont know if it will work as  ive got no way of testing it..  
but hopefully someone who can test it  will maby help you  ...






-- pm-to by ??????Hawk??????
-- simple pm to bot
-- 28-01-2005
-- Command   !pm    


bot = "PM-to"
function Main()
frmHub:RegBot(bot)
end

function DataArrival(user, data)
if string.sub(data,1,1) == "<" then
data = string.sub(data, 1, (string.len(data)-1))
local s,e,command,sUser,msg = string.find(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)")
if command == "!pm"  then
if sUser ~= nil and msg ~= nil then
SendToNick(sUser, "$To: "..sUser.." From: "..bot.." $<"..bot.."> "..msg)
return 1
else
user.SendData(bot,"Command is !pm [user] [text]")
return 1
end
        end
end
end



you may want to try using this function instead of DataArrival

ChatArrival(user, data)



??????Hawk??????
Title: Thank
Post by: Tom on 29 January, 2005, 10:44:40
Hi,

 thank you very much for your scripts!!!

But I have one request up to you.

Can you give me or convert, the !pm script in Lua 5?, because I  have new PtokaX in betatest and the this script didn't work.


 Thank you in advance!
Title:
Post by: Quattro on 29 January, 2005, 15:38:58
"new ptokax" define new
Title:
Post by: Tom on 29 January, 2005, 16:25:37
QuoteOriginally posted by Quattro
"new ptokax" define new
New PtokaX -> PPK's PtokaX devel build ;)
Title: Thank you
Post by: Tom on 30 January, 2005, 14:19:21
OK I test your convert script Mutor.

 And thank you very much Mutor!
Title:
Post by: plop on 30 January, 2005, 19:07:28
try /pm [message]
build-in dc++.

plop