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

[L4D2] Backpack (!bk)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
dr_lex
Member
Join Date: Dec 2014
Plugin ID:
7704
Plugin Version:
1.6.3
Plugin Category:
All
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows the player to take a second main weapon in reserve
    Old 06-28-2021 , 06:10   [L4D2] Backpack (!bk)
    Reply With Quote #1

    I decided to publish my own version of the backpack for the player.

    The plugin differs from other backpacks in that I made it more mobile for players. (there are no menus and settings here).

    The command: sm_bk (!bk)

    Required: Left 4 Hooks Direct

    The backpack model is displayed only if the player has put a weapon there. And it will be deleted if it is taken out
    Attached Files
    File Type: txt bk.phrases.txt (1.1 KB, 559 views)
    File Type: sp Get Plugin or Get Source (l4d2_backpack.sp - 272 views - 18.0 KB)
    __________________

    Last edited by dr_lex; 03-13-2023 at 02:58.
    dr_lex is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 06-28-2021 , 06:25   Re: [L4D2] Backpack (!bk)
    Reply With Quote #2

    Looks good

    You should be putting the client's userid into timers, and retrieving that in the timer callback to verify you're affecting the correct client and not someone else. See the [TUT] link in my signature for details on good coding practices.

    I would say there's too much going on in your SetTransmit callback. Would suggest using events to cache/detect when someone is in thirdperson/pounced, or use the ThirdPersonShoulder_Detect API by Lux. Understand that SetTransmit is called by every client, every frame. So on servers with 20 players this could really impact performance.

    Change "OnClientPostAdminCheck" to "OnClientPutInServer" since you're not doing admin checks. I think "OnClientPostAdminCheck" might not trigger if Steam servers are down and cannot verify the client, unless that's only "OnClientAuthorized".
    __________________
    Silvers is offline
    dr_lex
    Member
    Join Date: Dec 2014
    Old 06-28-2021 , 09:04   Re: [L4D2] Backpack (!bk)
    Reply With Quote #3

    Quote:
    Originally Posted by Silvers View Post
    Looks good

    You should be putting the client's userid into timers, and retrieving that in the timer callback to verify you're affecting the correct client and not someone else. See the [TUT] link in my signature for details on good coding practices.

    I would say there's too much going on in your SetTransmit callback. Would suggest using events to cache/detect when someone is in thirdperson/pounced, or use the ThirdPersonShoulder_Detect API by Lux. Understand that SetTransmit is called by every client, every frame. So on servers with 20 players this could really impact performance.

    Change "OnClientPostAdminCheck" to "OnClientPutInServer" since you're not doing admin checks. I think "OnClientPostAdminCheck" might not trigger if Steam servers are down and cannot verify the client, unless that's only "OnClientAuthorized".
    Thank you for advice. Replaced OnClientPostAdminCheck with OnClientPutInServer

    Part of the code with the backpack model was provided to me by a friend. I really didn't go into the topic of connecting models to the player.

    If someone does it better, I will be grateful. Since at the moment there is no time to delve into this and check.
    __________________
    dr_lex is offline
    dr_lex
    Member
    Join Date: Dec 2014
    Old 03-13-2023 , 02:58   Re: [L4D2] Backpack (!bk)
    Reply With Quote #4

    Updated the plugin to 1.6.3
    __________________
    dr_lex 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 00:21.


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