Admin Tools - Moving a player to the other team (how?)

Hey everyone, i’m going crazy googling for plugins and addons and server commands and i can’t find a way to move players to the other team.

For example, i have a gmod server where i do some events with subscribers and i’d like to be able to move my friends to my team and the subscribers to the other when we are playing prop hunt.

And i can’t find a way to do so.

So far i tried ULX, assmod, evolve and other that i can’t remember the name, and none give me that option.

I also tried using HLSW to move players from one team to the other, but i don’t have that option there either.

For example in our BF4 server we can move players to any team and squad with “procon”.

Thanks in advance!! :slight_smile:

This is a simple script for swapping teams in PropHunt.

Put the file below into ‘/garrysmod/addons/ulx/lua/ulx/modules/sh/’ and restart server.

DOWNLOAD HERE


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)
    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" )

Thanks man, i really appreciate it.

I download it but it seems that i can’t bring up that menu, once in the server, i bring up the ulx menu, but i dont see the swap option there :\

Hmmm, I didn’t test it myself, try !forceswap <name>

Unknown command: !forceswap

(need to type it in the console, right?)

No, in the chat.
If you want to do it using the console, use ulx forceswap <name>

Yeah, so:

CHAT: !forceswap

CONSOLE: ulx forceswap

ahh it works now, awesome, thanks a lot!! :smiley:

Is there any way i can get it in the actual menu?

Cheers ^^

I believe ULX has a VGUI file for adding commands to the menu.

Properly registered ULX commands will automatically show up in XGUI on the commands tab. The CATEGORY_NAME bit in the code above is not defined, so the command should show up under the “Uncategorized” category.

If you want to specify a category, change line 12 to something like this:
[lua]local forceswap = ulx.command( “Prophunt”, “ulx forceswap”, ulx.forceswap, “!forceswap” )[/lua]

What he said :smiley:

thanks guys, really helpful! <3