MCvarial Posted May 9, 2010 Share Posted May 9, 2010 (edited) Module:Sockets I proudly present you ml_sockets a c++ extension for mta 1.0, it was made by Gamesnert, MCvarial & x86. The module adds socket functions & events to mta, sockets are used for communication between computers. See wikipedia for more info: http://en.wikipedia.org/wiki/Internet_socket Installation: - download ml_sockets (https://wiki.multitheftauto.com/wiki/Modules/Sockets) - place ml_sockets in (..server\mods\deathmatch\modules) - add the module to your mtaserver.conf ( or for linux) - restart the server Functions: - socket sockOpen( string host, int port ) - bool sockWrite( socket theSocket, string data ) - bool sockClose( socket theSocket ) Events: - onSockOpened source: N/A Args: socket theSocket - onSockData source: N/A Args: socket theSocket, string data - onSockClosed source: N/A Args: socket theSocket Support for listening sockets will be added later. More info: https://wiki.multitheftauto.com/wiki/Modules/Sockets Download: http://code.google.com/p/multitheftauto-modules/downloads/list Resource:irc The first resource to make use of this module is called irc made by MCvarial. Its a resource that creates a echobot on irc. Installation: - download the resource https://community.multitheftauto.com/index.php?p=resources&s=details&id=731 - download ml_sockets (https://wiki.multitheftauto.com/wiki/Modules/Sockets) - place ml_sockets in (..server\mods\deathmatch\modules) - add the module to your mtaserver.conf ( or for linux) - change the settings (settings.xml in the resource) - give the resource admin rights - start the server - start the resource Commands: !uptime level: 0 !say level: 0 !s level: 0 !players level: 0 !pm level: 0 !getip level: 2 !getserial level: 2 !mute level: 2 !unmute level: 2 !freeze level: 2 !unfreeze level: 2 !kill level: 2 !slap level: 2 !ban level: 3 !banip level: 3 !banserial level: 3 !banname level: 3 !unbanip level: 3 !unbanserial level: 3 !unban level: 3 !bans level: 3 !start level: 3 !restart level: 3 !stop level: 3 !commands level: 0 !cmds level: 0 !run level: 4 !crun level: 4 Levels owner (~) 5 super admin (&) 4 admin (@) 3 halfop (%) 2 voice (+) 1 user () 0 The bot was tested on GTANet, FFSNetwork, Rizon & quakenet The resource is still in beta stage, more functions & bugfixed will be added later. Edited May 16, 2010 by Guest 1 Link to comment
Mr.Hankey Posted May 10, 2010 Share Posted May 10, 2010 Why don't you pass the socket as source for those events? That would fit the usual event styling in MTA more. Link to comment
eAi Posted May 10, 2010 Share Posted May 10, 2010 It would, but I guess sockets aren't elements. I reckon they could be though - but I'm not sure if there's a simple way to make new C element types. Link to comment
MCvarial Posted May 10, 2010 Author Share Posted May 10, 2010 Because its not possible to set the source of events with modules. Link to comment
Huperman Posted May 11, 2010 Share Posted May 11, 2010 Hey It's great to at last find something compatible with linux , Although there's 1 thing about the IRC resource that i am having trouble with when trying to connect, I get this: [19:55:44] Starting irc [19:55:44] irc started successfully [19:55:44] IRC: resource 'irc' outdated, please update! [19:55:46] IRC: connecting to (IP) on port 6667... [19:55:46] (IP): connected as MTA! [19:55:46] (IP): notice from (Server): *** Looking up your hostname... [19:55:46] (IP): notice from (Server): *** Found your hostname [19:55:46] (IP): PM from 642F3C7C: ^AVERSION^A [19:56:25] (IP): disconnected! (closing link) [19:56:25] WARNING: core.lua: Bad 'element' pointer @ 'triggerEvent'(2) - Line: 179 Where (IP) and (Server) was the server i was connecting to Dunno if you already know of this, or any way around it lol Any help appreciated Huperman. Link to comment
x86 Posted May 11, 2010 Share Posted May 11, 2010 Thank you for reporting this. This looks like the IRC owner has enabled anti-spoof, which needs to send first a ping back before logging in. Should be checked by Gamesnert & MCVarial (just a little bit debugging). Questions? contact me @ IRC (x86). Link to comment
MTA Team ccw Posted May 13, 2010 MTA Team Share Posted May 13, 2010 I could be wrong, but calling Lua from another thread is fraught with danger. I humbly suggest you put the data for the onSock* events into a thread safe queue, and then from within 'MTAEXPORT bool DoPulse ( void )', process the queue and trigger the events. Link to comment
x86 Posted May 14, 2010 Share Posted May 14, 2010 Thank you for your suggest, ccw. Fixed in: r88: http://code.google.com/p/multitheftauto ... etail?r=88 New download available: http://code.google.com/p/multitheftauto ... loads/list Link to comment
djlobo Posted May 17, 2010 Share Posted May 17, 2010 We are using it at mini-missions and seems all working fine so far, also is quite fast. so... great success. Link to comment
x86 Posted June 28, 2010 Share Posted June 28, 2010 New stable release (Win32 & Linux)! Grab it from: http://code.google.com/p/multitheftauto ... loads/list Link to comment
lukkie[BE] Posted June 29, 2010 Share Posted June 29, 2010 It's doing its job very well on #Partyandco D: Link to comment
wouter0100 Posted October 8, 2010 Share Posted October 8, 2010 I have a problem: ( Because if I join I can not approve, but when I restart the resource if I am gejoint I can pass all commands? I really get nothing: ( I had already tried that when someone connects to the resource he automaticly irc restart but that did not work: S I hope someone can help. Wouter Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now