Skip to content

Admin, editor: add glitches and worldspecialproperties, fix lint error #646

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
150 changes: 150 additions & 0 deletions [admin]/admin/client/gui/admin_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ aPlayers = {}
aBans = {}
aLastSync = 0
aResources = {}
glitchesData = {}
worldPropsData = {}

local serverPassword = 'None'
local hasResourceSetting
Expand Down Expand Up @@ -270,6 +272,80 @@ y=y+B aTab1.VehicleHealth = guiCreateLabel ( 0.26, y, 0.25, 0.04, "Vehicle Heal
aTab3.FPS = guiCreateEdit ( 0.35, 0.65, 0.135, 0.04, "38", true, aTab3.Tab )
aTab3.FPSSet = guiCreateButton ( 0.50, 0.65, 0.10, 0.04, "Set", true, aTab3.Tab, "setfpslimit" )
guiCreateLabel ( 0.63, 0.65, 0.1, 0.04, "( 25-32767 )", true, aTab3.Tab )

aTab3.ServerSettingsGridList = guiCreateGridList ( 0.04, 0.70, 0.55, 0.28, true, aTab3.Tab )
guiGridListAddColumn( aTab3.ServerSettingsGridList, "Setting Type", 0.25 )
guiGridListAddColumn( aTab3.ServerSettingsGridList, "Name", 0.45 )
guiGridListAddColumn( aTab3.ServerSettingsGridList, "Status/Value", 0.2 )
guiGridListSetSortingEnabled( aTab3.ServerSettingsGridList, false )

if not hasPermissionTo("command.setglitchenabled") or not hasPermissionTo("command.setworldspecprop") then
guiSetEnabled(aTab3.ServerSettingsGridList, false)
end

local glitchData = {
{name = "Quick Reload", id = "quickreload"},
{name = "Fast Move", id = "fastmove"},
{name = "Fast Fire", id = "fastfire"},
{name = "Crouch Bug", id = "crouchbug"},
{name = "High Close Range Damage", id = "highcloserangedamage"},
{name = "Hit Animation", id = "hitanim"},
{name = "Fast Sprint", id = "fastsprint"},
{name = "Bad Driveby Hitbox", id = "baddrivebyhitbox"},
{name = "Quick Stand", id = "quickstand"},
{name = "Kick Out Vehicle", id = "kickoutofvehicle_onmodelreplace"},
{name = "Vehicle Rapid Stop", id = "vehicle_rapid_stop"}
}

local worldPropData = {
{name = "Hover Cars", id = "hovercars"},
{name = "Air Cars", id = "aircars"},
{name = "Extra Bunny", id = "extrabunny"},
{name = "Extra Jump", id = "extrajump"},
{name = "Random Foliage", id = "randomfoliage"},
{name = "Sniper Moon", id = "snipermoon"},
{name = "Extra Air Resistance", id = "extraairresistance"},
{name = "Underworld Warp", id = "underworldwarp"},
{name = "Vehicle Sun Glare", id = "vehiclesunglare"},
{name = "Corona Z Test", id = "coronaztest"},
{name = "Water Creatures", id = "watercreatures"},
{name = "Burn Flipped Cars", id = "burnflippedcars"},
{name = "Fireball Destruct", id = "fireballdestruct"},
{name = "Road Signs Text", id = "roadsignstext"},
{name = "Extended Water Cannons", id = "extendedwatercannons"},
{name = "Tunnel Weather Blend", id = "tunnelweatherblend"},
{name = "Ignore Fire State", id = "ignorefirestate"},
{name = "Flying Components", id = "flyingcomponents"},
{name = "Vehicle Burn Explosions", id = "vehicleburnexplosions"},
{name = "Vehicle Engine Autostart", id = "vehicle_engine_autostart"}
}

aTab3.ServerSettings = {}

for i, glitch in ipairs(glitchData) do
local row = guiGridListAddRow(aTab3.ServerSettingsGridList)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 1, "Glitch", false, false)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 2, glitch.name, false, false)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 3, "Disabled", false, false)
guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 1, "glitch")
guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 2, glitch.id)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, row, 3, 255, 0, 0)
aTab3.ServerSettings[glitch.id] = {row = row, type = "glitch", enabled = false}
end

