Raised This Month: $32 Target: $400
 8% 

[L4D2] Meteor Hunter


Post New Thread Reply   
 
Thread Tools Display Modes
Author
rekcah
Member
Join Date: Jun 2019
Plugin ID:
7230
Plugin Version:
1
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    big hunter pounces create meteor impacts
    Old 07-31-2020 , 00:04   [L4D2] Meteor Hunter
    Reply With Quote #1

    i was trying to think of ways to give infected players new abilities that can also encourage them to play with a higher level of skill.

    this plugin rewards hunters who can pull off long distance pounces.

    when a hunter lands a pounce with a distance over 500 it creates an impact crater, plays an explosion sound, flings all survivors in the area away and they take 20 damage.

    i left in my testing command !testhit that admins can use to see what it actually does when a hunter lands.
    Attached Files
    File Type: sp Get Plugin or Get Source (meteor_hunter.sp - 915 views - 8.7 KB)

    Last edited by rekcah; 08-05-2020 at 02:54.
    rekcah is offline
    KRUTIK
    Senior Member
    Join Date: Feb 2019
    Location: Мос
    Old 07-31-2020 , 09:11   Re: [L4D2] Meteor Hunter
    Reply With Quote #2

    when compiled on 1.9 E:\sourcemod\addons\sourcemod\scripting\meteo r hunter.sp(24) : warning 203: symbol is never used: "hunter"

    Last edited by KRUTIK; 07-31-2020 at 09:15.
    KRUTIK is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 08-04-2020 , 15:27   Re: [L4D2] Meteor Hunter
    Reply With Quote #3

    wait, you have signature?
    so this plugin only works in linux?
    PHP Code:
    stock L4D2_Fling(targetFloat:vector[3], attackerFloat:incaptime 3.0)
    {
        new 
    Handle:MySDKCall INVALID_HANDLE;    
        
    StartPrepSDKCall(SDKCall_Player);
        
    PrepSDKCall_SetSignature(SDKLibrary_Server"@_ZN13CTerrorPlayer5FlingERK6Vector17PlayerAnimEvent_tP20CBaseCombatCharacterf"0);

        
    PrepSDKCall_AddParameter(SDKType_VectorSDKPass_ByRef);
        
    PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
        
    PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
        
    PrepSDKCall_AddParameter(SDKType_FloatSDKPass_Plain);

        
    MySDKCall EndPrepSDKCall();
        if(
    MySDKCall == INVALID_HANDLE)
        {
            
    LogError("Could not prep the Fling function");
        }
        
        
    SDKCall(MySDKCalltargetvector76attackerincaptime); //76 is the 'got bounced' animation in L4D2

    __________________
    HarryPotter is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-04-2020 , 17:17   Re: [L4D2] Meteor Hunter
    Reply With Quote #4

    This code is really really bad sorry to say.

    1. Old syntax.
    2. Hard coding signatures is bad, use a gamedata file.
    3. Your "MySDKCall" is leaking handles, you should only prep the SDKCalls in plugin start storing handle in global variable. Right now you're constantly prepping on use which is bad.
    4. See left4dhooks for windows and linux signature, why are you only including linux signature? These have been known for ages.
    5. You're leaking the TR_TraceRayFilterEx handle - creating memory leak.
    6. Redundant "IsValidEntity" check in player loop.
    7. Using old "PrecacheParticle" method, see any of my plugins with effects for better method.
    8. Using old "HurtEntity" method, see various plugins of mine for "SDKHooks_TakeDamage" method.
    9. Not using entity references in timers to delete entities (so you'll inadvertently delete something else).
    10. Using "return Plugin_Stop" in timer callback when it's not a repeating timer, unnecessary.
    11. You have multiple warnings: "warning 234: symbol "FloatMul" is marked as deprecated: This native is internal implementation. For multiplication use the '*' operator."
    12. Your "Plugin myinfo" section is weirdly placed half way through the script, standard practice is at the top of script.
    __________________

    Last edited by Silvers; 08-04-2020 at 17:20.
    Silvers is offline
    rekcah
    Member
    Join Date: Jun 2019
    Old 08-05-2020 , 02:56   Re: [L4D2] Meteor Hunter
    Reply With Quote #5

    added the window signatures and fixed a few of the other issues silvers listed.
    my code is still probably pretty bad tho

    Last edited by rekcah; 08-05-2020 at 02:57.
    rekcah is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 08-05-2020 , 07:17   Re: [L4D2] Meteor Hunter
    Reply With Quote #6

    I love the idea of this plugin, and want to put it in my server, so I remake code.
    Hope you don't mind.

    Updated:
    Remake code, thanks to Silvers and Lux

    -Convar-
    Spoiler


    -Edit-
    Latest version always here
    __________________

    Last edited by HarryPotter; 02-07-2023 at 07:45.
    HarryPotter is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-05-2020 , 15:02   Re: [L4D2] Meteor Hunter
    Reply With Quote #7

    @fbef0102: your version is leaking handles in "CreateRing" - missing "delete hPack".
    __________________
    Silvers is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 08-05-2020 , 15:48   Re: [L4D2] Meteor Hunter
    Reply With Quote #8

    Quote:
    Originally Posted by Silvers View Post
    @fbef0102: your version is leaking handles in "CreateRing" - missing "delete hPack".
    Mabye I got wrong, I thought CreateTimer would automatically delete hPack,
    do not need to call CloseHandle() only when using "CreateDataTimer"?
    __________________
    HarryPotter is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 08-05-2020 , 15:56   Re: [L4D2] Meteor Hunter
    Reply With Quote #9

    Quote:
    Originally Posted by fbef0102 View Post
    Mabye I got wrong, I thought CreateTimer would automatically delete hPack,
    do not need to call CloseHandle() only when using "CreateDataTimer"?
    PHP Code:
    CreateTimer(0.3,CreateRing,hbPack,TIMER_FLAG_NO_MAPCHANGE|TIMER_DATA_HNDL_CLOSE); 
    PHP Code:
    #define TIMER_REPEAT            (1<<0)      /**< Timer will repeat until it returns Plugin_Stop */
    #define TIMER_FLAG_NO_MAPCHANGE (1<<1)      /**< Timer will not carry over mapchanges */
    #define TIMER_HNDL_CLOSE        (1<<9)      /**< Deprecated define, replaced by below */
    #define TIMER_DATA_HNDL_CLOSE   (1<<9)      /**< Timer will automatically call CloseHandle() on its data when finished */ 
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D

    Last edited by Lux; 08-05-2020 at 15:57.
    Lux is offline
    HarryPotter
    Veteran Member
    Join Date: Sep 2017
    Location: Taiwan, Asia
    Old 08-05-2020 , 16:01   Re: [L4D2] Meteor Hunter
    Reply With Quote #10

    Quote:
    Originally Posted by Lux View Post
    PHP Code:
    CreateTimer(0.3,CreateRing,hbPack,TIMER_FLAG_NO_MAPCHANGE|TIMER_DATA_HNDL_CLOSE); 
    PHP Code:
    #define TIMER_REPEAT            (1<<0)      /**< Timer will repeat until it returns Plugin_Stop */
    #define TIMER_FLAG_NO_MAPCHANGE (1<<1)      /**< Timer will not carry over mapchanges */
    #define TIMER_HNDL_CLOSE        (1<<9)      /**< Deprecated define, replaced by below */
    #define TIMER_DATA_HNDL_CLOSE   (1<<9)      /**< Timer will automatically call CloseHandle() on its data when finished */ 
    Thanks, Lux, one more question, what if I use CreateDataTimer?
    should I also write TIMER_DATA_HNDL_CLOSE?
    PHP Code:
    CreateDataTimer(0.3,CreateRing,hbPack,TIMER_FLAG_NO_MAPCHANGE|TIMER_DATA_HNDL_CLOSE); 
    __________________
    HarryPotter is offline
    Reply



    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 21:50.


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