Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin2: various fixes #462

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 111 additions & 110 deletions [admin]/admin2/meta.xml
Original file line number Diff line number Diff line change
@@ -1,113 +1,114 @@
<meta>
<info name="Admin" author="lil_Toady" type="misc" version="2.0" description="Administration panel" showInResourceBrowser="true" pages="http/screenshots.htm|Screenshots" noDefaultPage="true" />
<min_mta_version server="1.5.5-9.13846" client="1.5.5-9.13846"></min_mta_version>
<info name="Admin" author="lil_Toady" type="misc" version="2.0" description="Administration panel" showInResourceBrowser="true" pages="http/screenshots.htm|Screenshots" noDefaultPage="true"/>
<min_mta_version server="1.5.5-9.13846" client="1.5.5-9.13846"/>

<!--
Admin System Meta File.
<!--
Admin System Meta File.

WARNING: We give no support for edited
versions of the admin system.
-->

<!-- Enable OOP -->
<oop>true</oop>

<!--Main script files, keep them in that order or it may break-->
<script src="admin_definitions.lua" type="server" />
<script src="admin_definitions.lua" type="client" cache="false" />

<script src="admin_coroutines.lua" type="server" />
<script src="admin_coroutines.lua" type="client" cache="false" />


<script src="server/admin_wrapper.lua" type="server" />
<script src="server/admin_session.lua" type="server" />
<script src="server/admin_proxy.lua" type="server" />
<script src="server/admin_functions.lua" type="server" />
<script src="server/admin_server.lua" type="server" />
<script src="server/admin_database.lua" type="server" />
<script src="server/admin_storage.lua" type="server" />
<script src="server/admin_sync.lua" type="server" />
<script src="server/admin_commands.lua" type="server" />
<script src="server/admin_ACL.lua" type="server" />
<script src="server/admin_bans.lua" type="server" />
<script src="server/admin_network.lua" type="server" />
<script src="server/admin_messagebox.lua" type="server" />
<script src="server/admin_screenshot.lua" type="server" />

<script src="client/admin_wrapper.lua" type="client" cache="false" />
<script src="client/admin_gui.lua" type="client" cache="false" />
<script src="client/admin_settings.lua" type="client" cache="false" />
<script src="client/admin_session.lua" type="client" cache="false" />
<script src="client/admin_proxy.lua" type="client" cache="false" />
<script src="client/main/admin.lua" type="client" cache="false" />
<script src="client/main/admin_players.lua" type="client" cache="false" />
<script src="client/main/admin_resources.lua" type="client" cache="false" />
<script src="client/main/admin_server.lua" type="client" cache="false" />
<script src="client/main/admin_bans.lua" type="client" cache="false" />
<script src="client/main/admin_chat.lua" type="client" cache="false" />
<script src="client/main/admin_network.lua" type="client" cache="false" />
<script src="client/main/admin_options.lua" type="client" cache="false" />
<script src="client/main/admin_acl.lua" type="client" cache="false" />
<script src="client/main/admin_map.lua" type="client" cache="false" />
<script src="client/widgets/admin_messagebox.lua" type="client" cache="false" />
<script src="client/widgets/admin_inputbox.lua" type="client" cache="false" />
<script src="client/widgets/admin_color.lua" type="client" cache="false" />
<script src="client/widgets/admin_performance.lua" type="client" cache="false" />
<script src="client/widgets/admin_permissions.lua" type="client" cache="false" />
<script src="client/widgets/admin_messages.lua" type="client" cache="false" />
<script src="client/widgets/admin_spectator.lua" type="client" cache="false" />
<script src="client/widgets/admin_editor.lua" type="client" cache="false" />
<script src="client/widgets/admin_team.lua" type="client" cache="false" />
<script src="client/widgets/admin_skin.lua" type="client" cache="false" />
<script src="client/widgets/admin_stats.lua" type="client" cache="false" />
<script src="client/widgets/admin_vehicle_upgrades.lua" type="client" cache="false" />
<script src="client/widgets/admin_vehicle.lua" type="client" cache="false" />
<script src="client/widgets/admin_interior.lua" type="client" cache="false" />
<script src="client/widgets/admin_screenshot.lua" type="client" cache="false" />
<script src="client/widgets/admin_ban.lua" type="client" cache="false" />
<script src="client/widgets/admin_warp.lua" type="client" cache="false" />
<script src="client/widgets/admin_report.lua" type="client" cache="false" />
<script src="client/widgets/admin_weapon.lua" type="client" cache="false" />

<script src="shared/utils.lua" type="shared" />