for i, prop in ipairs(worldPropData) do
local row = guiGridListAddRow(aTab3.ServerSettingsGridList)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 1, "World Prop", false, false)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 2, prop.name, false, false)
guiGridListSetItemText(aTab3.ServerSettingsGridList, row, 3, "Disabled", false, false)
guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 1, "worldprop")
guiGridListSetItemData(aTab3.ServerSettingsGridList, row, 2, prop.id)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, row, 3, 255, 0, 0)
aTab3.ServerSettings[prop.id] = {row = row, type = "worldprop", enabled = false}
end
aTab3.SettingsReset = guiCreateButton(0.61, 0.70, 0.15, 0.04, "Reset All", true, aTab3.Tab, "setglitchenabled")
aTab3.SettingsEnableAll = guiCreateButton(0.61, 0.75, 0.15, 0.04, "Enable All", true, aTab3.Tab, "setglitchenabled")
aTab3.SettingsDisableAll = guiCreateButton(0.61, 0.80, 0.15, 0.04, "Disable All", true, aTab3.Tab, "setglitchenabled")


aTab4 = {}
Expand Down Expand Up @@ -592,6 +668,19 @@ function aClientSync ( type, table, data )
guiSetText ( aTab3.MapName, "Map Name: "..( table["map"] or "None" ) )
guiSetText ( aTab3.FPSCurrent, "FPS Limit: "..( table["fps"] or "N/A" ) )
guiSetText ( aTab3.FPS, table["fps"] or "38" )
if table["glitches"] and table["worldprops"] then
for settingId, gPropData in pairs(aTab3.ServerSettings) do
local enabled = false
if gPropData.type == "glitch" and table["glitches"][settingId] ~= nil then
enabled = table["glitches"][settingId]
elseif gPropData.type == "worldprop" and table["worldprops"][settingId] ~= nil then
enabled = table["worldprops"][settingId]
end
gPropData.enabled = enabled
guiGridListSetItemText(aTab3.ServerSettingsGridList, gPropData.row, 3, enabled and "Enabled" or "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, gPropData.row, 3, enabled and 0 or 255, enabled and 255 or 0, 0)
end
end
elseif ( type == "bansdirty" ) then
g_GotLatestBansList = false
if aAdminForm and guiGetVisible ( aAdminForm ) and guiGetSelectedTab( aTabPanel ) == aTab4.Tab then
Expand Down Expand Up @@ -983,6 +1072,27 @@ function aClientDoubleClick ( button )
local selserial = guiGridListGetItemText ( aTab4.BansList, guiGridListGetSelectedItem( aTab4.BansList ), 3 )
aBanDetails ( aBans["Serial"][selserial] and selserial or selip )
end
elseif ( source == aTab3.ServerSettingsGridList ) then
local selectedRow = guiGridListGetSelectedItem(aTab3.ServerSettingsGridList)
if selectedRow ~= -1 then
local settingType = guiGridListGetItemData(aTab3.ServerSettingsGridList, selectedRow, 1)
local settingId = guiGridListGetItemData(aTab3.ServerSettingsGridList, selectedRow, 2)
if settingType == "glitch" and hasPermissionTo("command.setglitchenabled") then
local currentStatus = aTab3.ServerSettings[settingId].enabled
local newStatus = not currentStatus
aTab3.ServerSettings[settingId].enabled = newStatus
guiGridListSetItemText(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and "Enabled" or "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and 0 or 255, newStatus and 255 or 0, 0)
triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, newStatus)
elseif settingType == "worldprop" and hasPermissionTo("command.setworldspecprop") then
local currentStatus = aTab3.ServerSettings[settingId].enabled
local newStatus = not currentStatus
aTab3.ServerSettings[settingId].enabled = newStatus
guiGridListSetItemText(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and "Enabled" or "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, selectedRow, 3, newStatus and 0 or 255, newStatus and 255 or 0, 0)
triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, newStatus)
end
end
end
end

Expand Down Expand Up @@ -1115,6 +1225,46 @@ function aClientClick ( button )
elseif ( source == aTab3.FPSSet ) then
triggerServerEvent ( "aServer", localPlayer, "setfpslimit", guiGetText ( aTab3.FPS ) )
triggerServerEvent ( "aSync", localPlayer, "server" )
elseif ( source == aTab3.SettingsReset ) then
for settingId, data in pairs(aTab3.ServerSettings) do
if data.type == "glitch" then
local defaultValue = false
data.enabled = defaultValue
guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and "Enabled" or "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and 0 or 255, defaultValue and 255 or 0, 0)
triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, defaultValue)
elseif data.type == "worldprop" then
local defaultValue = false
data.enabled = defaultValue
guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and "Enabled" or "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, defaultValue and 0 or 255, defaultValue and 255 or 0, 0)
triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, defaultValue)
end
end
elseif ( source == aTab3.SettingsEnableAll ) then
for settingId, data in pairs(aTab3.ServerSettings) do
data.enabled = true
guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, "Enabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, 0, 255, 0)

