Repository navigation
restrict palm city buttons to admin only - #13
Merged
Merged
Conversation
plally
marked this pull request as draft
October 14, 2026 16:47
hook.Add("InitPostEntity", "BlockPalmCityButtons", function()
if game.GetMap() ~= "gm_palm_city" then return end
local function CanPlayerPressButton(ply, button)
-- cami here instead of ply:IsAdmin()?
return ply:IsAdmin()
end
local ButtonToNiceName = {
-- according to mapcreationid
[7706] = "Track1",
[7707] = "Track2",
[7708] = "Track3",
[7709] = "Track4",
[7710] = "Track5",
[7743] = "Track6",
[7737] = "Track1",
[7738] = "Track2",
[7739] = "Track3",
[7740] = "Track4",
[7741] = "Track5",
[7748] = "Track6",
[7773] = "Track1",
[7774] = "Track2",
[7775] = "Track3",
[7776] = "Track4",
[7777] = "Track5",
[7793] = "Track6",
[7790] = "Track1",
[7791] = "Track2",
[7792] = "Track3",
[7818] = "Track1",
[7819] = "Track2",
[7820] = "Track3",
[7821] = "Track4",
[7822] = "Track5",
[7838] = "Track6",
[7835] = "Track1",
[7836] = "Track2",
[7837] = "Track3",
[7716] = "Racemode"
}
-- other buttons:
--[[
[2748] = "Garage door", -- -12293.000000 95.000000 210.000000
[7843] = "StartRaceCanals" -- 1360.000000 -5328.000000 20.000000
[7848] = "StopRaceCanals" -- 1040.000000 -4768.000000 432.000000
for _, ent in ipairs(ents.FindByClass("func_button")) do
if not ButtonToNiceName[ent:MapCreationID()] then print(ent:GetPos()) end
end
--]]
hook.Add("AcceptInput", "BlockPalmCityButtons", function(ent, input, _, caller)
if ent:GetClass() ~= "func_button" then return end
if input ~= "Use" then return end
local MapCreationId = ent:MapCreationID()
--print("[" .. MapCreationId .. "]" .. " = \"Track1\",")
if CanPlayerPressButton(caller, ent) == false then --
return true
elseif ButtonToNiceName[MapCreationId] then
-- this should have a delay on it to prevent spamming chat
PrintMessage(HUD_PRINTTALK, caller:Nick() .. " pressed the " .. ButtonToNiceName[MapCreationId] .. " button")
end
end)
end) |
plally
marked this pull request as ready for review
October 25, 2026 20:11
Restrict race control usage to admins only if entity is above a certain height.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.