Raised This Month: $23 Target: $400
 5% 

[CS:GO] Auto strip extra knives V1.1 [20/06/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.1
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.1 [20/06/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.1.smx to addons/sourcemod/plugins
    ➤ Change the map or restart your server.
    ➤ Have Fun.

    Download links:
    GitHub Download Link

    Contact:
    My Discord: WilDick#1524
    My Steam Profile

    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]
    Attached Files
    File Type: sp Get Plugin or Get Source (RemoveExtraKnives.sp - 89 views - 882 Bytes)
    File Type: sp Get Plugin or Get Source (RemoveExtraKnivesV1.1.sp - 48 views - 1.0 KB)
    __________________

    Last edited by SSheriFF; 06-20-2020 at 16:39.
    SSheriFF is online now
    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")
    __________________

    Last edited by SSheriFF; 06-10-2020 at 11:36.
    SSheriFF is online now
    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 SourceMod Coder -> Activity channel
    Taking some paid jobs and selling some private stuff.
    Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

    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
    __________________
    SSheriFF is online now
    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!
    __________________
    SSheriFF is online now
    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 10:20.


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