NL/Resource:Irc: Difference between revisions
mNo edit summary |
Mack Varial (talk | contribs) No edit summary |
||
Line 543: | Line 543: | ||
'''NOTE:''' Alle parameters die tussen haakjes staan zijn optioneel, zie [[optional arguments]] | '''NOTE:''' Alle parameters die tussen haakjes staan zijn optioneel, zie [[optional arguments]] | ||
==Commandos== | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''commando''' | |||
|width='100pt'|'''level''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!kick''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!uptime''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!say''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!s''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!m''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!players''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!pm''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!ts''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!getip''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!getserial''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!mute''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!unmute''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!mutes''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!freeze''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!unfreeze''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!kill''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!slap''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!ban''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!banip''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!banserial''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!banname''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!unbanip''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!unbanserial''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!unban''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!bans''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!commands''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!cmds''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!lua''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!run''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!crun''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!resources''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!start''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!restart''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!stop''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!account''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!community''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!money''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!health''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!wantedlevel''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!team''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!ping''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!modules''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!changemap''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!map''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!shutdown''' | |||
|width='100pt'|'''5''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!password''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!gravity''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!weather''' | |||
|width='100pt'|'''3''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!server''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!zone''' | |||
|width='100pt'|'''0''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!refreshall''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!refresh''' | |||
|width='100pt'|'''4''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!checkmap''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
{| class="wikitable" border="0" | |||
|- | |||
|width="200pt"|'''!country''' | |||
|width='100pt'|'''2''' | |||
|- | |||
|} | |||
==Aanpassen== | ==Aanpassen== |
Revision as of 12:06, 15 July 2013
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 |
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 |
userdata |
ircGetUserFromNick | string theNickname |
table |
ircGetUserChannels | user theIRCUser |
bool |
addIRCCommandHandler | string theCommandName, function theFunctionToCall/string functionName, (number minimumLevel), (boolean echoChannelOnly) |
NOTE: Gebruik een string met de functie naam als je deze functie gebruikt vanuit een andere resource, zorg ervoor dat deze functie geëxporteerd is
table |
ircGetCommands |
number |
ircGetCommandLevel | string theCommand |
boolean |
ircIsCommandEchoChannelOnly | string theCommand |
NOTE: Alle parameters die tussen haakjes staan zijn optioneel, zie optional arguments
Commandos
commando | level |
!kick | 2 |
!uptime | 0 |
!say | 0 |
!s | 0 |
!m | 0 |
!players | 0 |
!pm | 0 |
!ts | 0 |
!getip | 2 |
!getserial | 2 |
!mute | 2 |
!unmute | 2 |
!mutes | 2 |
!freeze | 2 |
!unfreeze | 2 |
!kill | 2 |
!slap | 2 |
!ban | 3 |
!banip | 3 |
!banserial | 3 |
!banname | 3 |
!unbanip | 3 |
!unbanserial | 3 |
!unban | 3 |
!bans | 3 |
!commands | 0 |
!cmds | 0 |
!lua | 4 |
!run | 4 |
!crun | 4 |
!resources | 3 |
!start | 3 |
!restart | 3 |
!stop | 3 |
!account | 3 |
!community | 3 |
!money | 0 |
!health | 0 |
!wantedlevel | 0 |
!team | 0 |
!ping | 0 |
!modules | 3 |
!changemap | 3 |
!map | 0 |
!shutdown | 5 |
!password | 4 |
!gravity | 3 |
!weather | 3 |
!server | 0 |
!zone | 0 |
!refreshall | 4 |
!refresh | 4 |
!checkmap | 2 |
!country | 2 |
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])