Skip to content

Commit

Permalink
admin2: Replacing checkboxes with a gridlist for glitches and special…
Browse files Browse the repository at this point in the history
… world properties (#468)
  • Loading branch information
FileEX committed Apr 3, 2024
1 parent a08acd6 commit 1dcb295
Showing 1 changed file with 57 additions and 33 deletions.
90 changes: 57 additions & 33 deletions [admin]/admin2/client/main/admin_server.lua
Expand Up @@ -33,7 +33,9 @@ aServerTab = {
UnderWorldWarp = 'Under World Warp',
VehiclesSunGlare = "Vehicles Sun Glare",
CoronaZTest = "Corona Z Test",
WaterCreatures = "Water Creatures"
WaterCreatures = "Water Creatures",
BurnFlippedCars = "Burn Flipped Cars",
FireBallDestruct = "Fire Ball Destruct"
}
}
Expand Down Expand Up @@ -126,24 +128,30 @@ function aServerTab.Create(tab)
guiSetEnabled(aServerTab.IdleKicker, false)
guiSetEnabled(aServerTab.IdleKickerSet, false)
guiCreateHeader(0.65, 0.015, 0.30, 0.035, "Allowed glitches:", true, tab)
local i = 1
guiCreateHeader(0.62, 0.015, 0.30, 0.035, "Glitches & Special world properties:", true, tab)
aServerTab.Glitches_Properties = guiCreateGridList(0.62, 0.06, 0.37, 0.87, true, tab)
guiGridListAddColumn(aServerTab.Glitches_Properties, "Name", 0.8)
guiGridListAddColumn(aServerTab.Glitches_Properties, "Enabled", 0.3)
guiGridListSetItemText(aServerTab.Glitches_Properties, guiGridListAddRow(aServerTab.Glitches_Properties), 1, "Glitches", true, false)
for k,v in pairs(aServerTab.glitches) do
aServerTab[k] = guiCreateCheckBox(0.66, 0.015 + (0.045 * i), 0.40, 0.04, v, false, true, tab, "setglitch")
guiSetEnabled(aServerTab[k], true)
i = i + 1
aServerTab[k] = guiGridListAddRow(aServerTab.Glitches_Properties)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab[k], 1, v, false, false)
guiGridListSetItemData(aServerTab.Glitches_Properties, aServerTab[k], 1, {'setglitch',k:lower()})
end
local headerPosition = 0.025 + (0.045 * i)
guiCreateHeader(0.65, headerPosition, 0.30, 0.035, "Special world properties:", true, tab)
local i2 = 1
guiGridListSetItemText(aServerTab.Glitches_Properties, guiGridListAddRow(aServerTab.Glitches_Properties), 1, "Special world properties", true, false)
for k,v in pairs(aServerTab.worldproperties) do
aServerTab[k] = guiCreateCheckBox(0.66, headerPosition + (0.0375 * i2), 0.40, 0.04, v, false, true, tab, 'setworldproperty')
guiSetEnabled(aServerTab[k], true)
i2 = i2 + 1
aServerTab[k] = guiGridListAddRow(aServerTab.Glitches_Properties)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab[k], 1, v, false, false)
guiGridListSetItemData(aServerTab.Glitches_Properties, aServerTab[k], 1, {'setworldproperty',k:lower()})
end
addEventHandler("onClientGUIClick", aServerTab.Tab, aServerTab.onClientClick)
addEventHandler("onClientGUIDoubleClick", aServerTab.Glitches_Properties, aServerTab.onClientDoubleClick, false)
addEventHandler('onClientGUIChanged', aServerTab.Tab, aServerTab.onClientChanged)
addEventHandler(EVENT_SYNC, root, aServerTab.onClientSync)
addEventHandler("onAdminRefresh", aServerTab.Tab, aServerTab.onRefresh)
Expand Down Expand Up @@ -451,6 +459,19 @@ function aServerTab.onClientClick(button)
end
end
function aServerTab.onClientDoubleClick(button)
if (button == "left") then
local selectedRow = guiGridListGetSelectedItem(aServerTab.Glitches_Properties)
if (selectedRow ~= -1) then
local rowData = guiGridListGetItemData(aServerTab.Glitches_Properties, selectedRow, 1)
if (rowData) then
local isEnabled = guiGridListGetItemText(aServerTab.Glitches_Properties, selectedRow, 2) == "√"
triggerServerEvent("aServer", localPlayer, rowData[1], rowData[2], iif(not isEnabled, "on", "off"))
end
end
end
end
function aServerTab.onClientChanged()
local actualText = guiGetText(source)
local character = actualText:sub(#actualText, #actualText)
Expand Down Expand Up @@ -487,33 +508,36 @@ function aServerTab.onRefresh()
guiSetText(aServerTab.HeatHazeCurrent, "Heat Haze Level: " .. getHeatHaze())
guiSetText(aServerTab.WavesCurrent, "Wave Height: " .. getWaveHeight())
guiSetText(aServerTab.FPSCurrent, "FPS Limit: " .. getFPSLimit())
guiCheckBoxSetSelected(aServerTab.HoverCars, isWorldSpecialPropertyEnabled("hovercars"))
guiCheckBoxSetSelected(aServerTab.AirCars, isWorldSpecialPropertyEnabled("aircars"))
guiCheckBoxSetSelected(aServerTab.ExtraBunny, isWorldSpecialPropertyEnabled("extrabunny"))
guiCheckBoxSetSelected(aServerTab.ExtraJump, isWorldSpecialPropertyEnabled("extrajump"))
guiCheckBoxSetSelected(aServerTab.RandomFoliage, isWorldSpecialPropertyEnabled("randomfoliage"))
guiCheckBoxSetSelected(aServerTab.SniperMoon, isWorldSpecialPropertyEnabled("snipermoon"))
guiCheckBoxSetSelected(aServerTab.ExtraAirResistance, isWorldSpecialPropertyEnabled("extraairresistance"))
guiCheckBoxSetSelected(aServerTab.UnderWorldWarp, isWorldSpecialPropertyEnabled("underworldwarp"))
guiCheckBoxSetSelected(aServerTab.VehiclesSunGlare, isWorldSpecialPropertyEnabled("vehiclesunglare"))
guiCheckBoxSetSelected(aServerTab.CoronaZTest, isWorldSpecialPropertyEnabled("coronaztest"))
guiCheckBoxSetSelected(aServerTab.WaterCreatures, isWorldSpecialPropertyEnabled("watercreatures"))
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.HoverCars, 2, isWorldSpecialPropertyEnabled("hovercars") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.AirCars, 2, isWorldSpecialPropertyEnabled("AirCars") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.ExtraBunny, 2, isWorldSpecialPropertyEnabled("extrabunny") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.ExtraJump, 2, isWorldSpecialPropertyEnabled("extrajump") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.RandomFoliage, 2, isWorldSpecialPropertyEnabled("randomfoliage") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.SniperMoon, 2, isWorldSpecialPropertyEnabled("snipermoon") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.ExtraAirResistance, 2, isWorldSpecialPropertyEnabled("extraairresistance") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.UnderWorldWarp, 2, isWorldSpecialPropertyEnabled("underworldwarp") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.VehiclesSunGlare, 2, isWorldSpecialPropertyEnabled("vehiclesunglare") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.CoronaZTest, 2, isWorldSpecialPropertyEnabled("coronaztest") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.WaterCreatures, 2, isWorldSpecialPropertyEnabled("watercreatures") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.BurnFlippedCars, 2, isWorldSpecialPropertyEnabled("burnflippedcars") and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.FireBallDestruct, 2, isWorldSpecialPropertyEnabled("fireballdestruct") and "√" or "", false, false)
triggerServerEvent("aServerGlitchRefresh", localPlayer)
end
addEvent("aClientRefresh", true)
addEventHandler("aClientRefresh", localPlayer, function(quickreload, fastmove, fastfire, crouchbug, highcloserangedamage, hitanim, fastsprint, baddrivebyhitbox, quickstand, kickout)
guiCheckBoxSetSelected(aServerTab.QuickReload, quickreload)
guiCheckBoxSetSelected(aServerTab.FastMove, fastmove)
guiCheckBoxSetSelected(aServerTab.FastFire, fastfire)
guiCheckBoxSetSelected(aServerTab.CrouchBug, crouchbug)
guiCheckBoxSetSelected(aServerTab.HighCloseRangeDamage, highcloserangedamage)
guiCheckBoxSetSelected(aServerTab.HitAnim, hitanim)
guiCheckBoxSetSelected(aServerTab.FastSprint, fastsprint)
guiCheckBoxSetSelected(aServerTab.BadDrivebyHitBox, baddrivebyhitbox)
guiCheckBoxSetSelected(aServerTab.QuickStand, quickstand)
guiCheckBoxSetSelected(aServerTab.KickoutOfVehicle_OnModelReplace, kickout)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.QuickReload, 2, quickreload and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.FastMove, 2, fastmove and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.FastFire, 2, fastfire and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.CrouchBug, 2, crouchbug and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.HighCloseRangeDamage, 2, highcloserangedamage and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.HitAnim, 2, hitanim and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.FastSprint, 2, fastsprint and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.BadDrivebyHitBox, 2, baddrivebyhitbox and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.QuickStand, 2, quickstand and "√" or "", false, false)
guiGridListSetItemText(aServerTab.Glitches_Properties, aServerTab.KickoutOfVehicle_OnModelReplace, 2, kickout and "√" or "", false, false)
end)
function getWeatherNameFromID(weather)
Expand Down

0 comments on commit 1dcb295

Please sign in to comment.