<html src="http/screenshots.htm" />
<html src="http/screenshot.htm" />

<export function="dataExchange" http="true" />

<!--Required XML configs kept in /conf/ folder-->
<config src="conf/interiors.xml" type="client" />
<config src="conf/weathers.xml" type="client" />
<config src="conf/upgrades.xml" type="client" />
<config src="conf/skins.xml" type="client" />
<config src="conf/weapons.xml" type="client" />
<config src="conf/stats.xml" type="client" />
<config src="conf/vehicles.xml" type="client" />
<config src="conf/messages.xml" type="server" />
<config src="conf/commands.xml" type="server" />
<config src="conf/ACL.xml" type="server" />
<!--Images-->
<file src="client/images/map.png" />
<file src="client/images/warning.png" />
<file src="client/images/error.png" />
<file src="client/images/question.png" />
<file src="client/images/info.png" />
<file src="client/images/dot.png" />
<file src="client/images/search.png" />
<file src="client/images/colorscheme.png" />
<file src="client/images/empty.png" />
<file src="client/images/palette.png" />
<file src="client/images/black.png" />
<file src="client/images/blue.png" />

<settings>
<setting name="#pingkicker" value="0" group="Automatic scripts" friendlyname="Ping kicker" accept="0-1000" desc="Max ping allowed (0 - off)" />
<setting name="#fpskicker" value="0" group="Automatic scripts" friendlyname="FPS kicker" accept="0-100" desc="Lowest fps allowed: 25-75 (0 - off)" />
<setting name="#idlekicker" value="0" group="Automatic scripts" friendlyname="Idle Kicker" accept="0-100" desc="Maximum time a player can stay idle (minutes, 0 - off)." />
<setting name="#consolecommands" value="[true]" group="General" friendlyname="Enable console commands" accept="[true],[false]" desc="Parse console commands." />
<setting name="#adminChatCommandName" value="a" group="General" friendlyname="Admin chat command name" desc="The command name for admin chat." />
<setting name="*useip2c" value="true" friendlyname="useip2c" group="_Advanced" accept="true,false" desc="When enabled, ip2c resource runs and fetches player countries by IP." />
</settings>
</meta>
WARNING: We give no support for edited
versions of the admin system.
-->

<!-- Enable OOP -->

<oop>true</oop>

<!-- Main script files, keep them in that order or it may break -->

<script src="admin_definitions.lua" type="shared" cache="false"/>
<script src="admin_coroutines.lua" type="shared" cache="false"/>

<script src="server/admin_wrapper.lua" type="server"/>
<script src="server/admin_session.lua" type="server"/>
<script src="server/admin_proxy.lua" type="server"/>
<script src="server/admin_functions.lua" type="server"/>
<script src="server/admin_server.lua" type="server"/>
<script src="server/admin_database.lua" type="server"/>
<script src="server/admin_storage.lua" type="server"/>
<script src="server/admin_sync.lua" type="server"/>
<script src="server/admin_commands.lua" type="server"/>
<script src="server/admin_ACL.lua" type="server"/>
<script src="server/admin_bans.lua" type="server"/>
<script src="server/admin_network.lua" type="server"/>
<script src="server/admin_messagebox.lua" type="server"/>
<script src="server/admin_screenshot.lua" type="server"/>

<script src="client/admin_wrapper.lua" type="client" cache="false"/>
<script src="client/admin_gui.lua" type="client" cache="false"/>
<script src="client/admin_settings.lua" type="client" cache="false"/>
<script src="client/admin_session.lua" type="client" cache="false"/>
<script src="client/admin_proxy.lua" type="client" cache="false"/>
<script src="client/main/admin.lua" type="client" cache="false"/>
<script src="client/main/admin_players.lua" type="client" cache="false"/>
<script src="client/main/admin_resources.lua" type="client" cache="false"/>
<script src="client/main/admin_server.lua" type="client" cache="false"/>
<script src="client/main/admin_bans.lua" type="client" cache="false"/>
<script src="client/main/admin_chat.lua" type="client" cache="false"/>
<script src="client/main/admin_network.lua" type="client" cache="false"/>
<script src="client/main/admin_options.lua" type="client" cache="false"/>
<script src="client/main/admin_acl.lua" type="client" cache="false"/>
<script src="client/main/admin_map.lua" type="client" cache="false"/>
<script src="client/widgets/admin_messagebox.lua" type="client" cache="false"/>
<script src="client/widgets/admin_inputbox.lua" type="client" cache="false"/>
<script src="client/widgets/admin_color.lua" type="client" cache="false"/>
<script src="client/widgets/admin_performance.lua" type="client" cache="false"/>
<script src="client/widgets/admin_permissions.lua" type="client" cache="false"/>
<script src="client/widgets/admin_messages.lua" type="client" cache="false"/>
<script src="client/widgets/admin_spectator.lua" type="client" cache="false"/>
<script src="client/widgets/admin_editor.lua" type="client" cache="false"/>
<script src="client/widgets/admin_team.lua" type="client" cache="false"/>
<script src="client/widgets/admin_skin.lua" type="client" cache="false"/>
<script src="client/widgets/admin_stats.lua" type="client" cache="false"/>
<script src="client/widgets/admin_vehicle_upgrades.lua" type="client" cache="false"/>
<script src="client/widgets/admin_vehicle.lua" type="client" cache="false"/>
<script src="client/widgets/admin_interior.lua" type="client" cache="false"/>
<script src="client/widgets/admin_screenshot.lua" type="client" cache="false"/>
<script src="client/widgets/admin_ban.lua" type="client" cache="false"/>
<script src="client/widgets/admin_warp.lua" type="client" cache="false"/>
<script src="client/widgets/admin_report.lua" type="client" cache="false"/>
<script src="client/widgets/admin_weapon.lua" type="client" cache="false"/>

<script src="shared/utils.lua" type="shared" cache="false"/>

<html src="http/screenshots.htm"/>
<html src="http/screenshot.htm"/>

<export function="dataExchange" http="true"/>

<!-- Required XML configs kept in /conf/ folder -->

<config src="conf/interiors.xml" type="client"/>
<config src="conf/weathers.xml" type="client"/>
<config src="conf/upgrades.xml" type="client"/>
<config src="conf/skins.xml" type="client"/>
<config src="conf/weapons.xml" type="client"/>
<config src="conf/stats.xml" type="client"/>
<config src="conf/vehicles.xml" type="client"/>
<config src="conf/messages.xml" type="server"/>
<config src="conf/commands.xml" type="server"/>
<config src="conf/ACL.xml" type="server"/>

<!-- Images -->

<file src="client/images/map.png"/>
<file src="client/images/warning.png"/>
<file src="client/images/error.png"/>
<file src="client/images/question.png"/>
<file src="client/images/info.png"/>
<file src="client/images/dot.png"/>
<file src="client/images/search.png"/>
<file src="client/images/colorscheme.png"/>
<file src="client/images/empty.png"/>
<file src="client/images/palette.png"/>
<file src="client/images/black.png"/>
<file src="client/images/blue.png"/>