if data.type == "glitch" then
triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, true)
elseif data.type == "worldprop" then
triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, true)
end
end
elseif ( source == aTab3.SettingsDisableAll ) then
for settingId, data in pairs(aTab3.ServerSettings) do
data.enabled = false
guiGridListSetItemText(aTab3.ServerSettingsGridList, data.row, 3, "Disabled", false, false)
guiGridListSetItemColor(aTab3.ServerSettingsGridList, data.row, 3, 255, 0, 0)

if data.type == "glitch" then
triggerServerEvent("aServer", localPlayer, "setglitchenabled", settingId, false)
elseif data.type == "worldprop" then
triggerServerEvent("aServer", localPlayer, "setworldspecprop", settingId, false)
end
end
end
-- TAB 4, BANS
elseif ( getElementParent ( source ) == aTab4.Tab ) then
Expand Down
8 changes: 8 additions & 0 deletions [admin]/admin/conf/ACL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
<right name="command.setfpslimit" access="true" />
<right name="function.shutdown" access="true" />
<right name="command.clearchat" access="true" />
<right name="command.setglitchenabled" access="true" />
<right name="command.setworldspecprop" access="true" />
<!--Bans related-->
<right name="command.ban" access="true" />
<right name="command.unban" access="true" />
Expand Down Expand Up @@ -164,6 +166,8 @@
<right name="command.settime" access="true" />
<right name="command.setfpslimit" access="false" />
<right name="command.clearchat" access="true" />
<right name="command.setglitchenabled" access="false" />
<right name="command.setworldspecprop" access="false" />
<!--Bans related-->
<right name="command.ban" access="true" />
<right name="command.unban" access="true" />
Expand Down Expand Up @@ -250,6 +254,8 @@
<right name="command.settime" access="true" />
<right name="command.setfpslimit" access="false" />
<right name="command.clearchat" access="true" />
<right name="command.setglitchenabled" access="false" />
<right name="command.setworldspecprop" access="false" />
<!--Bans related-->
<right name="command.ban" access="false" />
<right name="command.unban" access="false" />
Expand Down Expand Up @@ -315,6 +321,8 @@
<right name="command.stopall" access="false" />
<right name="command.delete" access="false" />
<right name="command.restart" access="false" />
<right name="command.setglitchenabled" access="false" />
<right name="command.setworldspecprop" access="false" />
<!--ACL Manager related-->
<right name="command.aclmanager" access="false" />
<right name="command.aclcreate" access="false" />
Expand Down
2 changes: 2 additions & 0 deletions [admin]/admin/conf/commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<command handler="setgamespeed" call="setgamespeed" args="i" />
<command handler="setgravity" call="setgravity" args="i" />
<command handler="clearchat" call="clearchat" args="" />
<command handler="setglitchenabled" call="setglitchenabled" args="s,b" />
<command handler="setworldspecprop" call="setworldspecprop" args="s,b" />
</server>
<bans>
<command handler="banip" call="banip" args="s" />
Expand Down
14 changes: 14 additions & 0 deletions [admin]/admin/conf/glitches.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

