AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] MvM - Make players 'ready' (v1.3, 9/6/2012) (https://forums.alliedmods.net/showthread.php?t=195301)

elfenlied ftw 09-05-2012 20:22

[TF2] MvM - Make players 'ready' (v1.3, 9/6/2012)
 
1 Attachment(s)
This is a very simple plugin I wrote for Mann. vs Machine mode in TF2. If you play MvM, you'll probably find yourself sitting there waiting for someone to press F4 to start the round. And of course, they either don't know to press F4, don't care to, or the button doesn't work.

This plugin allows you to force a player to 'ready up', or the entire team if desired. Though do be careful, as engineers obviously take longer to get ready. [img]http://img685.**************/img685/908/leave.gif[/img]




CVARs
mvmready_version - Plugin version.



COMMANDs
note: these commands can be used without the sm_* prefix
sm_mvmready <#userid|name> <1=ready, 0=not> - Sets the target(s) to become ready. Requires GENERIC ADMIN flag. Used '@red' for targeting the entire team.
sm_ready - Same as above, easier to type. Requested by "Vastrix"



INSTALLATION INSTRUCTIONS
Copy the mvmready.smx to the sourcemod plugins folder.



CHANGELOG
Quote:

v1.1 - 1.3 9/6/2012
  • Replaced ClientCommand() with FakeClientCommand() <thanks Dr. McKay & ReFlexPoison >
  • Some code optimizations (bool cast with StringToInt())
  • Implemented ReplyToTargetError() < thanks again Dr.McKay >
  • Added "sm_ready" command by request. See details above.
  • removed COMMAND_FILTER_CONNECTED, shortened some buffers


v1.0 9/5/2012
  • Initial Release



CREDITS
  • Afro Priest - For making me write the plugin to begin with.
  • Dr. McKay - Info on FakeClientCommand(), and ReplyToTargetError().. and more.
  • ReFlexPoison - Info on FakeClientCommand()


PLANS
I have no future plans for this plugin, nor do I intend to take requests. May be some exceptions..



NOTES/MISC
1. This has been tested working with sourcemod v1.4.5-dev / metamod 1.8.7. Though it should work with earlier versions as well as its a very simple plugin.
2. This is my first plugin for sourcemod. If there's anything that needs improving please let me know so I can learn.

Dr. McKay 09-05-2012 23:34

Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
 
Why use ClientCommand? What's wrong with FakeClientCommand?

elfenlied ftw 09-06-2012 00:40

Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
 
I don't see what the problem is. Should FakeClientCommand be used instead for some reason? [img]http://img208.**************/img208/9797/idleo.gif[/img]

ReFlexPoison 09-06-2012 01:13

Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
 
Quote:

Originally Posted by elfenlied ftw (Post 1792487)
I don't see what the problem is. Should FakeClientCommand be used instead for some reason? [img]http://img208.**************/img208/9797/idleo.gif[/img]

FakeClientCommand() just uses tactics to somewhat "ignore" the cvar that disables the use of ClientCommand(). If ClientCommand() worked on all players without problems then there is no need to change it.

Dr. McKay 09-06-2012 06:43

Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
 
Quote:

Originally Posted by ReFlexPoison (Post 1792492)
FakeClientCommand() just uses tactics to somewhat "ignore" the cvar that disables the use of ClientCommand(). If ClientCommand() worked on all players without problems then there is no need to change it.

ClientCommand tells the client to execute the specified command. FakeCpientCommand makes the server think the client executed the specified command. The client can block ClientCommand, but not FakeClientCommand. As such, FakeClientCommand is generally better.

elfenlied ftw 09-06-2012 14:17

Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
 
Updated to use FakeClientCommand(), seems to be working the same. Also optimized some parts of the code.



Thanks [img]http://img860.**************/img860/8335/smilen.gif[/img]

Powerlord 09-06-2012 14:39

Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
 
Not sure what benefit this plugin has, as the timer starts ticking down (from 160 seconds iirc) as soon as the first person hits F4 and chops off 40 or so seconds for each additional person to hit F4 (unless the timer is already below 40)... until the last person hits F4 and it jumps to 10 seconds.

Dr. McKay 09-06-2012 14:44

Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
 
Code:

        if( target_count <= 0 ){
                ReplyToCommand( client, "invalid target(s) specified" );
        }

You should use ReplyToTargetError(target_count) here. Make sure you LoadTranslations("common.phrases") in your OnPluginStart().


Code:

                new String:clname[MAX_NAME_LENGTH+1];
                GetClientName( target_list[i], clname, sizeof( clname ) );

               
                // fake the cmd
                FakeClientCommand( target_list[i], "tournament_player_readystate %d", cstate );
               
                // report it
                ShowActivity2( client, "[SM] ", "set ready status '%d' on %s", cstate, clname );



Code:

       
                ShowActivity2( client, "[SM] ", "set ready status '%d' on %s", cstate, target_name );

^^ put that outside your loop.

Also, don't attach a compiled smx if it compiles on the forums.

Vastrix 09-06-2012 15:46

Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
 
Feature request:

an easyer chat command like:
/ready userid|name 1/0

^^would be great =)

p.s Thanks a LOT for this plugin (have been waiting for this from the releas of mvm)!! =)

elfenlied ftw 09-06-2012 17:51

Re: [TF2] MvM - Make players 'ready' (v1.2, 9/6/2012)
 
Updated. Now using ReplyToTargetError() & translations, thanks McKay, was wondering how to do that [img]http://img696.**************/img696/287/victoryv.gif[/img]

Also added sm_ready command for easier typing, see changelog & post for details.


All times are GMT -4. The time now is 17:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.