Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change to Forceswap command
#1
This simple change to the ULX Forceswap command allows it to swap people out of unassigned onto a team. I'm not sure why you'd need to do this, but Travis said it would be cool, so I made it.

Download

Code:
function ulx.forceswap( calling_ply, target_ply )
    if target_ply:Team() == TEAM_PROPS then
        target_ply:Kill()
        target_ply:SetTeam(TEAM_HUNTERS)
    elseif target_ply:Team() == TEAM_HUNTERS then
        target_ply:Kill()
        target_ply:SetTeam(TEAM_PROPS)
    elseif target_ply:Team() ~= TEAM_PROPS or TEAM_HUNTERS then
        if team.NumPlayers(TEAM_PROPS) <= team.NumPlayers(TEAM_HUNTERS) then
            target_ply:Kill()
            target_ply:SetTeam(TEAM_PROPS)
        else
            target_ply:Kill()
            target_ply:SetTeam(TEAM_HUNTERS)
        end
    end
    ulx.fancyLogAdmin( calling_ply, "#A has forced #T to switch teams.", target_ply )
end

local forceswap = ulx.command( CATEGORY_NAME, "ulx forceswap", ulx.forceswap, "!forceswap" )
forceswap:defaultAccess( ULib.ACCESS_ADMIN )
forceswap:addParam{ type=ULib.cmds.PlayerArg }
forceswap:help( "Swaps a players team" )

For the record, the original was made by Yeezy Jeezy. I am not a programmer, I stole most of what I added from the gmod wiki and the lua manual.

If wanted, I can change this command to offset the negative kill and death added to the scoreboard.
[Image: horizontal-design-element-3.png]
  Angel I CRAHSED MY CAR
find out more at https://russefarmer.com/
Garry's Mod Performance Tuning Guide
#2
+1
#3
I miss Yeezy, he was cool


Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.