Skip to content

Commit 2a2bcfa

Browse files
committed
Added acl requests
1 parent d16b4af commit 2a2bcfa

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

resources/irc/meta.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,22 @@
145145
<script src="scripts/runcode/client_util.lua" type="client" />
146146

147147
<html src="logs.html" />
148+
149+
<!-- ACL -->
150+
<aclrequest>
151+
<right name="function.kickPlayer" access="true" />
152+
<right name="function.addBan" access="true" />
153+
<right name="function.removeBan" access="true" />
154+
<right name="function.getPlayerIP" access="true" />
155+
<right name="function.getPlayerSerial" access="true" />
156+
<right name="function.setPlayerFrozen" access="true" />
157+
<right name="function.setPlayerMuted" access="true" />
158+
<right name="function.killPed" access="true" />
159+
<right name="function.startResource" access="true" />
160+
<right name="function.stopResource" access="true" />
161+
<right name="function.restartResource" access="true" />
162+
<right name="function.callRemote" access="true" />
163+
<right name="function.fileOpen" access="true" />
164+
<right name="function.fileRead" access="true" />
165+
</aclrequest>
148166
</meta>

resources/irc/scripts/loading.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ addEventHandler("onResourceStart",resourceRoot,
3131
function ()
3232
-- Is the sockets module loaded?
3333
if not sockOpen then
34-
outputServerLog("IRC: could not start resource, the sockets module isn't loaded!")
35-
outputServerLog("IRC: restart the resource to retry")
34+
outputDebugString("could not start the irc resource, the sockets module isn't loaded!")
35+
outputDebugString("try to start the resource again to retry")
36+
startupCancelled = true
37+
cancelEvent()
3638
return
3739
end
3840

@@ -44,20 +46,22 @@ addEventHandler("onResourceStart",resourceRoot,
4446
end
4547
end
4648
if #missingRights ~= 0 then
47-
outputServerLog("IRC: "..#missingRights.." missing rights: ")
49+
outputDebugString("IRC: "..#missingRights.." missing rights: ")
4850
for i,missingRight in ipairs (missingRights) do
49-
outputServerLog(" - "..missingRight)
51+
outputDebugString(" - "..missingRight)
5052
end
51-
outputServerLog("IRC: could not start resource, the resource is missing rights!")
52-
outputServerLog("IRC: restart the resource to retry")
53+
outputDebugString("the irc resource does not have sufficient rights, type 'aclrequest allow irc all'")
54+
outputDebugString("try to start the resource again to retry")
55+
startupCancelled = true
56+
cancelEvent()
5357
return
5458
end
5559

5660
-- Is the resource up-to-date?
5761
function checkVersion (res,version)
5862
if res ~= "ERROR" and version then
5963
if getNumberFromVersion(version) > getNumberFromVersion(getResourceInfo(getThisResource(),"version")) then
60-
outputServerLog("IRC: resource is outdated, newest version: "..version)
64+
outputDebugString("the irc resource is outdated, newest version: "..version)
6165
setTimer(outputIRC,10000,1,"The irc resource is outdated, newest version: "..version)
6266
end
6367
end

resources/irc/scripts/logging.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local logfile
1313
------------------------------------
1414
addEventHandler("onResourceStart",resourceRoot,
1515
function ()
16-
if getMaximumLogSize() == 0 then return end
16+
if getMaximumLogSize() == 0 or startupCancelled then return end
1717

1818
if fileExists("irc.log") then
1919
logfile = fileOpen("irc.log")
@@ -37,6 +37,7 @@ addEventHandler("onIRCRaw",root,
3737

3838
addEventHandler("onResourceStop",resourceRoot,
3939
function ()
40+
if startupCancelled then return end
4041
fileFlush(logfile)
4142
fileClose(logfile)
4243
end

0 commit comments

Comments
 (0)