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

[CSGO] How to disable pick up Nades


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 11-10-2022 , 18:26   [CSGO] How to disable pick up Nades
Reply With Quote #1

Hello, i dont know how i can disable pick up nades from ground, please help!
Danielej1 is offline
dyxL
Senior Member
Join Date: Jul 2010
Old 11-12-2022 , 08:52   Re: [CSGO] How to disable pick up Nades
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=950174
dyxL is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 11-12-2022 , 09:06   Re: [CSGO] How to disable pick up Nades
Reply With Quote #3

i dont want restrict nades, Only i wanna disable pick up nades from ground
Danielej1 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-12-2022 , 10:38   Re: [CSGO] How to disable pick up Nades
Reply With Quote #4

You have not tell us, do players still need collect grenades when round start ?


This example follow weapon drop by player,
when weapon is grenade, it store that entity in array and will block pickup.
On round start plugin clear array of stored entities.

PHP Code:


#include <sdkhooks>
#include <cstrike>

ArrayList blockpick;

public 
void OnPluginStart()
{
    
blockpick = new ArrayList();

    
HookEvent("round_start"round_start);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void round_start(Event event, const char[] namebool dontBroadcast)
{
    
blockpick.Clear();
}

public 
void OnClientPutInServer(int client)
{
    
//SDKHook(client, SDKHook_OnTakeDamage, ontakedamage);
    //SDKHook(client, SDKHook_WeaponCanSwitchTo, weapon_cb1);
    
SDKHook(clientSDKHook_WeaponCanUseweapon_cb2);
    
SDKHook(clientSDKHook_WeaponDropweapon_cb3);
}

public 
Action ontakedamage(int victimintattackerintinflictorfloatdamageintdamagetype)
{
    
PrintToServer("%i %f %i",
                            
inflictor,
                            
damage,
                            
damagetype);
    return 
Plugin_Continue;
}


public 
Action weapon_cb1(int clientint weapon)
{
    
PrintToServer("weapon_cb1 %i %i",
                            
client,
                            
weapon);
    return 
Plugin_Continue;
}

public 
Action weapon_cb2(int clientint weapon)
{
    if(
weapon == -1)
        return 
Plugin_Continue;

    
int entref EntIndexToEntRef(weapon);

    if(
entref != -&& blockpick.FindValue(entref) != -1)
    {
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;
}

public 
Action weapon_cb3(int clientint weapon)
{
    if(
weapon == -|| !HasEntProp(weaponProp_Send"m_iItemDefinitionIndex"))
        return 
Plugin_Continue;

    
int entref EntIndexToEntRef(weapon);

    if(
entref != -&& blockpick.FindValue(entref) == -1)
    {
        
int m_iItemDefinitionIndex GetEntProp(weaponProp_Send"m_iItemDefinitionIndex");
        
CSWeaponID weaponid CS_ItemDefIndexToID(m_iItemDefinitionIndex);

        switch(
weaponid)
        {
            case 
CSWeapon_HEGRENADECSWeapon_SMOKEGRENADECSWeapon_FLASHBANG,\
                
CSWeapon_MOLOTOVCSWeapon_DECOYCSWeapon_INCGRENADECSWeapon_TAGGRENADECSWeapon_FRAGGRENADE:
            {
                
blockpick.Push(entref);
            }
        }
    }

    return 
Plugin_Continue;

__________________
Do not Private Message @me
Bacardi is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 11-12-2022 , 10:46   Re: [CSGO] How to disable pick up Nades
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
You have not tell us, do players still need collect grenades when round start ?


This example follow weapon drop by player,
when weapon is grenade, it store that entity in array and will block pickup.
On round start plugin clear array of stored entities.

PHP Code:


#include <sdkhooks>
#include <cstrike>

ArrayList blockpick;

public 
void OnPluginStart()
{
    
blockpick = new ArrayList();

    
HookEvent("round_start"round_start);

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }
}

public 
void round_start(Event event, const char[] namebool dontBroadcast)
{
    
blockpick.Clear();
}

public 
void OnClientPutInServer(int client)
{
    
//SDKHook(client, SDKHook_OnTakeDamage, ontakedamage);
    //SDKHook(client, SDKHook_WeaponCanSwitchTo, weapon_cb1);
    
SDKHook(clientSDKHook_WeaponCanUseweapon_cb2);
    
SDKHook(clientSDKHook_WeaponDropweapon_cb3);
}

public 
Action ontakedamage(int victimintattackerintinflictorfloatdamageintdamagetype)
{
    
PrintToServer("%i %f %i",
                            
inflictor,
                            
damage,
                            
damagetype);
    return 
Plugin_Continue;
}


public 
Action weapon_cb1(int clientint weapon)
{
    
PrintToServer("weapon_cb1 %i %i",
                            
client,
                            
weapon);
    return 
Plugin_Continue;
}

public 
Action weapon_cb2(int clientint weapon)
{
    if(
weapon == -1)
        return 
Plugin_Continue;

    
int entref EntIndexToEntRef(weapon);

    if(
entref != -&& blockpick.FindValue(entref) != -1)
    {
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;
}

public 
Action weapon_cb3(int clientint weapon)
{
    if(
weapon == -|| !HasEntProp(weaponProp_Send"m_iItemDefinitionIndex"))
        return 
Plugin_Continue;

    
int entref EntIndexToEntRef(weapon);

    if(
entref != -&& blockpick.FindValue(entref) == -1)
    {
        
int m_iItemDefinitionIndex GetEntProp(weaponProp_Send"m_iItemDefinitionIndex");
        
CSWeaponID weaponid CS_ItemDefIndexToID(m_iItemDefinitionIndex);

        switch(
weaponid)
        {
            case 
CSWeapon_HEGRENADECSWeapon_SMOKEGRENADECSWeapon_FLASHBANG,\
                
CSWeapon_MOLOTOVCSWeapon_DECOYCSWeapon_INCGRENADECSWeapon_TAGGRENADECSWeapon_FRAGGRENADE:
            {
                
blockpick.Push(entref);
            }
        }
    }

    return 
Plugin_Continue;



Code:
C:\Users\ja\Desktop\blocknade.sp(74) : error 017: undefined symbol "CS_ItemDefIndexToID"
C:\Users\ja\Desktop\blocknade.sp(74) : warning 213: tag mismatch
C:\Users\ja\Desktop\blocknade.sp(79) : error 017: undefined symbol "CSWeapon_TAGGRENADE"
Danielej1 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-12-2022 , 11:10   Re: [CSGO] How to disable pick up Nades
Reply With Quote #6

Try web compiler from SourceMod home page
__________________
Do not Private Message @me
Bacardi is offline
Danielej1
Senior Member
Join Date: Jul 2022
Location: Poland
Old 11-12-2022 , 11:44   Re: [CSGO] How to disable pick up Nades
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Try web compiler from SourceMod home page
Thank u, your Plugin Working !
Danielej1 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 03:52.


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