I’m using the ulx AAFK script and I’m trying to make it move the player to spectate once they are flagged as afk. This is the part that flags them as afk:
if pl.afkc >= GetConVarNumber( "ulx_afk_flagminutes" ) then if pl.afk == false then pl.afk = true ulx.fancyLogAdmin( pl, "#A went AFK!" ) ULib.tsayColor(_, Color(0,0,0,255), "[AAFK] ", team.GetColor(pl:Team()), pl:Nick(), Color(255,255,255), " went ", Color(255,0,0,255), "AFK.") end end
In the murderer game mode it uses a concommand “mu_movetospectate” to move the player to spectate. So I tried to use that command inside the aafk script, but it’s not working:
if pl:Alive() && pl.afk == true then RunConsoleCommand("mu_movetospectate", pl:EntIndex()) end
is this structure all wrong? Am I calling the right things?