Revision Difference
any#549851
-- Delay in seconds before the nemesis event starts⤶
local delayInSeconds = 3⤶
⤶
-- Duration of the nemesis event in seconds⤶
local eventDurationInSeconds = 180⤶
⤶
-- Command to trigger the nemesis event⤶
local nemesisCommand = "!nemesis"⤶
⤶
-- Team name for the nemesis⤶
local nemesisTeamName = "Nemesis"⤶
⤶
-- Job name for the default/citizen job⤶
local citizenJobName = "Citizen"⤶
⤶
-- Hook function when a player sends a chat message⤶
local function PlayerSay(ply, text, teamChat)⤶
if string.lower(text) == nemesisCommand then⤶
-- Display the notification instantly⤶
ply:ChatPrint("You will become the nemesis soon!")⤶
⤶
-- Delay the nemesis event⤶
timer.Simple(delayInSeconds, function()⤶
-- Get all players⤶
local players = player.GetAll()⤶
⤶
-- Randomly choose a player to be the nemesis⤶
local nemesis = table.Random(players)⤶
⤶
-- Kill the player who becomes the nemesis⤶
nemesis:Kill()⤶
⤶
-- Use ULX to set the team of the nemesis⤶
ulx.fancyLogAdmin(ply, "#A changed the team of #T to " .. nemesisTeamName, { nemesis })⤶
RunConsoleCommand("ulx", "setteam", nemesis:SteamID(), nemesisTeamName)⤶
⤶
-- Send a chat notification to the nemesis⤶
nemesis:ChatPrint("You are now the Nemesis, hunt them down!")⤶
⤶
-- Set a timer to end the nemesis event⤶
timer.Simple(eventDurationInSeconds, function()⤶
-- Change the team of the nemesis back to "Citizen"⤶
ulx.fancyLogAdmin(ply, "#A changed the team of #T to " .. citizenJobName, { nemesis })⤶
RunConsoleCommand("ulx", "setteam", nemesis:SteamID(), citizenJobName)⤶
end)⤶
end)⤶
end⤶
end⤶
hook.Add("PlayerSay", "NemesisEvent", PlayerSay)⤶
<cat>Dev.Lua</cat>⤶
<title>any</title>⤶
⤶
The <page>any</page> keyword is not a type, because it represents all types that are not <page>nil</page>.⤶
⤶
In order to determine any, you can use the following code:⤶
⤶
```lua⤶
local isAny = type(x) ~= "nil"⤶
```⤶