PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: damo on 22 September, 2004, 13:10:24

Title: how do you make it show in pm
Post by: damo on 22 September, 2004, 13:10:24
i want to make this send call to user im pm any help please heres the script.



sBotName = "CallBot";

sCallMsg = "[nick] awaits you eagerly in main chat!"
sCallPhrase = "!call";

function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");

if (cmd == nil) then
return 0; end;

cmd = strlower(cmd);
if (cmd == sCallPhrase) then
curUser:SendData(sData);

callUser = GetItemByName(args)
if (callUser) then
sMsg = gsub(sCallMsg, "%[nick%]", curUser.sName);
SendPmToNick(callUser.sName, sBotName, sMsg);
else
if (strlen(args) > 0) then
curUser:SendData(sBotName, args.." is currently not connected!");
else
curUser:SendData(sBotName, "Syntax: "..sCallPhrase.." ");
end
end

return 1;
end
end
Title:
Post by: Herodes on 22 September, 2004, 13:29:45
Hello infact u need to register the bot with the Hub to enable  it to send in pm ... so it should go like this ...
sBotName = "CallBot";

sCallMsg = "[nick] awaits you eagerly in main chat!"
sCallPhrase = "!call";

function Main()
frmHub:UnregBot(sBotName)
frmHub:RegBot(sBotName)
end

function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");

if (cmd == nil) then
return 0;
end;

cmd = strlower(cmd);
if (cmd == sCallPhrase) then
curUser:SendData(sData);
callUser = GetItemByName(args)
if (callUser) then
sMsg = gsub(sCallMsg, "%[nick%]", curUser.sName);
callUser:SendPM(sBotName, sMsg);
else
if (strlen(args) > 0) then
curUser:SendData(sBotName, args.." is currently not connected!");
else
curUser:SendData(sBotName, "Syntax: "..sCallPhrase.." ");
end
end
return 1;
end
end
Title:
Post by: damo on 22 September, 2004, 15:13:44
thx alot works well