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

drop grenades


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakonda001
Member
Join Date: Jul 2020
Old 07-09-2020 , 16:37   drop grenades
Reply With Quote #1

guys how to make grenades fall out after killing a player yet

Code:
#pragma semicolon 1

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

new pCvarRequiredKills, pCvarShowMessage, g_iMaxPlayers;
new bool:g_bMessageShown[33];

public plugin_init()
{
    RegisterHam(Ham_Touch, "armoury_entity", "PlayerTouchesWeapon");

    pCvarRequiredKills = register_cvar("nades_required_kills", "15"); // Required kills to allow nades pickup
    pCvarShowMessage = register_cvar("nades_show_message", "0"); // Change to 1 if you want to show message.

    g_iMaxPlayers = get_maxplayers();
}

public PlayerTouchesWeapon(iTouched , iToucher)
{
    if(IsPlayer(iToucher))
    {
        new armouryIndex = cs_get_armoury_type(iTouched);
        
        if(armouryIndex == CSW_HEGRENADE || armouryIndex == CSW_FLASHBANG || armouryIndex == CSW_SMOKEGRENADE)
        {
            // Message //
            if(get_pcvar_num(pCvarShowMessage))
            {
                // Disable Pickup //
                if(get_user_frags(iToucher) < get_pcvar_num(pCvarRequiredKills))
                {
                    // To prevent message spam //
                    if(!g_bMessageShown[iToucher])
                    {
                        client_print(iToucher, print_chat, "You cant pickup nades. You need %i total frags.", get_pcvar_num(pCvarRequiredKills));
                        g_bMessageShown[iToucher] = true;
                    }
                    // Block //
                    return HAM_SUPERCEDE;
                }
                // Allow Pickup //
                else
                {
                    // Allow //
                    return HAM_IGNORED;
                }
            }
            // No message //
            else
                return get_user_frags(iToucher) >= get_pcvar_num(pCvarRequiredKills) ? HAM_IGNORED : HAM_SUPERCEDE;
        }
    }
    return HAM_IGNORED;
}
anakonda001 is offline
anakonda001
Member
Join Date: Jul 2020
Old 07-10-2020 , 13:09   Re: drop grenades
Reply With Quote #2

up
anakonda001 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 22:24.


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