[ULX] ForceSwap Team PropHunt

This is a simple script for ULX in PropHunt to force players to the other team. This will kill the player and switch them over. All credit goes to Skelet0r (THIS THREAD) for making it. I just changed it to work with PropHunt.

Copy this and save it in an individual lua file, or even better, add this section to e.g the “util.lua” file, so it appears in that category in your ULX menu.
For even bigger noobs than myself, you put this lua file in “/ulx/lua/ulx/modules/sh” or open the util.lua that’s already in there, and paste this.



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


By the way, why can’t i pick the LUA-icon for my thread?

I think you should change the title to Force TeamSwap as you can change the persons team in any team based gamemode!

This will be very useful for deathrun, I wish it didn’t kill them though :stuck_out_tongue:

Thanks. Updated.

You could just remove the “target_ply:Kill()” lines and they won’t die.