Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 committed Jun 19, 2024
2 parents f367e49 + fa5beb9 commit 680d13d
Show file tree
Hide file tree
Showing 11 changed files with 485 additions and 333 deletions.
56 changes: 38 additions & 18 deletions [admin]/admin/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,46 @@
desc="Duration options for the mute window. Comma seperated list in seconds. 0 means no duration limit."
/>

<setting name="*securitylevel" value="2"
friendlyname="Security level"
group="_Advanced"
accept="0-2"
desc="Detect fake admin packets. 0-No checks 1-Some checks 2-All checks."
/>

<setting name="*clientcheckban" value="false"
friendlyname="clientcheckban"
group="_Advanced"
accept="true,false"
desc="Ban IP's that attempt to send fake admin packets."
/>

<setting name="*useip2c" value="true"
friendlyname="useip2c"
group="_Advanced"
accept="true,false"
desc="When enabled, admin will use the ip2c resource to determine players' countries by their IP."
/>

<setting name="*fakePacketsIPban" value="false"
friendlyname="IPBan"
group="_fake packets"
accept="true,false"
desc="Ban IPs that attempt to send fake admin packets."
/>

<setting name="*fakePacketsSerialban" value="false"
friendlyname="Serialban"
group="_fake packets"
accept="true,false"
desc="Ban serials that attempt to send fake admin packets."
/>

<setting name="*fakePacketsIPbanLength" value="86400"
friendlyname="IPBan length"
group="_fake packets"
desc="Set ban length for IPBan in seconds. Set to 0 for a permanent ban."
/>

<setting name="*fakePacketsSerialbanLength" value="86400"
friendlyname="Serialban length"
group="_fake packets"
desc="Set ban length for Serialban in seconds. Set to 0 for a permanent ban."
/>

<setting name="*securitylevel" value="2"
friendlyname="Security level"
group="_fake packets"
accept="0-2"
desc="Detect fake admin packets. 0-No checks 1-Some checks 2-All checks."
/>

<setting name="*maxchatmsgs" value="10"
friendlyname="Max chat log messages"
accept="1-1000"
Expand All @@ -178,10 +197,11 @@
friendlyname="Player report categories"
desc="List of report categories for reporting players."
/>
<setting name="*adminChatCommandName" value="a"
friendlyname="Admin chat command name"
desc="The command name for admin chat."
/>

<setting name="*adminChatCommandName" value="a"
friendlyname="Admin chat command name"
desc="The command name for admin chat."
/>

</settings>
</meta>
10 changes: 7 additions & 3 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1672,11 +1672,15 @@ function checkClient(checkAccess,player,...)
if client and client ~= player then
local desc = table.concat({...}," ")
local ipAddress = getPlayerIP(client)
local playerSerial = getPlayerSerial(client)
local banReason = "admin checkClient (" .. tostring(desc) .. ")"
outputDebugString( "Admin security - Client/player mismatch from " .. tostring(ipAddress) .. " (" .. tostring(desc) .. ")", 1 )
cancelEvent()
if g_Prefs.clientcheckban then
local reason = "admin checkClient (" .. tostring(desc) .. ")"
addBan ( ipAddress, nil, nil, root, reason )
if g_Prefs.fakePacketsIPban then
addBan ( ipAddress, nil, nil, root, banReason, g_Prefs.fakePacketsIPbanLength )
end
if g_Prefs.fakePacketsSerialban then
addBan ( nil, nil, playerSerial, root, banReason, g_Prefs.fakePacketsSerialbanLength )
end
return true
end
Expand Down
15 changes: 9 additions & 6 deletions [admin]/admin/server/admin_serverprefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
---------------------------------------------------------------------------
function cachePrefs()
g_Prefs = {}
g_Prefs.maxmsgs = getNumber('maxmsgs',99)
g_Prefs.bandurations = getString('bandurations','60,3600,43200,0')
g_Prefs.mutedurations = getString('mutedurations','60,120,300,600,0')
g_Prefs.maxmsgs = getNumber('maxmsgs',99)
g_Prefs.bandurations = getString('bandurations','60,3600,43200,0')
g_Prefs.mutedurations = getString('mutedurations','60,120,300,600,0')
g_Prefs.reportCategories = getString('reportCategories','Question,Suggestion,Other')
g_Prefs.playerReportCategories = getString('playerReportCategories','Cheater/Modder,Spammer')
g_Prefs.clientcheckban = getBool('clientcheckban',false)
g_Prefs.securitylevel = getNumber('securitylevel',2)
g_Prefs.maxchatmsgs = getNumber('maxchatmsgs',10)
g_Prefs.fakePacketsIPban = getBool('fakePacketsIPban',false)
g_Prefs.fakePacketsSerialban = getBool('fakePacketsSerialban',false)
g_Prefs.fakePacketsIPbanLength = getNumber('fakePacketsIPbanLength',86400)
g_Prefs.fakePacketsSerialbanLength = getNumber('fakePacketsSerialbanLength',86400)
g_Prefs.securitylevel = getNumber('securitylevel',2)
g_Prefs.maxchatmsgs = getNumber('maxchatmsgs',10)
triggerClientEvent( root, "onClientUpdatePrefs", resourceRoot, g_Prefs )
end

