PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 31 October, 2004, 01:15:27

Title: Send to Master only...
Post by: NemeziS on 31 October, 2004, 01:15:27
Hello!
I'm searching for SendTo   command that will send something only to admin (Master). I don't know how to make it. I know SemdToAll, SendPM,  SendData,  SendPMToOps. I tryed SendPMToMasters, but it didn't work. Can you tell me how to make the script send PM message only to Master (not to Ops) or to selected person? I need it very much!
Title:
Post by: Corayzon on 31 October, 2004, 05:16:12
this might seem like something easy to add. but its a little more complex then u think.

im not gonna write the script for ya but i can tell ya the process's that need to be done.

First of all u need a table of logged masters to loop through. Next u need to make a function loop through this table, and send a pm to each username found in it.

in presudo code this would be like so...

function SendPmToMasters(sFrom, sMessage)

for sNick, bMaster in tLoggedMasters do

SendPmToNick(sNick, sFrom, sMessage)

end

end

and to save nicks into the table u would use something like...

function OpConnected(tUser)

if tUser.iLevel = 0 then

tLoggedMasters[tUser.sName] = 1

end

end

and ofcourse ull also need to remove the ops from the table ...

function OpDisconnected(tUser)

if tUser.iLevel = 0 then

tLoggedMasters[tUser.sName] = nil

end

end

hope this helps ya dude...

noza
Title:
Post by: ??????Hawk?????? on 31 October, 2004, 05:25:04
Heya m8  ...

Maby you can make use of this Function. Stripped from  Xsthetic Netservers    Master Chat room  option..




MasterChatName = "Master-Chat"

function MasterChatRoom(user,msg)
      local Masters=GetUsersByProfile("Master")
    for i, n in Masters do
local usr = GetItemByName(n)
if  usr ~= nil then
      if usr.sName ~= user.sName then
usr:SendData("$To: "..usr.sName.." From: "..MasterChatName.." $<"..user.sName.."> " ..msg)
  end
end
end
end



??????Hawk??????
Title:
Post by: Corayzon on 31 October, 2004, 05:31:27
this scripts steals process that aint needed =[

but im not here to change it :P

noza
Title:
Post by: ??????Hawk?????? on 31 October, 2004, 05:46:30
hi  Croyzon m8   Thaught you lost ur way here  :P


yeh sure creating a table as they log in is more efficient
 but what happens when they click that Good o'le Restart Scripts Button  ???  

at least that way it would still function..

and yes that function could be optimized further,  im still workin my way through the main script re coding all my 1st generation Mess that i once called Scripting.  lol

anyway  good  to see you back m8  .. :))  :))

??????Hawk??????
Title:
Post by: Corayzon on 31 October, 2004, 05:51:16
if i was writing it myself the table would be saved on every change, and then loaded on Main() ;)

or u could use the above script u posted to rebuild the table ;)

remember server start process dont have to be quick! just the ones that are called lots like searchs and user connections.

noza