Skip to content

Commit a3c2d62

Browse files
committed
A few fixes
1 parent c485b0f commit a3c2d62

File tree

7 files changed

+37
-6
lines changed

7 files changed

+37
-6
lines changed

resources/irc/acl.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
<command name="!team" level="0" echoChannelOnly="true" />
3939
<command name="!ping" level="0" echoChannelOnly="true" />
4040
<command name="!modules" level="3" echoChannelOnly="true" />
41-
<command name="!changemap" level="3" echoChannelOnly="true" />
41+
<command name="!changemap" level="3" echoChannelOnly="true" />
42+
<command name="!map" level="0" echoChannelOnly="true" />
4243
</acl>

resources/irc/meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</settings>
3939

4040
<!-- Don't touch anything below! -->
41-
<info author="MCvarial" version="1.0.0" type="misc" name="irc" description="Echobot to be used on irc" />
41+
<info author="MCvarial" version="1.0.1" type="misc" name="irc" description="Echobot to be used on irc" />
4242

4343
<export function="ircHop" type="server" http="false" />
4444
<export function="ircSay" type="server" http="false" />

resources/irc/scripts/echo.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ addEventHandler("onUnban",root,
140140
end
141141
)
142142

143+
addEvent("onPlayerRaceWasted")
144+
addEventHandler("onPlayerRaceWasted",root,
145+
function (vehicle)
146+
if #getAlivePlayers() == 1 and currentmode ~= "Sprint" then
147+
outputIRC("12* "..getPlayerName(getAlivePlayers()[1]).." won the deathmatch!")
148+
end
149+
end
150+
)
151+
143152
------------------------------------
144153
-- Admin interaction
145154
------------------------------------
@@ -165,6 +174,17 @@ addEventHandler("onPlayerMute",root,
165174
end
166175
)
167176

177+
addEvent("aMessage",true)
178+
addEventHandler("aMessage",root,
179+
function (_,t)
180+
local channel = ircGetEchoChannel()
181+
ircRaw(ircGetChannelServer(channel),"NOTICE %"..tostring(ircGetChannelName(channel)).." :New admin message by "..tostring(getPlayerName(source)))
182+
ircRaw(ircGetChannelServer(channel),"NOTICE %"..tostring(ircGetChannelName(channel)).." :Category: "..tostring(t.category))
183+
ircRaw(ircGetChannelServer(channel),"NOTICE %"..tostring(ircGetChannelName(channel)).." :Subject: "..tostring(t.subject))
184+
ircRaw(ircGetChannelServer(channel),"NOTICE %"..tostring(ircGetChannelName(channel)).." :Message: "..tostring(t.message))
185+
end
186+
)
187+
168188
------------------------------------
169189
-- Votemanager interaction
170190
------------------------------------

resources/irc/scripts/handling.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ addEventHandler("onSockData",root,
4343
addEvent("onIRCRaw")
4444
addEventHandler("onIRCRaw",root,
4545
function (data)
46-
resetTimer(servers[source][12])
46+
if isTimer(servers[source][12]) then
47+
resetTimer(servers[source][12])
48+
end
4749
local t = split(data,32)
4850

4951
if type(servers[source][12]) == "number" then
@@ -205,7 +207,9 @@ addEventHandler("onIRCConnect",root,
205207
ircRaw(source,raw)
206208
end
207209
servers[source][16] = {}
208-
killTimer(servers[source][12])
210+
if isTimer(servers[source][12]) then
211+
killTimer(servers[source][12])
212+
end
209213
servers[source][12] = setTimer(ircReconnect,600000,0,source,"Connection timed out!")
210214
end
211215
)

resources/irc/scripts/ircclient_server.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,5 @@ function triggerIRCEvent (eventname,...)
117117
end
118118

119119
function ircGetChannelTitle (channel)
120-
return ircGetChannelName(channel).." - "..ircGetServerName(ircGetChannelServer(channel))
120+
return tostring(ircGetChannelName(channel)).." - "..tostring(ircGetServerName(ircGetChannelServer(channel)))
121121
end

resources/irc/scripts/irccommands.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ addIRCCommandHandler("!changemap",
540540
end
541541
)
542542

543+
addIRCCommandHandler("!map",
544+
function (server,channel,user,command,...)
545+
ircSay(channel,"12* Current Map: 01"..tostring(getMapName()))
546+
end
547+
)
548+
543549
addIRCCommandHandler("!modules",
544550
function (server,channel,user,command)
545551
ircSay(channel,"07Loaded modules: "..table.concat(getLoadedModules(),", "))

resources/irc/scripts/loading.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ addEventHandler("onResourceStart",resourceRoot,
7777
local args = {...}
7878
for i,arg in ipairs (args) do
7979
local expectedArgType = gettok(line,(2+i),32)
80-
if type(arg) ~= expectedArgType and not (expectedArgType or string.find(expectedArgType,")")) then
80+
if expectedArgType and type(arg) ~= expectedArgType and not (expectedArgType or string.find(expectedArgType,")")) then
8181
outputServerLog("IRC: Bad argument #"..i.." @ '"..gettok(line,2,32).."' "..expectedArgType.." expected, got "..type(arg))
8282
return
8383
end

0 commit comments

Comments
 (0)