Ulysses Stuff > Ulysses Release Archives
AAFK V_3.1 : Anti-AFK system for Garry's Mod
ChaosWolf:
that wasn't my intention, the user in most gamemodes is given the option as to which team to join, if unselected even, their team is considered unassigned.
that's not to rebuttal your point however, I agree completely but I still think its a good idea to first move to spectator then kick, but in contrast its not universal so again, your right. perhaps I should have fully considered that before reinforcing ghost's point.
H3llGhost:
Hum guys, I don't understand your discussion. JamminR you are right, time is limited and finally I am not afraid of touching the code myself. But I am missing a source code repository or similar.
It is an interesting point I never thought that so much game modes have no spectator.
Mates:
Maybe there is some "universal" way to detect whether or not current gamemode supports spectator? Then it could either kick to spectator if so and if it's enabled in the config, or ignore it alltogether and simply kick.
H3llGhost:
--- Quote from: Mates on August 24, 2014, 03:48:19 AM ---Maybe there is some "universal" way to detect whether or not current gamemode supports spectator? Then it could either kick to spectator if so and if it's enabled in the config, or ignore it alltogether and simply kick.
--- End quote ---
There is no universal way to detect something like that.
H3llGhost:
So in the meanwhile I have written a small "detection" how I would handle the spectator thing:
--- Code: ---if ( GetConVarNumber( "ulx_afk_spectator_allowed" ) ) and pl.afkc >= GetConVarNumber( "ulx_afk_specminutes" ) then
if pl.spec == false then
pl.spec = true
pl.afkc = 0
hook.Run( "UlxAfkMoveToSpectator", pl )
end
end
--- End code ---
There is a new flag added to the player table to prevent duplicate moving to spectator.
A hook Run for the move logic. It is missing a check if there is a hook available otherwise disable move to spectator mode.
Perhaps it would be better to use hook.call but I don't know the differences yet.
Here a simple implementation of a hook using TTT commands:
--- Code: ---//THIS MODULE ONLY WORKS WITH TTT
if GAMEMODE.Name = "Trouble in Terrorist Town" then
function ulx.AFKMove_to_Spectator_TTT( pl )
if pl.afk == false then return end
if not IsValid( pl ) then return end
if not pl:IsConnected() then return end
ulx.ResetAFKStatus( pl )
ULib.consoleCommand( "ulx fspec " .. pl.name )
end
hook.Add("UlxAfkMoveToSpectator", "AFKMove_to_Spectator_TTT", ulx.AFKMove_to_Spectator_TTT)
end
--- End code ---
It is not tested at all, but in general I think it is a good start. :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version