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

[CS:GO] Auto strip extra knives V1.2 [21/08/2020]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Plugin ID:
7153
Plugin Version:
1.2
Plugin Category:
All
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Auto strip extra knives on round start from all players
    Old 06-08-2020 , 12:04   [CS:GO] Auto strip extra knives V1.2 [21/08/2020]
    Reply With Quote #1

    Description:
    ➤ As requsted here.
    ➤ A simple plugin that auto strip extra knives on round start from all players.

    How to install:
    ➤ Copy RemoveExtraKnivesV1.2.smx to addons/sourcemod/plugins
    ➤ Change the map or restart your server.
    ➤ Have Fun.

    Contact:
    My Discord: WilDick#1524

    Versions:
    ➤ 1.0 - first release [08/06/2020]
    ➤ 1.1 - now players will get a knife on round start only if its necessary [20/06/2020]
    ➤ 1.2 - fixed a problem that caused a duplicate knife floating [21/08/2020]
    Attached Files
    File Type: sp Get Plugin or Get Source (RemoveExtraKnivesV1.2.sp - 1152 views - 1.1 KB)
    __________________
    Taking small private requests (Free) and big private requests (Paid).
    Contact me via Discord: WilDick#1524

    My Plugins:

    Last edited by SSheriFF; 02-18-2022 at 12:58.
    SSheriFF is offline
    Sajmooooon
    Senior Member
    Join Date: Nov 2018
    Location: Slovakia
    Old 06-08-2020 , 17:22   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #2

    Finally, thank you.
    Sajmooooon is offline
    Pilo
    AlliedModders Donor
    Join Date: Jan 2019
    Location: Israel
    Old 06-10-2020 , 09:17   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #3

    sherif ya king
    __________________

    Taking Private(PAID) Plugins In PM
    Feel free to Donate with PayPal
    Feel free to message me in Discord Pilo#8253
    Total donated : 25$
    Pilo is offline
    AuricYoutube
    Senior Member
    Join Date: Aug 2016
    Location: Here
    Old 06-10-2020 , 11:15   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #4

    One issue, on maps where the player's knife is stripped by the map itself because you're not supposed to have it this plugin gives a knife.
    AuricYoutube is offline
    SSheriFF
    AlliedModders Donor
    Join Date: May 2020
    Location: Israel
    Old 06-10-2020 , 11:35   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #5

    Quote:
    Originally Posted by AuricYoutube View Post
    One issue, on maps where the player's knife is stripped by the map itself because you're not supposed to have it this plugin gives a knife.
    If you're not supposed to have a knife on a certain map there are no extra knives to strip on this map , so just disable the plugin on this map by cfg ("sm plugins unload RemoveExtraKnives")
    __________________
    Taking small private requests (Free) and big private requests (Paid).
    Contact me via Discord: WilDick#1524

    My Plugins:

    Last edited by SSheriFF; 06-10-2020 at 11:36.
    SSheriFF is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 06-10-2020 , 11:52   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #6

    This in your current plugin will delete tasers since it share the same weapon slot than knives
    PHP Code:
    public void RemoveExtraKnives(int client)
    {
        
    int weapon GetPlayerWeaponSlot(client2);
           while (
    weapon!= -1)
           {
            
    RemovePlayerItem(clientweapon);
            
    weapon GetPlayerWeaponSlot(client2);
        }
            
    GivePlayerItem(client"weapon_knife");

    I made this code that should works better and without issues. It just remove extra knives when it necessary.
    PHP Code:
    public void RemoveExtraKnives(int client)
    {
        
    int size GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
        
    bool haveKnife false;
        
        for (
    int i 0sizei++) // run for all the weapons that player have
        
    {
            
    int weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"i);
            if (
    IsValidEdict(weapon) && IsValidEntity(weapon))
            {
                
    char weaponClass[64];
                if (!
    GetEdictClassname(weaponweaponClasssizeof(weaponClass)))continue; // if invalid entity then continue
                
                
    if(StrContains(weaponClass"weapon_knife"false) == || StrContains(weaponClass"weapon_bayonet"false) == 0// knife entity
                
    {
                    if(
    haveKnife// player already have knife and this is other knife?
                    
    {
                        
    // delete extra knife because he only need one
                        
    RemovePlayerItem(clientweapon);
                        
    AcceptEntityInput(weapon"Kill");
                    }
                    
    haveKnife true// set that player have knife
                
    }
                
            }
        }        


    Also I recommend you to have the plugins in a github repository like I have, for allow others to make pulls requests for improve plugins if they want and for see the code changes easily. Cheers
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.


    Last edited by Franc1sco; 06-10-2020 at 12:08.
    Franc1sco is offline
    Send a message via MSN to Franc1sco
    manicogaming
    AlliedModders Donor
    Join Date: Aug 2014
    Old 06-10-2020 , 13:11   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #7

    If you're spectacting the game you will also get a knife, I think it can be fixed by adding IsPlayerAlive to the client check.
    manicogaming is offline
    SSheriFF
    AlliedModders Donor
    Join Date: May 2020
    Location: Israel
    Old 06-10-2020 , 16:51   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #8

    Quote:
    Originally Posted by Franc1sco View Post
    This in your current plugin will delete tasers since it share the same weapon slot than knives
    PHP Code:
    public void RemoveExtraKnives(int client)
    {
        
    int weapon GetPlayerWeaponSlot(client2);
           while (
    weapon!= -1)
           {
            
    RemovePlayerItem(clientweapon);
            
    weapon GetPlayerWeaponSlot(client2);
        }
            
    GivePlayerItem(client"weapon_knife");

    I made this code that should works better and without issues. It just remove extra knives when it necessary.
    PHP Code:
    public void RemoveExtraKnives(int client)
    {
        
    int size GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
        
    bool haveKnife false;
        
        for (
    int i 0sizei++) // run for all the weapons that player have
        
    {
            
    int weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"i);
            if (
    IsValidEdict(weapon) && IsValidEntity(weapon))
            {
                
    char weaponClass[64];
                if (!
    GetEdictClassname(weaponweaponClasssizeof(weaponClass)))continue; // if invalid entity then continue
                
                
    if(StrContains(weaponClass"weapon_knife"false) == || StrContains(weaponClass"weapon_bayonet"false) == 0// knife entity
                
    {
                    if(
    haveKnife// player already have knife and this is other knife?
                    
    {
                        
    // delete extra knife because he only need one
                        
    RemovePlayerItem(clientweapon);
                        
    AcceptEntityInput(weapon"Kill");
                    }
                    
    haveKnife true// set that player have knife
                
    }
                
            }
        }        


    Also I recommend you to have the plugins in a github repository like I have, for allow others to make pulls requests for improve plugins if they want and for see the code changes easily. Cheers
    Thank for your advice, I appreciate your contribute
    __________________
    Taking small private requests (Free) and big private requests (Paid).
    Contact me via Discord: WilDick#1524

    My Plugins:
    SSheriFF is offline
    SSheriFF
    AlliedModders Donor
    Join Date: May 2020
    Location: Israel
    Old 06-20-2020 , 16:43   Re: [CS:GO] Auto strip extra knives
    Reply With Quote #9

    Version 1.1 is now available!
    __________________
    Taking small private requests (Free) and big private requests (Paid).
    Contact me via Discord: WilDick#1524

    My Plugins:
    SSheriFF is offline
    ROFI
    New Member
    Join Date: Aug 2020
    Old 08-18-2020 , 05:54   Re: [CS:GO] Auto strip extra knives V1.1 [20/06/2020]
    Reply With Quote #10

    There is a bug.In front of the person's face, just below the scope, another knife appears, which also moves during action

    Last edited by ROFI; 08-18-2020 at 06:09.
    ROFI 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 05:11.


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