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

[TF2] Jarate Teammates


Post New Thread Reply   
 
Thread Tools Display Modes
Author
simoneaolson
Member
Join Date: Sep 2009
Plugin ID:
1772
Plugin Version:
1.05
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Jarate your own teammates just for fun! (No mini-crits are taken)
    Old 06-28-2010 , 13:14   [TF2] Jarate Teammates
    Reply With Quote #1

    Description
    Ever wanted to jarate your own teammates? Maybe to troll or just get attention? Now you can do that. Note that minicrits are NOT given from the opposite team when your teammate is jarated.

    Cvars
    tf_jar_teammates_version - Current plugin version
    tf_jar_teammates_enabled - Enabled/Disable the plugin (bool) Def: 1
    tf_jar_teammates_distance - Max distance a player can be from jarate to be covered in piss (float) Def: 750.0
    tf_jar_teammates_time - Time in seconds to cover player in piss (float) Def: 7.0

    Update History
    v1.0 - Initial release
    v1.01 - Fixed a bug where no mini-crits are taken (when using jarate on other team)
    v1.02 -
    * Added admin functionality
    * New CVARs
    * Fixed a bug allowing jarated teammates to take minicrits
    v1.03 - Removed minicrit damage on teammates
    v1.04 - Optimized plugin
    v1.05 -
    * Fixed CVAR resetting bug
    * Added spy jarated sound effects


    Requirements
    * Sourcemod 1.3.3 or Greater
    * SDKHooks extension, get it here: http://code.google.com/p/tsunami-pro...downloads/list
    * Note that the plugin will not compile without sdkhooks.inc, so please download the .smx instead


    SCREENS
    [IMG]http://img208.**************/img208/8155/hl22010070111215745.png[/IMG]
    Attached Files
    File Type: smx tf_jarate_teammates.smx (7.0 KB, 1007 views)
    File Type: sp Get Plugin or Get Source (tf_jarate_teammates.sp - 750 views - 6.7 KB)

    Last edited by simoneaolson; 08-17-2010 at 15:41. Reason: new version
    simoneaolson is offline
    Sreaper
    髪を用心
    Join Date: Nov 2009
    Old 06-29-2010 , 21:59   Re: [TF2] Jarate Teammates
    Reply With Quote #2

    Lol sweet plugin! Thanks!
    Sreaper is offline
    Afronanny
    Veteran Member
    Join Date: Aug 2009
    Old 06-29-2010 , 23:22   Re: [TF2] Jarate Teammates
    Reply With Quote #3

    Suggestions for source code improvement:
    Not required, but good practice to put semicolons at the end of each statement.

    Instead of making the array size 40, set it to MAXPLAYERS
    PHP Code:
    new bool:jarated[MAXPlAYERS]; 
    In the loop in OnMapStart, use MaxClients instead of hardcoding 40 (TF2 doesn't even go up to 40)
    PHP Code:
    for (new 1<= MaxClientsi++) 
    Changing events around will not change whether or not it is a minicrit, since the damage has already been taken by the time the event is fired. Events are post-fact, only notifications.

    Possibly make a global variable for enabled:
    PHP Code:
    new g_bEnabled true;
    public 
    OnPluginStart()
    {
        
    Cv_PluginEnabled CreateConVar(....);
        
    HookConVarChange(Cv_PluginEnabledConVarChanged_Enabled);
    }
    public 
    ConVarChanged_Enabled(Handle:convar, const String:oldValue[], const String:newValue[])
    {
        
    g_bEnabled GetConVarBool(Cv_PluginEnabled);

    And do the same for the rest of the cvars, so you don't have to repeatedly look up the convar's value, all you need to do is check the variable, which is changed whenever the convar is changed.
    Afronanny is offline
    simoneaolson
    Member
    Join Date: Sep 2009
    Old 06-30-2010 , 01:18   Re: [TF2] Jarate Teammates
    Reply With Quote #4

    Quote:
    Originally Posted by Afronanny View Post
    Changing events around will not change whether or not it is a minicrit, since the damage has already been taken by the time the event is fired. Events are post-fact, only notifications.
    Thanks for the suggestions, i'll be sure to update it with most of these. However your statement regarding the even hook is incorrect. this plugins uses the EventHookMode_Pre option meaning that the hook is called before the event happens in the engine. I have tested it myself, the players do not take minicrits.
    simoneaolson is offline
    Afronanny
    Veteran Member
    Join Date: Aug 2009
    Old 06-30-2010 , 10:11   Re: [TF2] Jarate Teammates
    Reply With Quote #5

    Quote:
    Originally Posted by simoneaolson View Post
    Thanks for the suggestions, i'll be sure to update it with most of these. However your statement regarding the even hook is incorrect. this plugins uses the EventHookMode_Pre option meaning that the hook is called before the event happens in the engine. I have tested it myself, the players do not take minicrits.
    They don't appear to take minicrits to you, because the event being shown to the client has minicrits set to false. The damage will still be that of a minicrit, you just don't see the "Minicrit" sprite float out of them.

    Remember, events are simply notifications to say what happened. A pre hook means that you can change what is reported, but even in a pre hook, the damage has already been dealt; you can't change what actually happened.
    Afronanny is offline
    simoneaolson
    Member
    Join Date: Sep 2009
    Old 06-30-2010 , 11:29   Re: [TF2] Jarate Teammates
    Reply With Quote #6

    Quote:
    Originally Posted by Afronanny View Post
    They don't appear to take minicrits to you, because the event being shown to the client has minicrits set to false. The damage will still be that of a minicrit, you just don't see the "Minicrit" sprite float out of them.

    Remember, events are simply notifications to say what happened. A pre hook means that you can change what is reported, but even in a pre hook, the damage has already been dealt; you can't change what actually happened.
    What do you suggest i do then?
    simoneaolson is offline
    Afronanny
    Veteran Member
    Join Date: Aug 2009
    Old 06-30-2010 , 12:31   Re: [TF2] Jarate Teammates
    Reply With Quote #7

    Quote:
    Originally Posted by simoneaolson View Post
    What do you suggest i do then?
    http://forums.alliedmods.net/showthread.php?t=106748

    Take a look at the OnTakeDamage hook. That will allow you to change the damage done back to what it should be (keep the event hook in your plugin too)
    Afronanny is offline
    Sreaper
    髪を用心
    Join Date: Nov 2009
    Old 06-30-2010 , 01:36   Re: [TF2] Jarate Teammates
    Reply With Quote #8

    Are you supposed to be able to see jarate on your teammate when you throw it at them? Also does friendlyfire need to be on for this to work? I can't seem to get this to work. :/

    Last edited by Sreaper; 06-30-2010 at 01:41.
    Sreaper is offline
    simoneaolson
    Member
    Join Date: Sep 2009
    Old 06-30-2010 , 01:50   Re: [TF2] Jarate Teammates
    Reply With Quote #9

    Yes you are supposed to see it, also friendly fire does not need to be on. However, the plugin does not work well when you throw jarate from long distances or if you directly hit a teammate. You could also try increasing the tf_jar_teammates_distance cvar to 900.0 or so to help this. It also could be that the plugin is not detecting you as an admin. Are you sure that you have it configured correctly?
    simoneaolson is offline
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 08-17-2010 , 15:13   Re: [TF2] Jarate Teammates
    Reply With Quote #10

    Quote:
    Originally Posted by Sreaper View Post
    Are you supposed to be able to see jarate on your teammate when you throw it at them? Also does friendlyfire need to be on for this to work? I can't seem to get this to work. :/
    Does not seem to e working for me ether.
    __________________
    DarthNinja 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 22:09.


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