Change in & out messages !!!
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Change in & out messages !!!

Started by juda, 23 August, 2004, 08:46:20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

juda

HAY & thanks for help.....

I look and I try a lot of INTRO-OUTRO scripts...
I didn`t notice for script for normal user...EXEMPLE:_
OLD WELCOME MESSAGE:
- When user enter the hub now,say: Welcome user xxxxx
- When user leave hub,say: Nothing

Now I like something like this:
[INTRO]
Welcome "jonny" my old friend...
Welcome "stella" to my romantic place

[OUTRO]
Goodbye "jonny" see you soon...
Goodbye "stella" & be back soon...

I like to set for myself all in & out messages.....
xxxxx [nickname] - I can put the name of the user
I have a loot friends on the hub 20-30 and I like to set them in & out message [every day or two something else]


   Please for your help !!!!
juda

nErBoS

#1
Hi,

Here you go....

--## Intro Bot
--## Requested by juda
--## Made by nErBoS

sBot = "Intro"

arrIntro = {

	--## Example Table for a User
	["nErBoS"] = {
		["IN"] = {
			"Hi nErBoS....",
			"nErBoS has arrived....",
		},
		["OUT"] = {
			"See you nErBoS",
			"BYe BYE nErBoS",
		},
	},

}

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(user)
	if (arrIntro[user.sName] ~= nil) then
		SendToAll(sBot, arrIntro[user.sName]["IN"][random(1, getn(arrIntro[user.sName]["IN"]))])
	end
end

function UserDisconnected(user)
	if (arrIntro[user.sName] ~= nil) then
		SendToAll(sBot, arrIntro[user.sName]["OUT"][random(1, getn(arrIntro[user.sName]["OUT"]))])
	end
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

Best regards, nErBoS
--## nErBoS Spot ##--

juda

Thanks for your script and I tested already.....
All work fine no errors....
How can I put more users in...I try some triks & cant work !? Please for help....

Users:
  smart-by
  Wu-Tang-Clan
  [SI][dsl]prfox
  SAMURAI
  XXXXXX
  XXXXXX
  XXXXXX .....and all users different in & out

 BAY & THANKS....
juda

Psycho_Chihuahua

Try this:

-----------------------------------------------------------------------------------------
--                                                                                     --
--                                       usertext                                      --
--                                                                                     --
-----------------------------------------------------------------------------------------
        -- ???????????????????????????????????????????????????????????????????????????
????
	--?                 ???????????? Der Name des Bots ????????????                 ?
        -- ???????????????????????????????????????????????????????????????????????????
????
						--???????????????????????????????????????
BotName  = frmHub:GetHubBotName()		--? <<<<< Here comes the Botname        ?
						--???????????????????????????????????????
BotOnOff = "Off"				--? <<<<< Here Bot On/Off               ?
						--???????????????????????????????????????
savetime = 60					--? <<< Here Save Frequency             ?
						--???????????????????????????????????????
bubu = "!"					--? <<<<< Here the Prefix        	?
						--???????????????????????????????????????
lala = "join"					--? <<<<< Here the JoinTextEdit Cmd     ?
						--???????????????????????????????????????
poo  = "part"					--? <<<<< Here the PartTextEdit Cmd     ?
						--???????????????????????????????????????
part = "Your Disconnect Text is : "	--? <<<<< Text for control message      ?
						--???????????????????????????????????????
join = "Your new Connect Text is : "		--? <<<<< Text for control message      ?
						--???????????????????????????????????????
        -- ???????????????????????????????????????????????????????????????????????????
????
	--?         ???????????? nothing more to set ;) ????????????           ?
        -- ???????????????????????????????????????????????????????????????????????????
????
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
--------------------------------------------CODE-----------------------------------------
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
username={}
usertext1={}
usertext2={}
function NewUserConnected(user)
if (not (usertext1[user.sName]==nil)) then
if (BotOnOff == "On") then
SendToAll(BotName,usertext1[user.sName])
else
SendToAll(usertext1[user.sName])
end
end
end
function OpConnected(user)
NewUserConnected(user)
end
function UserDisconnected(user)
if (not (usertext2[user.sName]==nil)) then
if (BotOnOff == "On") then
SendToAll(BotName,usertext2[user.sName])
else
SendToAll(usertext2[user.sName])
end
end
end
function OpDisconnected(user)
UserDisconnected(user)
end
function DataArrival(user,data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
if (cmd=="GoodNightHub") then
SendToAll("HUB","Good Night "..user.sName)
end
if (cmd== bubu..lala) then
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)")
user:SendData(data)
username[user.sName]=user.sName
usertext1[user.sName]=arg
user:SendData(BotName,join..arg)
return 1
elseif (cmd== bubu..poo) then
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)")
user:SendData(data)
username[user.sName]=user.sName
usertext2[user.sName]=arg
user:SendData(BotName,part..arg)
return 1
end
end
end
function OnTimer()
if (date("%M") == "00") or (date("%M") == "20") or (date("%M") == "40")then
Call = savefile()
end
end
function savefile()
writeto("usertext")
for a,b in username do
savelist=username[a].."|"..usertext1[a].."|"..usertext2[a].."\r\n"
write(savelist)
end
writeto()
end
function Main()
datencheck()
dataload()
StartTimer()
SetTimer(1*60000)
end
function OnExit()
savefile()
end
function dataload()
readfrom("usertext")
while 1 do
line = read()
if line == nil then break end 
s,e,NICK,TEXT1,TEXT2=strfind(line,"(.-)|(.-)|(%S+)")
username[NICK]=NICK
usertext1[NICK]=TEXT1
usertext2[NICK]=TEXT2
end
readfrom()
end
function datencheck()
local handle=openfile("usertext","a") 
write(handle,"") 
closefile(handle) 
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

nErBoS

Hi,

I have given you a example table with my nick, you just need to add this...

--## Example Table for a User
	["the_nick"] = {
		["IN"] = {
			"IN MSG 1",
			"IN MSG 2",
		},
		["OUT"] = {
			"OUT MSG 1",
			"OUT MSG 2",
		},
	},

.... to the arrInfo Table.

Best regards, nErBoS
--## nErBoS Spot ##--

juda

Thanks...work good !!!
If I had any idea,Ill send post !

By
juda

SMF spam blocked by CleanTalk