• AFK/Full Time Spectate [DEATHRUN (Mr. Gash)]
    1 replies, posted
I have developed a small plugin that runs simply to place a player on a spectator team. Due to me being a newbie i need some help (SUPRISE) I need a string/function that kills the player places them back on the AFK team specified below. I am aware scripts exist for this, I simply am unable to locate them! [CODE]team.SetUp( 5, "AFK", Color( 255, 255, 102 ) ) ------------------------------------------------------------------------------------------------ local CATEGORY_NAME = "Fobro's Custom" function ulx.fafk( calling_ply, target_ply) target_ply:SetTeam(TEAM_AFK) ulx.fancyLogAdmin ( calling_ply, true, "#A AFK'ed #T", target_ply ) end local fafk = ulx.command( CATEGORY_NAME, "ulx fafk", ulx.fafk, "!afk", true) fafk:addParam{ type=ULib.cmds.PlayerArg} fafk:defaultAccess( ULib.ACCESS_ADMIN ) fafk:help("AFK A PLAYER") ------------------------------------------------------------------------------------------------ local CATEGORY_NAME = "Fobro's Custom" function ulx.unfafk( calling_ply, target_ply) target_ply:SetTeam(TEAM_RUNNER) target_ply:Spawn() ulx.fancyLogAdmin ( calling_ply, true, "#A AFK'ed #T", target_ply ) end local unfafk = ulx.command( CATEGORY_NAME, "ulx unfafk", ulx.unfafk, "!unafk", true) unfafk:addParam{ type=ULib.cmds.PlayerArg} unfafk:defaultAccess( ULib.ACCESS_ADMIN ) unfafk:help("AFK A PLAYER")[/CODE]
I think you're going the wrong way here, Deathrun already has a spectator team, and killing a player in the beginning of each round is definitely not wise. Instead, assign a variable to the player (e.g. [B]target_ply.afk = true[/B]). Then, once the teams are assigned to the players, check to see if the player is afk, and if so set him to be a spectator. You can do this in lines 37-40 (Inside the loop before anything else) of deathrun/gamemode/sv_round.lua
Sorry, you need to Log In to post a reply to this thread.