Disconnect script

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Disconnect script

Post by Paul_Don » 2003-01-30 23:41

Dont work aint got a clue why any idea lol and i was guessin on this he he

Code: Select all

Sub OpDisconnected(curUser)

  If curUser.sName="Paul_Don" Then 
  curUser.SendToAll "<[uF]> Paul_Don has left" 
  End If
  
  
  
    If not(curUser.sName="Paul_Don" ) Then
 
 ChatToAll curUser, "[uF]", "" & curUser.sName & " Went bye byes
End If
end Sub
[/b]

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-01-31 01:03

1) There is an OPConnected and an NewUserConnected Sub, but I don't think there is an OPDisconnected Sub. Someone posted an exhaustive list of all subs and objects not too long ago, but I can't get my hands on it anymore. Argh ! Well, the OPDisconnected Sub isn't mentioned in the help.script "documentation" anyway; so unless I'm mistaken, it doesn't exist, and you should instead use the DataArival Sub and check for a $Quit string.


2) curUser typically refers to the "curent user" (the one who trigered the sub). That's one single user, so you can't "CurUser.SendToAll". You were probably thinking of colUsers, which is a collection of all the users in the hub and has indeed a "SendToAll" method.
So replace the line :
curUser.SendToAll "<[uF]> Paul_Don has left"
With the line :
colUsers.SendToAll "<[uF]> Paul_Don has left"


3) The line :

Code: Select all

ChatToAll curUser, "[uF]", "" & curUser.sName & " Went bye byes 
has a few errors in it :
a) First, unless you actually have a Sub or a Function in your script called ChatToAll, you can't just "ChatToAll" out of nowhere =) I will assume you wanted to go with colUsers.SendChatToAll
b) SendChatToAll has 2 parameters, the person apparently sending (apparently, because it's actually the script sending it), and the message. Those 2 parameters are separated by 1 comma. In your command, you use 2 commas, so you actually send 3 parameters. I will assume you intended to have the message sent by [uF], and consequently drop your first parameter (i.e. curUser).
c) you don't need to start the message string with a blank string and the name of the current user ("" &curUser.sName) ... You can go directly with curUser.sName
d) & " Went bye byes is an unfinished string. You need to finish it with a lill " at the end. Like that : & "went bye byes"
e) If I guessed your intentions properly, that line should consequently become :

Code: Select all

colUser.SendChatToAll "[uF]", curUser.sName &" went byes bye"
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Post by Paul_Don » 2003-01-31 09:00

i saw a OPDisconnected sub in a lua script and that works on potax hub so i thought id see if it would on nmdc unless im thinkkin if theres one on there it shoudl work on nmdc hub but i dunno

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-31 09:01

nope theres no opdisconnected sub in NMDC hub

Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Post by Paul_Don » 2003-01-31 09:23

thats just sh*t then init lol oh well to potax and learnin lua it is

Locked