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
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
thx alot works well