Raised This Month: $ Target: $400
 0% 

[SOLVED]to give unlimited he grenade?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-21-2009 , 20:58   Re: HOW to give unlimited he grenade?
Reply With Quote #1

Slight optimization
PHP Code:
public giveheifnothas(id
{
    if ( !
user_has_weaponid CSW_HEGRENADE ) )
        
give_itemid "weapon_hegrenade" );

    
cs_set_user_bpammo(idCSW_HEGRENADENADEAMOUNT);

Do not use what phoenix120 posted. This can be done much more efficiently.

This is the simplest way that requires little\no scripting knowledge. The only requirement is that the player needs to be given or purchase the first grenade (which can be done @ spawn)
PHP Code:
#include <csx>

public grenade_throwid greindex wId 
{
    if ( 
wId == CSW_HEGRENADE )
        
cs_set_user_bpammoid CSW_HEGRENADENADEAMOUNT);

Here's a full unlimited he-grenade plugin; the user is given a grenade when spawned so no purchase necessary. Since grenades are unlimited, the variable g_GrenadeNum simply is just the number that will display as the ammo amount for he-grenades (though, must be > 0).
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <csx>
#include <fun>

const g_GrenadeNum 5;

public 
plugin_init() 
{
    
register_plugin"unlimited hegrenades" "1.0" "bugsy" );
    
RegisterHamHam_Spawn "player" "fw_HamSpawn_Post" );
}

public 
fw_HamSpawn_Postid )
{
    if ( 
is_user_aliveid ) )
    {
        
give_itemid "weapon_hegrenade" );
        
cs_set_user_bpammoid CSW_HEGRENADE g_GrenadeNum );
    }
}

public 
grenade_throwid greindex wId 
{
    if ( 
wId == CSW_HEGRENADE )
        
cs_set_user_bpammoid CSW_HEGRENADE g_GrenadeNum );

__________________

Last edited by Bugsy; 08-22-2009 at 10:43.
Bugsy 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 15:07.


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