Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

Random team and random class at connect time

by Russo · 2007-05-19 · 18 replies · 8989 views · 49 downloads

Read the thread (19 posts)

From the first post

Hi, i want that players don'd choose team at connect time, server asign team and class.
rn
rnThere is any plugin for this?
rn
rnThx

Added later in the thread

dod_random.sma missing Plugin Source 599 B 25 dl
dod_random.sma Plugin Source 2 KB 24 dl Download Compile

The thread

All 19 posts from 5 people on Random team and random class at connect time, kept as they were written.

R Russo
started this thread
Posts: 3
Threads: 1
Joined: Mar 2005
05-19-2007, 08:21 AM #1

Hi, i want that players don'd choose team at connect time, server asign team and class.rnrnThere is any plugin for this?rnrnThx

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
08-24-2007, 11:50 AM #2

I have found a way to do this using the one weapon mod.nHave a .cfg called random weapons .nnamx_oneweapon 1nmp_alliesclasses 512 nmp_axisclasses 2048nmp_britclasses 64nnto turn off have an allweapons.cfgnamx_oneweapon 0nmp_alliesclasses 256nmp_axisclasses 1024nmp_britclasses 32nnnThis forces a player to rechose class and respawn. nnProblems= nmortar class is enabled. If you use the mortar class plugin you get the mortar, if not you only have a pistol and melee weapon.nnClasslimits dont work so you can end up with an all sniper team.nnOn an occasional map, (sniperhill) the brirtish could not chose a weapon.nnIf you set to random, and dont use the owm 0, players are not forced to chose/respawn and can continue to play with their current weapon. If they want rechoose they will only have random class option.nnIf anyone knows how to fix the classlimits, or a better way please post.nnnMEATHEAD HOBO

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
08-24-2007, 05:52 PM #3
Hi, i want that players don'd choose team at connect time, server asign team and class.rnrnThere is any plugin for this?rnrnThx
rnrnCurrently there's no plugin for that, but it can be created.rnrnDo you want any player to get random team and random class?rnOr just public players and not Admins?

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
08-25-2007, 04:41 AM #4

i quickly created this plugin, it's sending all public players tornrandom team and random class while obeying your classlimits.rnrnadmins with accesslevel ADMIN_IMMUNITY (flag "a" in users.ini)rncan still choose a team and a class.rnrnlet me know if you need any modifications!

R Russo
started this thread
Posts: 3
Threads: 1
Joined: Mar 2005
08-25-2007, 09:10 AM #5

My server crash ..... HD down !!!!!nnToday i try to restore and try this plugin .... thx for work

R Russo
started this thread
Posts: 3
Threads: 1
Joined: Mar 2005
08-25-2007, 09:12 AM #6

Oppsssss, i cant download file. 0 size !!rnrncan upload again ?

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
08-25-2007, 09:58 AM #7

for some reason here's a problem with the download of attachmentsrnat the moment, here's a direct link:rnrnhttp://www.clan-sod.eu/serverstuff/dod_random.sma

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
08-25-2007, 12:15 PM #8

This will be much better. Just loaded on server!rnThanks!rnMeathead Hobo

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
09-05-2007, 01:29 PM #9

here's a new version that can be turned on/off either by cvar or admin command!rnrnadmin command:rnamx_dodrandom <1/0> = enabled / disable DoD Randomrnrncvar:rndod_random <1/0> = enabled / disable DoD RandomrnrnAdmin Level required to change the setting and be immune isrn"ADMIN_CVAR" (flag "g" in users.ini)rnrnEnjoy!

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
11-26-2007, 02:56 AM #10

Fuersturm, can you update this to reset the map, like the one weapon mod does.

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
11-27-2007, 11:06 AM #11

I'm trying to understand what you're looking to do. The proper way to do this would be to hook the message VGUIMenu, which means hooking the team/class menus that pop up when you join a game or change team/class.nnYou will still need what Feursturm did because otherwise they could change their team/class through a console command.nnBut anyway, this is the info I've posted up on the VGUIMessage. You can use this tutorial to hook the messages and figure out what number represents which menu.nnNote that the first paramter, as the first link I gave displays, is the parameter that defines which menu is being displayed.nnAfter you successfully hook these menus, you can return PLUGIN_HANDLED to block them and assign your own random team and class. There are functions in the dodx module for that part.nnnEDIT: There is a more efficient way of doing what fuersturm did. I wasn't sure until I saw the dodx.inc. It will do the same basic thing, but this way you aren't working with strings and it will catch something like an auto-team balancer (I assume).nn/* This Forward is called when a player changes team */nforward dod_client_changeteam(id, team, oldteam);nn/* This Forward is called if a player changes class, but just after spawn */nforward dod_client_changeclass(id, class, oldclass);

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
11-27-2007, 06:22 PM #12