<glitches>
<glitch name="quickreload" enabled="false" displayname="Quick Reload" />
<glitch name="fastmove" enabled="false" displayname="Fast Move" />
<glitch name="fastfire" enabled="false" displayname="Fast Fire" />
<glitch name="crouchbug" enabled="false" displayname="Crouch Bug" />
<glitch name="highcloserangedamage" enabled="false" displayname="High Close Range Damage" />
<glitch name="hitanim" enabled="false" displayname="Hit Animation" />
<glitch name="fastsprint" enabled="false" displayname="Fast Sprint" />
<glitch name="baddrivebyhitbox" enabled="false" displayname="Bad Driveby Hitbox" />
<glitch name="quickstand" enabled="false" displayname="Quick Stand" />
<glitch name="kickoutofvehicle_onmodelreplace" enabled="false" displayname="Kick Out Vehicle" />
<glitch name="vehicle_rapid_stop" enabled="true" displayname="Vehicle Rapid Stop" />
</glitches>
8 changes: 8 additions & 0 deletions [admin]/admin/conf/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@
<all>FPS limit set to '$data'$by_admin_4all.</all>
<log>ADMIN: $admin has set FPS limit to '$data'</log>
</group>
<group action="setglitchenabled" r="225" g="170" b="90">
<all>$data set to $data2$by_admin_4all.</all>
<log>ADMIN: $admin has set $data to $data2</log>
</group>
<group action="setworldspecprop" r="225" g="170" b="90">
<all>$data set to $data2$by_admin_4all.</all>
<log>ADMIN: $admin has set world special property $data to $data2</log>
</group>
</server>
<bans>

Expand Down
22 changes: 22 additions & 0 deletions [admin]/admin/conf/worldspecialproperties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<worldproperties>
<property name="hovercars" enabled="false" displayname="Hover Cars" />
<property name="aircars" enabled="false" displayname="Air Cars" />
<property name="extrabunny" enabled="false" displayname="Extra Bunny" />
<property name="extrajump" enabled="false" displayname="Extra Jump" />
<property name="randomfoliage" enabled="true" displayname="Random Foliage" />
<property name="snipermoon" enabled="false" displayname="Sniper Moon" />
<property name="extraairresistance" enabled="true" displayname="Extra Air Resistance" />
<property name="underworldwarp" enabled="true" displayname="Underworld Warp" />
<property name="vehiclesunglare" enabled="false" displayname="Vehicle Sun Glare" />
<property name="coronaztest" enabled="true" displayname="Corona Z Test" />
<property name="watercreatures" enabled="true" displayname="Water Creatures" />
<property name="burnflippedcars" enabled="true" displayname="Burn Flipped Cars" />
<property name="fireballdestruct" enabled="true" displayname="Fireball Destruct" />
<property name="roadsignstext" enabled="true" displayname="Road Signs Text" />
<property name="extendedwatercannons" enabled="true" displayname="Extended Water Cannons" />
<property name="tunnelweatherblend" enabled="true" displayname="Tunnel Weather Blend" />
<property name="ignorefirestate" enabled="false" displayname="Ignore Fire State" />
<property name="flyingcomponents" enabled="true" displayname="Flying Components" />
<property name="vehicleburnexplosions" enabled="true" displayname="Vehicle Burn Explosions" />
<property name="vehicle_engine_autostart" enabled="true" displayname="Vehicle Engine Autostart" />
</worldproperties>
2 changes: 2 additions & 0 deletions [admin]/admin/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<config src="conf/upgrades.xml" type="client" />
<config src="conf/skins.xml" type="client" />
<config src="conf/stats.xml" type="client" />
<config src="conf/worldspecialproperties.xml" />
<config src="conf/glitches.xml" />
<config src="conf/messages.xml" />
<config src="conf/commands.xml" />
<config src="conf/web.xml" />
Expand Down
9 changes: 9 additions & 0 deletions [admin]/admin/server/admin_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ function aCommandToArgs ( argv, args )
elseif ( argt == "t" ) then argv[id] = { argv[id] }
elseif ( argt == "s" ) then argv[id] = tostring ( argv[id] )
elseif ( argt == "i" ) then argv[id] = tonumber ( argv[id] )
elseif ( argt == "b" ) then
if type(argv[id]) == "string" then
argv[id] = string.lower(argv[id])
end
if argv[id] == "true" or argv[id] == "1" or argv[id] == "on" or argv[id] == "enable" then
argv[id] = true
elseif argv[id] == "false" or argv[id] == "0" or argv[id] == "off" or argv[id] == "disable" then
argv[id] = false
end
elseif ( argt == "t-" ) then
local atable = {}
for i = id, #argv do table.insert ( atable, argv[id] ) table.remove ( argv, id ) end
Expand Down
Loading