AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:GO] Auto strip extra knives V1.2 [21/08/2020] (https://forums.alliedmods.net/showthread.php?t=325110)

SSheriFF 06-08-2020 12:04

[CS:GO] Auto strip extra knives V1.2 [21/08/2020]
 
1 Attachment(s)
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]

Sajmooooon 06-08-2020 17:22

Re: [CS:GO] Auto strip extra knives
 
Finally, thank you.

Pilo 06-10-2020 09:17

Re: [CS:GO] Auto strip extra knives
 
sherif ya king

AuricYoutube 06-10-2020 11:15

Re: [CS:GO] Auto strip extra knives
 
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.

SSheriFF 06-10-2020 11:35

Re: [CS:GO] Auto strip extra knives
 
Quote:

Originally Posted by AuricYoutube (Post 2704964)
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 :bee:, so just disable the plugin on this map by cfg ("sm plugins unload RemoveExtraKnives")

Franc1sco 06-10-2020 11:52

Re: [CS:GO] Auto strip extra knives
 
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 :up:

manicogaming 06-10-2020 13:11

Re: [CS:GO] Auto strip extra knives
 
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.

SSheriFF 06-10-2020 16:51

Re: [CS:GO] Auto strip extra knives
 
Quote:

Originally Posted by Franc1sco (Post 2704970)
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 :up:

Thank for your advice, I appreciate your contribute:)

SSheriFF 06-20-2020 16:43

Re: [CS:GO] Auto strip extra knives
 
Version 1.1 is now available!

ROFI 08-18-2020 05:54

Re: [CS:GO] Auto strip extra knives V1.1 [20/06/2020]
 
There is a bug.In front of the person's face, just below the scope, another knife appears, which also moves during action


All times are GMT -4. The time now is 10:33.

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