Raised This Month: $ Target: $400
 0% 

[Help] How to get this Event?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
foxxx
Junior Member
Join Date: Dec 2009
Old 11-19-2010 , 06:00   [Help] How to get this Event?
Reply With Quote #1

Sometimes player will get a pistol at roundstart,
(like: T get a glock with 40bpammo; CT get a usp with 24bpammo.)
How to get this Event?
Can the glock/usp be changed to other pistol?
foxxx is offline
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 11-19-2010 , 12:38   Re: [Help] How to get this Event?
Reply With Quote #2

yeah u can change it , using hamspawn ... first : if user team is CT and if user weapon = usp , then do ur func
else if user team is T and if user weapon = glock
do ur func
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-19-2010 , 13:27   Re: [Help] How to get this Event?
Reply With Quote #3

Try something like this, check the weapon in addplayeritem fwd.

Untested, written mostly on my phone. You will need to add additional checks to see if player was just spawned.

PHP Code:
RegisterHam(Ham_AddPlayerItem"player""AddPlayerItem");

public 
AddPlayerItem(ClEnt)
{
        new 
iWeapID cs_get_weapon_idEnt );

        
//prevent item from being given
        
if ( condition )
        {
               
SetHamReturnInteger(false);
 
               return 
HAM_SUPERCEDE;
        }

        return 
HAM_IGNORED;

__________________

Last edited by Bugsy; 11-19-2010 at 13:31.
Bugsy is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-20-2010 , 03:30   Re: [Help] How to get this Event?
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
Try something like this, check the weapon in addplayeritem fwd.

Untested, written mostly on my phone. You will need to add additional checks to see if player was just spawned.

PHP Code:
RegisterHam(Ham_AddPlayerItem"player""AddPlayerItem");
 
public 
AddPlayerItem(ClEnt)
{
        new 
iWeapID cs_get_weapon_idEnt );
 
        
//prevent item from being given
        
if ( condition )
        {
               
SetHamReturnInteger(false);
 
               return 
HAM_SUPERCEDE;
        }
 
        return 
HAM_IGNORED;

You should also kill the entity
Code:
entity_set_int(Ent, EV_INT_flags, FL_KILLME);
__________________
hleV is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-20-2010 , 11:43   Re: [Help] How to get this Event?
Reply With Quote #5

Quote:
Originally Posted by hleV View Post
You should also kill the entity
Code:
entity_set_int(Ent, EV_INT_flags, FL_KILLME);
Buy or pickup a primary weapon and then say "hi". Test again with SetHamReturnInteger( 0 ) and return HAM_SUPERCEDE commented out.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_iWeaponEnt;

public 
plugin_init()
{
    
RegisterHamHam_AddPlayerItem "player" "fw_HamAddPlayerItem" );
    
    
register_clcmd"say hi" "TestFunc" );
}

public 
fw_HamAddPlayerItemid iWeapon )
{
    if( 
ExecuteHamHam_Item_ItemSlot iWeapon ) == )
    {
        
g_iWeaponEnt iWeapon;
        
        
client_printid print_chat "Primary weapon blocked" );
        
        
SetHamReturnInteger);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}  

public 
TestFuncid )
{
    
client_printid print_chat "Weapon Exists ? %s" pev_validg_iWeaponEnt ) ? "true" "false" );

__________________

Last edited by Bugsy; 11-20-2010 at 11:51.
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 11:22.


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