Let me see what damage I can do with this new information.nnWhat were looking to do is random class/random weapons for everyone on some maps, even Admins.nnIt must force a reset of some kind, to force players random if already playing.nnFuersturms' plugin works perfect for new players joining after enabled.nnWe don't want random on all maps, so must be toggled off, most of the time.nnAm going to look at your links and see what you are talking about.nnThanksnnMeatheadnnP.S. Where is everyone?nnnnEdit: Ok, figured out the admin level changenhttp://www.amxmodx.org/funcwiki.php?go=module&id=1#const_admin

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
01-30-2009, 11:52 PM #13

Still working great. Only improvement would be you can't spectate. With the new dod modules can this be updated?rnMeathead

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
01-31-2009, 12:13 AM #14

it would be very easy to add eg. a say command so when u say /spec u will be send to spectator... is it something like that u want?rnrn*Edit*rnrnWell i think can be done iam not sure lol. but if u can live with a say command ill try to fix it tomorrow... iam not quit sure what will happen if u wanna go back in the game..

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
01-31-2009, 11:12 AM #15

We will find out!

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
01-31-2009, 11:27 AM #16

Try this say /spec in team say to join spectators. I added so the say command should work in global say aswell but it doesnt work on my test server, team say does tho... My test server is a mess, so i might work for you :)...rnrn***EditrnrnZor its pretty annoying that i/ppl cant attach files here without approvel. I dont get why its like that since if i wanna post something in non-developers plugins section there is no approval...rnrnCheersrnrn

////////////////////////////////////////////////////////////////////////////////////////////////////rn//rn// Changelog:rn//rn// 01-31-2009 Added say cmd /spec | update by Dr.Grn//rnrnrn#include <amxmodx>rn#include <amxmisc>rn#include <dodx>rnrn#define ADMIN_LEVEL ADMIN_CVARrnrnnew g_dod_randomrnrnpublic plugin_init()rn{rn register_plugin("DoD Random","1.2","FeuerSturm")rn g_dod_random = register_cvar("dod_random","1")rn register_concmd("amx_dodrandom","cmd_dodrandom",ADMIN_LEVEL,"<1/0> Enable/Disable DoD Random")rn register_clcmd("jointeam","join_random")rn rn register_clcmd("say /spec","join_spec")rn register_clcmd("say_team /spec","join_spec")rn}rnrnpublic join_random(id)rn{rn if(get_user_flags(id)&ADMIN_LEVEL || get_pcvar_num(g_dod_random))rn {rn return PLUGIN_CONTINUErn }rn engclient_cmd(id,"jointeam","5")rn return PLUGIN_HANDLEDrn}rnrnrnpublic join_spec(id)rn{rn dod_user_kill(id)rn engclient_cmd(id,"jointeam","3")rn return PLUGIN_HANDLEDrn}rnrnpublic client_command(id)rn{rn if(get_user_flags(id)&ADMIN_LEVEL || get_pcvar_num(g_dod_random))rn {rn return PLUGIN_CONTINUErn }rn new command[32]rn read_argv(0,command,31)rn if(contain(command,"cls_") != -1)rn {rn engclient_cmd(id,"cls_random") rn return PLUGIN_HANDLEDrn }rn return PLUGIN_CONTINUErn}rnrnpublic cmd_dodrandom(id,level,cid)rn{rn if(!cmd_access(id,level,cid,2))rn {rn return PLUGIN_HANDLEDrn } rn new dod_random_s[2]rn read_argv(1,dod_random_s,2)rn new dod_random = str_to_num(dod_random_s)rn if(dod_random == 1)rn {rn if(get_pcvar_num(g_dod_random) == 1)rn {rn console_print(id,"[AMXX] DoD Random is already enabled.....")rn client_print(id,print_chat,"[AMXX] DoD Random is already enabled.....")rn }rn else if(get_pcvar_num(g_dod_random) == 0)rn {rn set_pcvar_num(g_dod_random,1)rn console_print(id,"[AMXX] DoD Random ENABLED!")rn client_print(id,print_chat,"[AMXX] DoD Random ENABLED!")rn }rn return PLUGIN_HANDLEDrn }rn else if(dod_random == 0)rn {rn if(get_pcvar_num(g_dod_random) == 0)rn {rn console_print(id,"[AMXX] DoD Random is already disabled.....")rn client_print(id,print_chat,"[AMXX] DoD Random is already disabled.....")rn } rn else if(get_pcvar_num(g_dod_random) == 1)rn {rn set_pcvar_num(g_dod_random,0)rn console_print(id,"[AMXX] DoD Random DISABLED!")rn client_print(id,print_chat,"[AMXX] DoD Random DISABLED!")rn }rn return PLUGIN_HANDLEDrn }rn return PLUGIN_HANDLEDrn}rn rn
meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
01-31-2009, 07:36 PM #17

Been waiting for the approval. Thanks for the workaround DR. G!

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
01-31-2009, 08:24 PM #18

No problem Dear Meathead :D Does it work as it should?

meathead
posted here
Posts: 337
Threads: 23
Joined: Aug 2007
02-27-2009, 08:37 PM #19

Sorry Dr.G, been a little covered up lately and have not had a chance to test again. That first time I tried it it was not working properly, but I failed to change the admin level, and recompile. Fixing to try right now.nThanks!

DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC