Raised This Month: $12 Target: $400
 3% 

[TF2] MvM - Make players 'ready' (v1.3, 9/6/2012)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
elfenlied ftw
Member
Join Date: Aug 2012
Plugin ID:
3218
Plugin Version:
1.3
Plugin Category:
Admin Commands
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    35 
    Plugin Description:
    Forces client(s) to become 'ready' to start the round. Same as a client pressing F4.
    Old 09-05-2012 , 20:22   [TF2] MvM - Make players 'ready' (v1.3, 9/6/2012)
    Reply With Quote #1

    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.
    Attached Files
    File Type: sp Get Plugin or Get Source (mvmready.sp - 6665 views - 2.8 KB)

    Last edited by elfenlied ftw; 09-06-2012 at 19:12.
    elfenlied ftw is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 09-05-2012 , 23:34   Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
    Reply With Quote #2

    Why use ClientCommand? What's wrong with FakeClientCommand?
    __________________
    Dr. McKay is offline
    elfenlied ftw
    Member
    Join Date: Aug 2012
    Old 09-06-2012 , 00:40   Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
    Reply With Quote #3

    I don't see what the problem is. Should FakeClientCommand be used instead for some reason? [img]http://img208.**************/img208/9797/idleo.gif[/img]
    elfenlied ftw is offline
    ReFlexPoison
    ☠☠☠
    Join Date: Jul 2011
    Location: ☠☠☠
    Old 09-06-2012 , 01:13   Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
    Reply With Quote #4

    Quote:
    Originally Posted by elfenlied ftw View Post
    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.
    ReFlexPoison is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 09-06-2012 , 06:43   Re: [TF2] MvM - Make players 'ready' (v1.0, 9/5/2012)
    Reply With Quote #5

    Quote:
    Originally Posted by ReFlexPoison View Post
    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.
    __________________
    Dr. McKay is offline
    elfenlied ftw
    Member
    Join Date: Aug 2012
    Old 09-06-2012 , 14:17   Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
    Reply With Quote #6

    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]

    Last edited by elfenlied ftw; 09-06-2012 at 14:17.
    elfenlied ftw is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 09-06-2012 , 14:39   Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
    Reply With Quote #7

    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.
    __________________
    Not currently working on SourceMod plugin development.
    Powerlord is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 09-06-2012 , 14:44   Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
    Reply With Quote #8

    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.
    __________________

    Last edited by Dr. McKay; 09-06-2012 at 15:30.
    Dr. McKay is offline
    Vastrix
    Senior Member
    Join Date: Aug 2012
    Location: Zion
    Old 09-06-2012 , 15:46   Re: [TF2] MvM - Make players 'ready' (v1.1, 9/6/2012)
    Reply With Quote #9

    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)!! =)

    Last edited by Vastrix; 09-06-2012 at 15:48.
    Vastrix is offline
    elfenlied ftw
    Member
    Join Date: Aug 2012
    Old 09-06-2012 , 17:51   Re: [TF2] MvM - Make players 'ready' (v1.2, 9/6/2012)
    Reply With Quote #10

    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.
    elfenlied ftw is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 06:01.


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