+server script ........help
 

+server script ........help

Started by bpl, 31 May, 2008, 08:43:45

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bpl

HEllo Frnds I m looking for a script through wich i can check out the cs or cz servers running by simply typing +servers in the main chat.........and also the users can add or del any server.....by simply typing +addserver & +delserver
.......................Waiting 4 the HElp........Thnx  ;) :-*

bpl

Thnx For Repling Dude..................But i was searching for a script through which i can check out the counterstrike or condition zero servers running by simpling Typing +servers in my hub's main chat...........and also the other users could add or delete the server by typing +addserver & +delserver in the main chat....................

Hopfully u will understand now................thnx man

bastya_elvtars

#2
I think there is a separate application for this which generates HTML output.
Edit: I have found it: http://www.agsm.net/
Everything could have been anything else and it would have just as much meaning.

bpl

Thnx a lot dude..................But how can i use this software in the hub ..................
i need the script through which i can find out the html file in the hub as i type +servers.........
and do we hav ane\y other software same as the aGsm........

bpl

Thnx Mutor For thE HElp...................Do we hav ANy REplacement got the aGSM SOftware used to detect the lan/internet servers..........................Bcoz aGsm Show Error .....IT is Unable 2 to give the output........... :'(

bpl

Thanx a lot Dude.............SO can u plz help me out by making a script which would display the servers online bye typing +servers in the main chat.......The AGSM software gives the output in HTML Form........

bastya_elvtars

Here ya go:

--[[
This is a sample script base dupon my HTML parser
It grabs the content of a specified HTML file
and displays it in given intervals or on-demand.
Requested by achiever.
 
Distributed under a modified BSD license, see at the end of the file]]
 
-- Settings.
 
Timer = 0 -- Set to 0 to disable, otherwise specify the interval in minutes.
 
Command = "servers" -- The command for getting the serverinfo. NO prefix!
 
Filename = "E:/pxsrv/scripts/gameserver/lan.html" -- We need full path with FORWARD slashes: c:/path/to/html
 
-- End of settings, only edit below if you know what you are doing.
 
function OnStartup()
  if Timer ~= 0 then
    local x = Core.SendToAll("<"..SetMan.GetString(21)..">\r\n"..HTML_ToText (Filename))
    TmrMan.AddTimer(Timer*60000, "x")
  end
end
 
function ChatArrival (user, data)
  local cmd = string.match (data, "^%b<>%s+[%+%!%-%?%§](%S+)%|$")
  if cmd == Command then
    Core.SendToUser(user,"<"..SetMan.GetString(21)..">\r\n"..HTML_ToText (Filename))
    return 1
  end
end
 
-- function OnTimer()
--   SendToAll(frmHub:GetHubBotName(),"\r\n"..HTML_ToText (Filename))
-- end
 