Expand Down
50 changes: 50 additions & 0 deletions [gamemodes]/[fallout]/fallout/board_s.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
local activeBoards = {}

function createBoards()
local rows, columns = config.boardRows, config.boardColumns
--Create boards. Platform #1 is at SW Corner
for i = 1, rows do --Nested to create rows and columns
for j = 1, columns do
activeBoards[#activeBoards + 1] = createObject(1697, 1540.122926 + 4.466064 * j, -1317.568237 + 5.362793 * i, 603.105469, math.deg(0.555), 0, 0)
end
end
setElementDoubleSided(resourceRoot, true)
end

--- Returns active board elements
function getActiveBoardElements()
return activeBoards
end

--- Returns active board element count
function getActiveBoardElementCount()
return #activeBoards
end

function disableBoard(board)
for i = 1, #activeBoards do
if activeBoards[i] == board then
table.remove(activeBoards, i)
break
end
end
end

--- Returns a random board from the activeBoards table
function getRandomActiveBoard ()
return activeBoards[math.random(#activeBoards)]
end

--- Resets the activeBoards table
function resetActiveBoards ()
for i = #activeBoards, 1, -1 do
table.remove(activeBoards, i)
end
end

--- Destroy all board elements
function destroyBoards ()
for k, v in ipairs(getElementsByType("object", resourceRoot)) do
destroyElement(v)
end
end
10 changes: 10 additions & 0 deletions [gamemodes]/[fallout]/fallout/config_s.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
config = {
boardRows = get("boardRows"), --Default:10 Number of rows to put on the board
boardColumns = get("boardColumns"), --Default:8 Number of columns to put on the board
winningBoards = get("winningBoards"), --Default:3 Number of boards that will not fall. Must be higher than board count!
scoreLimit = get("scoreLimit"), --Default:10 wins required to win the fallout tournament default is 10
callSpeedA = get("callSpeedA"), --Default:250 Call speed when 30 or more boards exist
callSpeedB = get("callSpeedB"), --Default:500 Call speed when 29 to 15 boards exist
callSpeedC = get("callSpeedC"), --Default:750 Call speed when 14 or less boards exist
peacefulMode = get("peacefulMode") == "true" -- Default:true Disable player melee attack
}
31 changes: 31 additions & 0 deletions [gamemodes]/[fallout]/fallout/displays_s.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
textDisplays = {}
textItems = {}

textDisplays.countDownDisplay = textCreateDisplay()
textItems.countDownText = textCreateTextItem("", 0.5, 0.3, "high", 255, 127, 0, 255, 2, "center")
textDisplayAddText(textDisplays.countDownDisplay, textItems.countDownText)

textDisplays.suicideDisplay = textCreateDisplay()
local suicideText = textCreateTextItem("You lose! Press space for a quick death.", 0.5, 0.5, "low", 255, 127, 0, 255, 2, "center")
textDisplayAddText(textDisplays.suicideDisplay, suicideText)

textDisplays.winnersDisplay = textCreateDisplay()
textItems.winnersText = textCreateTextItem("Winners:", 0.5, 0.35, "low", 255, 127, 0, 255, 2, "center", "center")
textDisplayAddText(textDisplays.winnersDisplay, textItems.winnersText)

textDisplays.spectatorCamDisplay = textCreateDisplay()
textItems.specCamText = textCreateTextItem("Use your player movement keys to move the spectator camera.\nUse your sprint key to speed the camera up.", 0.5, 0.22, "low", 255, 127, 0, 255, 1.3, "center")
textDisplayAddText(textDisplays.spectatorCamDisplay, textItems.specCamText)

textDisplays.podiumDisplay = textCreateDisplay()

textItems.firstText = textCreateTextItem("1st:", 0.45, 0.08, "high", 255, 127, 0, 255, 1.5)
textItems.secondText = textCreateTextItem("2nd:", 0.45, 0.12, "high", 255, 127, 0, 255, 1.5)
textItems.thirdText = textCreateTextItem("3rd:", 0.45, 0.16, "high", 255, 127, 0, 255, 1.5)

-- Tournament text
textDisplayAddText(textDisplays.podiumDisplay, textCreateTextItem("Tournament Leaders", 0.45, 0.04, "high", 255, 127, 0, 255, 1.5))

textDisplayAddText(textDisplays.podiumDisplay, textItems.firstText)
textDisplayAddText(textDisplays.podiumDisplay, textItems.secondText)
textDisplayAddText(textDisplays.podiumDisplay, textItems.thirdText)
79 changes: 27 additions & 52 deletions [gamemodes]/[fallout]/fallout/fallout_c.lua
Original file line number Diff line number Diff line change
@@ -1,59 +1,34 @@
fadeCamera(true)
gameOver = false
local shakeState = false
local shakingPieces = {}

function initGame()
triggerServerEvent("serverClientLoad", root)
end
addEventHandler("onClientResourceStart", resourceRoot, initGame, false)

function shakeOnRender()
if gameOver == false then
local currentTick = getTickCount()
for object, originalTick in pairs(shakingPieces) do
local tickDifference = currentTick - originalTick
if tickDifference > 2400 then
shakingPieces[object] = nil
else
--since newx/newy increases by 1 every 125ms, we can use this ratio to calculate a more accurate time
local newx = tickDifference / 125 * 1
local newy = tickDifference / 125 * 1
if isElement(object) then
setElementRotation(object, math.deg(0.555), 3 * math.cos(newy + 1), 3 * math.sin(newx + 1))
end
end
end
end
end
addEventHandler("onClientRender", root, shakeOnRender)

function ShakePieces(fallingPiece)
--we store the time when the piece was told to shake under a table, so multiple objects can be stored
shakingPieces[fallingPiece] = getTickCount()
local currentTick = getTickCount()
for object, originalTick in pairs(shakingPieces) do
local tickDifference = currentTick - originalTick
if tickDifference > 2400 or not isElement(object) then
shakingPieces[object] = nil
else
--since newx/newy increases by 1 every 125ms, we can use this ratio to calculate a more accurate time
local newx = tickDifference / 125 * 1
local newy = tickDifference / 125 * 1
setElementRotation(object, math.deg(0.555), 3 * math.cos(newy + 1), 3 * math.sin(newx + 1))
end
end
if not next(shakingPieces) and shakeState then
removeEventHandler("onClientRender", root, shakeOnRender)
shakeState = false
end
end
addEvent("clientShakePieces", true)
addEventHandler("clientShakePieces", root, ShakePieces)

function DetectionOff(fallingPiece)
checkStatusTimer = nil
gameOver = true
end
addEvent("lossDetectionOff", true)
addEventHandler("lossDetectionOff", root, DetectionOff)

function checkStatusB()
local x, y, z = getElementPosition(localPlayer)
if z < 595 and (checkStatusTimer) then
triggerServerEvent("serverReportLoss", localPlayer)
playSoundFrontEnd(4)
killTimer(checkStatusTimer)
checkStatusTimer = nil
end
end

function checkStatus()
gameOver = false
checkStatusTimer = setTimer(checkStatusB, 500, 0)
end
addEvent("clientCheckStatus", true)
addEventHandler("clientCheckStatus", root, checkStatus)
addEvent("onClientShakePieces", true)
addEventHandler("onClientShakePieces", resourceRoot,
function ()
-- we store the time when the piece was told to shake under a table, so multiple objects can be stored
shakingPieces[source] = getTickCount()
if not shakeState then
addEventHandler("onClientRender", root, shakeOnRender)
shakeState = true
end
end, true)
Loading

0 comments on commit 680d13d

Please sign in to comment.