[b] Another project from me i started about an hour ago[/b]
Idea:
The idea of this script is to be able to control garrysmod servers via IRC this could be useful for websites in order to view there servers without connecting, I had the idea for this about 2 years ago but was never relay good with lua.
Screenshot
[img]http://img145.imageshack.us/img145/4470/scnshot.jpg[/img]
Looks great now make it realy from IRC side.
Eg.
IRC user > Chat box
What you have now is:
Chat box > IRC user
This then would be amazingly handy.
HLSW - Game Server Browser and Administration Tool
[url]http://www.hlsw.org/[/url]
[QUOTE=benjojo;19385984]Looks great now make it realy from IRC side.
Eg.
IRC user > Chat box
What you have now is:
Chat box > IRC user
This then would be amazingly handy.[/QUOTE]
Already gonna :) just need to make the praser
I think this would be a great idea. Maybe incorperate a command system for channel admins?
Already under way
[lua]local socket = luasocket_stuff.luaopen_socket_core()
MY_SOCK = nil;
function HandleConnection(irc)
Msg("HANDLE CONNECTION!\n");
local error = nil;
local handle = function()
local line, error = irc:receive("*line");
if(line != nil) then
Msg(line .. "\n");
end
timer.Simple(1, handle);
end
Msg("ALL HANDLED\n");
end
function doConnection()
local strNick = "Conzorz"..math.random(100, 1000);
local strUser = "Conzorz"..math.random(100, 1000);
local irc = socket.tcp();
irc:connect("irc.alphazone4.co.uk", 6667)
irc:settimeout(0);
irc:send ("USER "..strUser.." "..strUser.." "..strUser.." :"..strUser.."\r\n")
irc:send ("NICK "..strNick.."\r\n")
irc:send ("JOIN #rolfz0rz\r\n")
Msg("Indeed.\n");
timer.Simple(1, HandleConnection, irc);
Msg("LOL");
end[/lua]
I'm having issues it connects but i don't receive any data :|
Awesome idea!
[QUOTE=aualin;19399282]Awesome idea![/QUOTE]
Thanks, Much appreciated
[QUOTE=recox998;19399165]I'm having issues it connects but i don't receive any data :|[/QUOTE]
[lua]
function HandleConnection(irc)
Msg("HANDLE CONNECTION!\n");
local error = nil;
local handle = function()
local line, error = irc:receive("*line");
if(line != nil) then
Msg(line .. "\n");
end
end
timer.Simple(1, handle);
Msg("ALL HANDLED\n");
end
[/lua]
Though, I suggest you use the 'handle' function and just call HandleConnection again.
[QUOTE=Nevec;19399337][lua]
function HandleConnection(irc)
Msg("HANDLE CONNECTION!\n");
local error = nil;
local handle = function()
local line, error = irc:receive("*line");
if(line != nil) then
Msg(line .. "\n");
end
end
timer.Simple(1, handle);
Msg("ALL HANDLED\n");
end
[/lua]
Though, I suggest you use the 'handle' function and just call HandleConnection again.[/QUOTE]
Changed thanks now testing to see if i get any data back
[editline]11:52AM[/editline]
Hmm im just getting epic amounts of Handle Connection then a stack overflow
[code]
HANDLE CONNECTION!
HANDLE CONNECTION!
HANDLE CONNECTION!
HANDLE CONNECTION!
HANDLE CONNECTION!
HANDLE CONNECTION!
HANDLE CONNECTION!
error in error handling
(null)Timer Error: error in error handling
[/code]
[editline]01:03PM[/editline]
After more testing i still cannot get data im looking at the Refrance now so see what im doing wrong
Good news i can recive the 1st line :)
[lua]
:irc.alphazone4.co.uk NOTICE AUTH :*** Looking up your hostname...
Timer Error: ServIRC.lua:10: attempt to index local 'irc' (a nil value)
function HandleConnection(irc)
local line, err = irc:receive("*l");
local err = nil;
if(line != nil) then
Msg(line .. "\n");
else
timer.Simple(1, HandleConnection);
end
end
[/lua]
Any help would be much appreciated
Send/Recv is now done, Now working on a parser and then ill start adding commands
If you want some help, I'm happy to. :3:
[QUOTE=Gbps;19404997]If you want some help, I'm happy to. :3:[/QUOTE]
Thanks man i could use with some help to be honest my parser is being the difficult bit
[QUOTE=recox998;19400985]Good news i can recive the 1st line :)
[lua]
:irc.alphazone4.co.uk NOTICE AUTH :*** Looking up your hostname...
Timer Error: ServIRC.lua:10: attempt to index local 'irc' (a nil value)
function HandleConnection(irc)
local line, err = irc:receive("*l");
local err = nil;
if(line != nil) then
Msg(line .. "\n");
else
timer.Simple(1, HandleConnection);
end
end
[/lua]
Any help would be much appreciated[/QUOTE]
Is that solved now? If not you should call timer.Simple(1,HandeConenction,irc)
I wouldn't say calling it every one second is good, due to the fact you'll probably end up waiting at least one minute for a connection.
[QUOTE=recox998;19405408]Thanks man i could use with some help to be honest my parser is being the difficult bit[/QUOTE]
I'm good with patern matching, add me if you want :wink:
[QUOTE=recox998;19383389][b] Another project from me i started about an hour ago[/b]
Idea:
The idea of this script is to be able to control garrysmod servers via IRC this could be useful for websites in order to view there servers without connecting, I had the idea for this about 2 years ago but was never relay good with lua.
Screenshots
[img]http://img145.imageshack.us/img145/4470/scnshot.jpg[/img][/QUOTE]
Update:
[img]http://img51.imageshack.us/img51/4397/latestscreen.jpg[/img]
[img]http://i47.tinypic.com/5b33bt.png[/img]
Just a modified version of gchat made by stoned. :P
I can't use it though because my server provider won't let me put the socket module on my server. :\
Tis good but proplem is it dosent let you send commands to server
I could add that if I wanted, but there's no point. I just use hlsw for that.
Id use my android phone with an irc client to do something nasty whenever i feel like it :laugh:
[QUOTE=aualin;19413253]Id use my android phone with an irc client to do something nasty whenever i feel like it :laugh:[/QUOTE]
Lol, Yup could do that right now i can send any command that can be used in the console via IRC
Looks good, keep it coming.
Why not use hlsw, as that guy up there posted?
Because if he made a IRC system, I could get on my sidekick, connect, and do stuff on my server from my phone. I like this idea.
Because the Whole "HLSW" idea is kinda Sh** As you can send but not receive with this i could embed to my site control from my phone even make a Server Control Device or if i wanted to i could manipulate a player and actually play gmod from my phone obv would suck due to no being able to see anything but it is still possible
[QUOTE=Bletotum;19429983]Why not use hlsw, as that guy up there posted?[/QUOTE]
Because this: [url]http://www.android.com/[/url]
This: [url]http://www.htc.com/europe/product/hero/overview.html[/url]
And any of these: [url]http://www.androlib.com/r.aspx?r=irc[/url]
Make a great combination, don't you think?
Also this is an interesting way to implement server-to-server chat...
[QUOTE=aualin;19442775]Also this is an interesting way to implement server-to-server chat...[/QUOTE]
Server to server has already been done.
[url]http://www.facepunch.com/showthread.php?t=817768[/url]
Sorry, you need to Log In to post a reply to this thread.