• Admin Tools - Moving a player to the other team (how?)
    11 replies, posted
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!! :)
This is a simple script for swapping teams in PropHunt. Put the file below into [B]'/garrysmod/addons/ulx/lua/ulx/modules/sh/'[/B] and restart server. [URL="https://www.dropbox.com/s/7t1i6j6emo3lofi/prophuntswap.lua"][B]DOWNLOAD HERE[/B][/URL] [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) 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" )[/CODE]
[QUOTE=Shubbler;44850713]This is a simple script for swapping teams in PropHunt. Put the file below into [B]'/garrysmod/addons/ulx/lua/ulx/modules/sh/'[/B] and restart server. [URL="https://www.dropbox.com/s/7t1i6j6emo3lofi/prophuntswap.lua"][B]DOWNLOAD HERE[/B][/URL] [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) 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" )[/CODE][/QUOTE] 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>
[QUOTE=Shubbler;44851286]Hmmm, I didn't test it myself, try !forceswap <name>[/QUOTE] 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>
[QUOTE=freakyy;44851538]No, in the chat. If you want to do it using the console, use ulx forceswap <name>[/QUOTE] Yeah, so: [B]CHAT:[/B] !forceswap [B]CONSOLE:[/B] ulx forceswap
[QUOTE=Shubbler;44851748]Yeah, so: [B]CHAT:[/B] !forceswap [B]CONSOLE:[/B] ulx forceswap[/QUOTE] ahh it works now, awesome, thanks a lot!! :D Is there any way i can get it in the actual menu? Cheers ^^
[QUOTE=TheRA1DER;44852673]ahh it works now, awesome, thanks a lot!! :D Is there any way i can get it in the actual menu? Cheers ^^[/QUOTE] 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]
[QUOTE=Stickly Man!;44854397]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][/QUOTE] What he said :D
thanks guys, really helpful! <3
Sorry, you need to Log In to post a reply to this thread.