NL/Resource:Irc

From Multi Theft Auto: Wiki
Revision as of 15:17, 4 January 2011 by Mack Varial (talk | contribs) (Created page with "{{Resource page}} __NOTOC__ De "irc" resource zorgt voor een echobot die berichten zoals chatberichten output op een irc channel. Informatie over "irc" of "Internet Relay Chat" k...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

De "irc" resource zorgt voor een echobot die berichten zoals chatberichten output op een irc channel. Informatie over "irc" of "Internet Relay Chat" kan gevonden worden op Wikipedia.

Installatie

Om deze resource aan de praat te krijgen op je Linux of Windows server, volg deze stappen:

  • Installeer de sockets module
    • Download de module: Je kan deze module vinden op het mta-modules project. Download het ml_sockets.dll bestand voor Windows en het ml_sockets.so bestand voor Linux
    • Voeg de module toe in de MTA map: Om deze module te laten moet deze in de volgende map geplaatst worden: mods/deathmatch/modules, als deze map niet bestaat, maak ze dan.
    • Voeg de module toe aan het mtaserver.conf bestand: Om de module te laden wanneer de server start, voeg dan dit lijntje <module src="ml_sockets.dll"/> voor Windows en dit lijntje <module src="ml_sockets.so"/> voor Linux toe aan je mtaserver.conf.
  • Installeer de IRC resource
    • Download de resource: De IRC resource kan gevond worden op de community, plaats de resource in de resources map.
    • Pas het settings.xml bestand aan: Open dit bestand en volg de instructies in het bestand om de bot te configureren.
    • Pas het meta.xml bestand aan: In dit bestand staan een aantal settings met betrekken tot reclame en ingame gui's, blijf van de rest! Je kan deze settings ook veranderen in je admin paneel wanneer de resource geladen is.
    • Acl rechten De resource heeft een aantal rechten nodig om goed te werken waaronder: addBan, kickPlayer & callRemote. Als de resource niet genoeg rechten heeft verschijnt er een bericht in de console en kan de resource niet starten.

Nu kan je de resource starten, als de server aan het werken was tijdens deze bewerkingen doe dan eerst: /loadmodule ml_sockets.dll of /loadmodule ml_sockets.so en /refreshall voordat je /start irc doet.

Het acl.xml bestand

Het acl.xml bestand in de irc resource zorgt voor de acl rechten van irc commands.

Syntax

<command name="!kick" level="2" echoChannelOnly="true" />
  • De name is de command met uitroepteken
  • De level is het minimum level dat de irc user moet hebben om de command te gebruiken.
  • De echoChannelOnly bepaald ofdat je de command kan gebruiken buiten het echochannel

Elementen

Alle gebruikers, kanalen & servers gekend door de irc resource worden voorgestand door elementen

  • Servers zijn de volgende elementen: 'irc-server'
  • Channels zijn de volgende elementen: 'irc-channel'
  • Users zijn de volgende elementen: 'irc-user'

Level systeem

De irc resource gebruikt geen irc modes systeem voor zijn acl, maar wel nummers.

  • Owner (~) is nu level 5
  • Super Operator (&) is nu level 4
  • Operator (@) is nu level 3
  • Helper (%) is nu level 2
  • Voice (+) is nu level 1

Alle andere gebruikers zijn nu level 0

Events

Gedurende het irc proces worden een aantal events getriggerd om het je gemakkelijk te maken om extensies te schrijven. Je moet wel addEvent("eventName") doen om ze te kunnen gebruiken.

Naam Source Parameters
onIRCConnecting server theIRCServer

onIRCConnect server theIRCServer

onIRCFailConnect server theIRCServer
string reason
onIRCUserJoin user theIRCUser
channel theIRCChannel, string vhost
onIRCUserNickChange user theIRCUser
string oldNick, string newNick
onIRCUserPart user theIRCUser
channel theIRCChannel, string theReason

NOTE: 'theReason' kan nil zijn als 'theUser' gequit heeft zonder reden.

onIRCUserKick user theIRCUser
channel theIRCChannel, string theReason, user theKicker

NOTE: 'theKicker' kan false zijn als 'theUser' gekickt was door een service zoals de nickserv.

onIRCPrivateMessage user theIRCUser
string theMessage
onIRCMessage user theIRCUser
channel theIRCChannel, string theMessage
onIRCPrivateNotice user theIRCUser
string theMessage
onIRCNotice user theIRCUser
channel theIRCChannel, string theMessage
onIRCUserMode user theIRCUser
channel theIRCChannel, boolean positive, string theMode, user theSetter

NOTE: 'theSetter' kan false zijn als 'theUser' geopt was door een service zoals de chanserv

onIRCChannelMode channel theIRCChannel
boolean positive, string theMode, user theSetter

NOTE: 'theSetter' kan false zijn als de mode geset was door een service zoals chanserv

onIRCLevelChange user theIRCUser
channel theIRCChannel, number oldlevel, number newlevel
onIRCUserQuit user theIRCUser
string theReason

Geëxporteerde functies

Deze functies kunnen gebeld worden van andere resources om het schrijven van extensies mogelijk te maken Gebruik de exports tabel of call om ze te gebruiken.

Voorbeeld 1:

[Lua]
	exports.irc:ircConnect("irc.gtanet.com","bot",6667)

Voorbeeld 2:

[Lua]
	call(getResourceFromName("irc"),"ircConnect","irc.gtanet.com","bot",6667)


returns
functie naam Parameters
boolean
ircHop
server theIRCServer, (string theReason)
boolean
ircSay
channel theIRCChannel/user theIRCUser, string theMessage
boolean
ircRaw
server theIRCServer, string theRaw
boolean
ircPart
channel theIRCChannel, (string theReason)
boolean
ircJoin
server theIRCServer, string theChannelName, (string theChannelPassword)
boolean
ircAction
channel theIRCChannel/user theIRCUser, string theMessage
boolean
ircNotice
channel theIRCChannel/user theUserChannel, string theMessage
boolean
outputIRC
string theMessage
boolean
ircConnect
string serverHost/IP, string nickname, (number serverPort), (string serverPassword), (boolean secure)

NOTE: Secure connections are not available yet due to the module not suporting SSL yet.

boolean
ircIdentify
server theIRCServer, string thePassword
boolean
ircReconnect
server theIRCServer
boolean
ircDisconnect
server theIRCServer, string theReason
boolean
ircChangeNick
server theIRCServer, string newNick
table
ircGetServers

string
ircGetServerName
server theIRCServer
string
ircGetServerHost
server theIRCServer
number
ircGetServerPort
server theIRCServer
string
ircGetServerPass
server theIRCServer
string
ircGetServerNick
server theIRCServer
boolean
ircIsServerSecure
server theIRCServer
table
ircGetServerChannels
server theIRCServer
userdata
ircGetChannelServer
channel theIRCChannel
table
ircGetChannels
(server theIRCServer)
boolean
ircSetChannelMode
channel theIRCChannel, string theMode
string
ircGetChannelName
channel theIRCChannel
string
ircGetChannelMode
channel theIRCChannel
table
ircGetChannelUsers
channel theIRCChannel
string
ircGetChannelTopic
channel theIRCChannel
userdata
ircGetChannelFromName
string theChannelName
bool
ircIsEchoChannel
channel theIRCChannel
boolean
ircSetUserMode
user theIRCUser, string theMode
boolean
ircIsUserBot
user theIRCUser
string
ircGetUserMode
user theIRCUser
string
ircGetUserNick
user theIRCUser
number
ircGetUserLevel
user theIRCUser
table
ircGetUsers
(server theIRCServer)
userdata
ircGetUserServer
user theIRCUser
number
ircGetUserLevel
user theIRCUser, channel theIRCChannel
string
ircGetUserVhost
user theIRCUser
boolean
ircIsUserSecure
user theIRCUser
userdata
ircGetUserFromNick
string theNickname
string
ircGetUserRealName
user theIRCUser
table
ircGetUserChannels
user theIRCUser
bool
'addIRCCommandHandler
string theCommandName, function theFunctionToCall, (number minimumLevel), (boolean echoChannelOnly)
table
ircGetCommands

number
ircGetCommandLevel
string theCommand
boolean
ircIsCommandEchoChannelOnly
string theCommand

NOTE: Alle parameters die tussen haakjes staan zijn optioneel, zie optional arguments

Aanpassen

Gelieve de resource niet aan te passen, je kan ze breken. Schrijf extensies.

Contacteren

De auteur (MCvarial) kan gecontacteerd worden op IRC (#mta,#mta.dutch) Of via email ([email protected])