function HTML_ToText (file)
  -- Declare variables, load the file. Make tags lowercase.
  local nl = "\r\n"
  local text
  local f,err=io.open (file)
  if f then
    text = f:read ("*a")
    f:close()
  else
    Core.SendToOps ("*** "..err)
    return
  end
  text = string.gsub (text,"(%b<>)",
  function (tag)
    return tag:lower()
  end)
  --[[ 
  First we kill the developer formatting (tabs, CR, LF)
  and produce a long string with no newlines and tabs.
  We also kill repeated spaces as browsers ignore them anyway.
  ]]
  local devkill=
    {
      ["("..string.char(10)..")"] = " ",
      ["("..string.char(13)..")"] = " ",
      ["("..string.char(15)..")"] = "",
      ["(%s%s+)"]=" ",
    }
  for pat, res in pairs (devkill) do
    text = string.gsub (text, pat, res)
  end
  -- Then we remove the header. We do this by stripping it first.
  text = string.gsub (text, "(<%s*head[^>]*>)", "<head>")
  text = string.gsub (text, "(<%s*%/%s*head%s*>)", "</head>")
  text = string.gsub (text, "(<head>,*<%/head>)", "")
  -- Kill all scripts. First we nuke their attribs.
  text = string.gsub (text, "(<%s*script[^>]*>)", "<script>")
  text = string.gsub (text, "(<%s*%/%s*script%s*>)", "</script>")
  text = string.gsub (text, "(<script>,*<%/script>)", "")
  -- Ok, same for styles.
  text = string.gsub (text, "(<%s*style[^>]*>)", "<style>")
  text = string.gsub (text, "(<%s*%/%s*style%s*>)", "</style>")
  text = string.gsub (text, "(<style>.*<%/style>)", "")
  
  -- Replace <td> and <th> with tabulators.
  text = string.gsub (text, "(<%s*td[^>]*>)","\t")
  text = string.gsub (text, "(<%s*th[^>]*>)","\t")
  
  -- Replace <br> with linebreaks.
  text = string.gsub (text, "(<%s*br%s*%/%s*>)",nl)
  
  -- Replace <li> with an asterisk surrounded by spaces.
  -- Replace </li> with a newline.
  text = string.gsub (text, "(<%s*li%s*%s*>)"," *  ")
  text = string.gsub (text, "(<%s*/%s*li%s*%s*>)",nl)
  
  -- <p>, <div>, <tr>, <ul> will be replaced to a double newline.
  text = string.gsub (text, "(<%s*div[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*p[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*tr[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*%/*%s*ul[^>]*>)", nl..nl)
    
  -- Some petting with the <a> tags. :-P
--[[   local addresses = {}
  local c = 0
  for url,name in string.gfind (text, "<%s*a%s*href=[\'\"](%S-)[\'\"][^>]*>(.+)<%s*%/a%s*>") do
    c = c + 1
    string.gsub (name, "<%s*a%s*href=[^>]+>(.+)<%s*%/a[^>]*>",
    function (nm)
      nm = string.gsub (nm, "(%b<>)","")
      nm = nm.."["..c.."]"
      return nm
    end)
    table.insert (addresses, {url, name})
    print(url, nm)
  end ]]
  
  -- Nuke all other tags now.
  text = string.gsub (text, "(%b<>)","")
  
  -- Replace entities to their correspondant stuff where applicable.
  -- C# is owned badly here by using a table. :-P
  -- A metatable secures entities, so you can add them natively as keys.
  -- Enclosing brackets also get added automatically (capture!)
  local entities = {}
  setmetatable (entities,
  {
    __newindex = function (tbl, key, value)
      key = string.gsub (key, "(%#)" , "%%#")
      key = string.gsub (key, "(%&)" , "%%&")
      key = string.gsub (key, "(%;)" , "%%;")
      key = string.gsub (key, "(.+)" , "("..key..")")
      rawset (tbl, key, value)
    end
  })
  entities = 
  {
    ["&nbsp;"] = " ",
    ["&bull;"] = " *  ",
    ["&lsaquo;"] = "<",
    ["&rsaquo;"] = ">",
    ["&trade;"] = "(tm)",
    ["&frasl;"] = "/",
    ["&lt;"] = "<",
    ["&gt;"] = ">",
    ["&copy;"] = "(c)",
    ["&reg;"] = "(r)",
    -- Then kill all others.
    -- You can customize this table if you would like to, 
    -- I just got bored of copypasting. :-)
    -- http://hotwired.lycos.com/webmonkey/reference/special_characters/
    ["%&.+%;"] = "",
  }
  for entity, repl in pairs (entities) do
    text = string.gsub (text, entity, repl)
  end
--   text = text..nl..nl..("-"):rep(27)..nl..nl
--   
--   for k,v in ipairs (addresses) do
--     text = text.."["..k.."] "..v[1]..nl
--   end
  
  return text
  