<settings>
<setting name="#pingkicker" value="0" group="Automatic scripts" friendlyname="Ping kicker" accept="0-1000" desc="Max ping allowed (0 - off)"/>
<setting name="#fpskicker" value="0" group="Automatic scripts" friendlyname="FPS kicker" accept="0-100" desc="Lowest fps allowed: 25-75 (0 - off)"/>
<setting name="#idlekicker" value="0" group="Automatic scripts" friendlyname="Idle Kicker" accept="0-100" desc="Maximum time a player can stay idle (minutes, 0 - off)."/>
<setting name="#consolecommands" value="[true]" group="General" friendlyname="Enable console commands" accept="[true],[false]" desc="Parse console commands."/>
<setting name="#adminChatCommandName" value="a" group="General" friendlyname="Admin chat command name" desc="The command name for admin chat."/>
<setting name="*useip2c" value="true" friendlyname="useip2c" group="_Advanced" accept="true,false" desc="When enabled, ip2c resource runs and fetches player countries by IP."/>
</settings>
</meta>
42 changes: 21 additions & 21 deletions [admin]/admin2/server/admin_ACL.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,21 @@ function moo()
if (action == "password") then
action = nil
if (not arg[1]) then
outputChatBox("Error - Password missing.", source, 255, 0, 0)
outputChatBox("Error - Password missing.", client, 255, 0, 0)
elseif (not arg[2]) then
outputChatBox("Error - New password missing.", source, 255, 0, 0)
outputChatBox("Error - New password missing.", client, 255, 0, 0)
elseif (not arg[3]) then
outputChatBox("Error - Confirm password.", source, 255, 0, 0)
outputChatBox("Error - Confirm password.", client, 255, 0, 0)
elseif (tostring(arg[2]) ~= tostring(arg[3])) then
outputChatBox("Error - Passwords do not match.", source, 255, 0, 0)
outputChatBox("Error - Passwords do not match.", client, 255, 0, 0)
else
local account = getAccount(getPlayerUserName(source), tostring(arg[1]))
local account = getAccount(getPlayerUserName(client), tostring(arg[1]))
if (account) then
action = "password"
setAccountPassword(account, arg[2])
mdata = arg[2]
else
outputChatBox("Error - Invalid password.", source, 255, 0, 0)
outputChatBox("Error - Invalid password.", client, 255, 0, 0)
end
end
elseif (action == "sync") then
Expand Down Expand Up @@ -294,7 +294,7 @@ function moo()
end
end
end
triggerClientEvent(source, "aAdminACL", root, type, tableOut)
triggerClientEvent(client, "aAdminACL", root, type, tableOut)
elseif (action == "aclcreate") then
local name = arg[2]
if ((name) and (string.len(name) >= 1)) then
Expand All @@ -309,9 +309,9 @@ function moo()
action = nil
end
end
triggerEvent("aAdmin", source, "sync", "aclgroups")
triggerEvent("aAdmin", client, "sync", "aclgroups")
else
outputChatBox("Error - Invalid " .. arg[1] .. " name", source, 255, 0, 0)
outputChatBox("Error - Invalid " .. arg[1] .. " name", client, 255, 0, 0)
end
elseif (action == "acldestroy") then
local name = arg[2]
Expand All @@ -330,7 +330,7 @@ function moo()
action = nil
end
end
triggerEvent("aAdmin", source, "sync", "aclgroups")
triggerEvent("aAdmin", client, "sync", "aclgroups")
elseif (action == "acladd") then
if (arg[3]) then
action = action
Expand All @@ -342,14 +342,14 @@ function moo()
action = nil
outputChatBox(
"Error adding object '" .. tostring(object) .. "' to group '" .. tostring(arg[2]) .. "'",
source,
client,
255,
0,
0
)
else
mdata2 = "Object '" .. arg[3] .. "'"
triggerEvent("aAdmin", source, "sync", "aclobjects", arg[2])
triggerEvent("aAdmin", client, "sync", "aclobjects", arg[2])
end
elseif (arg[1] == "acl") then
local group = aclGetGroup(arg[2])
Expand All @@ -358,14 +358,14 @@ function moo()
action = nil
outputChatBox(
"Error adding ACL '" .. tostring(arg[3]) .. "' to group '" .. tostring(arg[2]) .. "'",
source,
client,
255,
0,
0
)
else
mdata2 = "ACL '" .. arg[3] .. "'"
triggerEvent("aAdmin", source, "sync", "aclobjects", arg[2])
triggerEvent("aAdmin", client, "sync", "aclobjects", arg[2])
end
elseif (arg[1] == "right") then
local acl = aclGet(arg[2])
Expand All @@ -387,14 +387,14 @@ function moo()
outputChatBox(
"Error - object '" ..
tostring(object) .. "' does not exist in group '" .. tostring(arg[2]) .. "'",
source,
client,
255,
0,
0
)
else
mdata2 = "Object '" .. arg[3] .. "'"
triggerEvent("aAdmin", source, "sync", "aclobjects", arg[2])
triggerEvent("aAdmin", client, "sync", "aclobjects", arg[2])
end
elseif (arg[1] == "acl") then
local group = aclGetGroup(arg[2])
Expand All @@ -403,14 +403,14 @@ function moo()
action = nil
outputChatBox(
"Error - ACL '" .. tostring(arg[3]) .. "' does not exist in group '" .. tostring(arg[2]) .. "'",
source,
client,
255,
0,
0
)
else
mdata2 = "ACL '" .. arg[3] .. "'"
triggerEvent("aAdmin", source, "sync", "aclobjects", arg[2])
triggerEvent("aAdmin", client, "sync", "aclobjects", arg[2])
end
elseif (arg[1] == "right") then
local acl = aclGet(arg[2])
Expand All @@ -419,22 +419,22 @@ function moo()
action = nil
outputChatBox(
"Error - right '" .. tostring(arg[3]) .. "' does not exist in ACL '" .. tostring(arg[2]) .. "'",
source,
client,
255,
0,
0
)
else
mdata = "ACL '" .. arg[2] .. "'"
mdata2 = "Right '" .. arg[3] .. "'"
triggerEvent("aAdmin", source, "sync", "aclrights", arg[2])
triggerEvent("aAdmin", client, "sync", "aclrights", arg[2])
end
end
else
action = nil
end
end
if (action ~= nil) then
aAction("admin", action, source, false, mdata, mdata2)
aAction("admin", action, client, false, mdata, mdata2)
end
end
Loading