end
 
 
--[[
Copyright (c) 2007, bastya_elvtars
 
All rights reserved.
 
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
 
    * Redistributions of source code must retain the above copyright notice, this
      list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of the author nor the names of contributors may be used
      to endorse or promote products derived from this code without specific
      prior written permission.
 
THIS CODE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
Everything could have been anything else and it would have just as much meaning.

bpl

Thnx a lot DUde..........BUt do i need to specify the Same path which is described in that Script.....
THe script shows this error..
Syntax D:\Useless\photo\0.3.6.0\scripts\Sserver.lua:29: attempt to index global 'Core' (a nil value)

bastya_elvtars

This is for PtokaX 0.4.x. It won't work with 0.3.6.0.
Everything could have been anything else and it would have just as much meaning.

bpl

KK no issue dude.....Thnx a lot.....and i appreciate ur HElp 8)...
But just tell me do i need to specy the same Path as highlited in that Script... ???

bastya_elvtars

No, in fact the path can be anything as long as you specify it properly :-)
Everything could have been anything else and it would have just as much meaning.

bpl

Thanx a lot mate....................Can u plz Make The similar script For Ptokax 0.3.6.0...

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

bpl

Dude................the scripts mention there do not work......The scripts do not show n e error... but when i type server in thye main chat it shows nothing.......the script basically fails to respond the cmd????

Yahoo

thanks for the script bastya_elvtars it works great

actually i also like the idea suggested by bpl
if the users can also add the servers manually and also delete them then it will be great
"BoRN FIGhTEr"

?StIfFLEr??

i have already posted both the scripts and asked if some one could combine them
the normal server script and the other one where a user can add the server and delete the server.
but sadly no one came up with a reply.

bastya_elvtars

Maybe I forgot to reply there but no I cannot since mine just parses HTMLs and I don't know how to interact with aGSM, never used it and never played CS either. :-)
Everything could have been anything else and it would have just as much meaning.

?StIfFLEr??

Bustya the script which shows the html file in the main chat on +servers command is awesome.
I have posted for help long back where in i posted the server script that displays the html file generated by agsm.
And also a script(3.6 version ptokax) where in a user can add a server ip and delete a server added.it is like extra small message board that displays the added data of the user in main chat on +servers command.
I actually wanted to convert the second script posted there where a user can manually add a server and combine it with the script that shows the output that is being generated by the AGSM.
Now the combined script will have a look something like
1.Add server(ip address manually added by the user and being saved a server.dat file with numerical marking as done in message board)
2.Delete server(user can delete his own server added/where as operators can delete all the servers added into the server.dat file according to the server number added)
3. Servers( This command showing the HTML file generated by the AGSM software and also the servers added manually by the users from the server.dat file)
I tried to explain all that i can imagine about having a server script.
Hope someone can understand.

bastya_elvtars

?StIfFLEr?? I am afraid you do not understand. The script does not communicate with aGSM nor CS servers. It just parses the HTML generated by them. I have no time and interest in playing with aGSM to make it download from servers using a script.
The second option would be to communicate with the servers directly via sockets. I have even less intetntion for doing this one. :D
Everything could have been anything else and it would have just as much meaning.

patrick

bastya how am i supposed to give agsm as a source to lan.html ?  ???
im finding it a problem because the script displays the file given in d html file and the file is not uptodate and showing
the servers which were hosted on january 21 , 2007 can u help me please  :-\

bastya_elvtars

I don't know how to set up aGSM, sorry.
Everything could have been anything else and it would have just as much meaning.

?StIfFLEr??

Don't know why i am doing this but here you go patrick
agsm needs to be configured first If anyone could lemme know if i can provide the users with the AGSM software from my pc.
Now once you have that agsm software make sure that u check the settings and click for LAN option.
and then give a path and the folder name where the setup of agsm has to generate a file called lan.html
Then in the script where you have to give the path make sure you use the \ slash to seperate the path.
save the script and you are done with lan.html
Hope this helps you.
Dont ask anyhelp on my hub.

bastya_elvtars

Patrick, are you the one that sends me mails regarding this topic? If so please stop it ASAP.
Everything could have been anything else and it would have just as much meaning.

?StIfFLEr??

bastya he is a noob he troubles me the same way on my hub by sending me 100's of PM. even m fed up of replying him again and again.

?StIfFLEr??

thanks mutor hope that noob patrick gets it right this time. ;D

SMF spam blocked by CleanTalk