Raised This Month: $ Target: $400
 0% 

say weapons and reload 1 bullet help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MouseSplash!
Veteran Member
Join Date: Dec 2009
Location: En Tu Mente!
Old 12-24-2009 , 17:59   say weapons and reload 1 bullet help
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>

 
new cv_deagle_clipgmsgCurWeaponweapon[33], deagle_clip[33], deagle_bpammo[33];

 public 
plugin_init()
 {
    
register_plugin("AWP One Shot","0.11","Avalanche");

    
register_event("CurWeapon","event_curweapon","b");
    
register_event("AmmoX","event_ammox","b");

    
gmsgCurWeapon get_user_msgid("CurWeapon");
    
cv_deagle_clip register_cvar("deagle_clip","1");

    
register_forward(FM_CmdStart,"fw_cmdstart",1);
    
register_clcmd("say /deagle""Reglas")
    
register_clcmd("say /usp""usp")
    
register_clcmd("say /glock""glock")
 }

  public 
deagle(id)
 {
            
cs_set_weapon_ammogive_itemid"weapon_deagle" ), )
            
cs_set_user_bpammoidCSW_DEAGLE10 )
 }
 
   public 
usp(id)
 {
            
cs_set_weapon_ammogive_itemid"weapon_usp" ), )
            
cs_set_user_bpammoidCSW_USP10 )
 }
 
  public 
glock(id)
 {
            
cs_set_weapon_ammogive_itemid"weapon_glock18" ), )
            
cs_set_user_bpammoidCSW_GLOCK1810 )
 }
 
// reset values
 
public client_putinserver(id)
 {
    
weapon[id] = 0;
    
deagle_clip[id] = 0;
    
deagle_bpammo[id] = 0;
 }

 
// restrict clip ammo
 
public event_curweapon(id)
 {
    new 
status read_data(1);

    if(
statusweapon[id] = read_data(2);

    
// using AWP
    
if(read_data(2) == CSW_DEAGLE)
    {
        
// current weapon
        
if(status)
        {
            
// save clip information
            
new old_deagle_clip deagle_clip[id];
            
deagle_clip[id] = read_data(3);

            new 
max_clip get_pcvar_num(cv_deagle_clip);

            
// plugin enabled and must restrict ammo
            
if(max_clip && deagle_clip[id] > max_clip)
            {
                new 
wEnt get_weapon_ent(id,CSW_DEAGLE);
                if(
pev_valid(wEnt)) cs_set_weapon_ammo(wEnt,max_clip);

                
// update HUD
                
message_begin(MSG_ONE,gmsgCurWeapon,_,id);
                
write_byte(1);
                
write_byte(CSW_DEAGLE);
                
write_byte(max_clip);
                
message_end();

                
// don't steal ammo from the player
                
if(deagle_bpammo[id] && deagle_clip[id] > old_deagle_clip)
                    
cs_set_user_bpammo(id,CSW_DEAGLE,deagle_bpammo[id]-max_clip+old_deagle_clip);

                
deagle_clip[id] = max_clip;
            }
        }
        else 
deagle_clip[id] = 999;
    }
    else if(
statusdeagle_clip[id] = 999;
 }

 
// delayed record bpammo information
 
public event_ammox(id)
 {
    
// awp ammo type is 1
    
if(read_data(1) == 1)
    {
        static 
parms[2];
        
parms[0] = id;
        
parms[1] = read_data(2);

        
set_task(0.1,"record_ammo",id,parms,2);
    }
 }

 
// delay, because ammox is called right before curweapon
 
public record_ammo(parms[])
 {
    
deagle_bpammo[parms[0]] = parms[1];
 }

 
// block reload based on new clip size
 
public fw_cmdstart(player,uc_handle,random_seed)
 {
    new 
max_clip get_pcvar_num(cv_deagle_clip);

    if(
weapon[player] == CSW_DEAGLE && max_clip && deagle_clip[player] >= max_clip)
    {
        
set_uc(uc_handle,UC_Buttons,get_uc(uc_handle,UC_Buttons) & ~IN_RELOAD);
        return 
FMRES_HANDLED;
    }

    return 
FMRES_IGNORED;
 }

 
// find a player's weapon entity
 
stock get_weapon_ent(id,wpnid=0,wpnName[]="")
 {
    
// who knows what wpnName will be
    
static newName[32];

    
// need to find the name
    
if(wpnidget_weaponname(wpnid,newName,31);

    
// go with what we were told
    
else formatex(newName,31,"%s",wpnName);

    
// prefix it if we need to
    
if(!equal(newName,"weapon_",7))
        
format(newName,31,"weapon_%s",newName);

    new 
ent;
    while((
ent engfunc(EngFunc_FindEntityByString,ent,"classname",newName)) && pev(ent,pev_owner) != id) {}

    return 
ent;
 } 
1. help to add usp and glock in the Function
2. activates the function(plugin reload) after giving me the weapon
3. in the next round desactivate the function(plugin reload)


+Karma

Last edited by MouseSplash!; 12-25-2009 at 15:46.
MouseSplash! is offline
MouseSplash!
Veteran Member
Join Date: Dec 2009
Location: En Tu Mente!
Old 12-24-2009 , 23:21   Re: Help[add weapons and turn off and on]
Reply With Quote #2

Help Pls!
MouseSplash! is offline
Hasler
BANNED
Join Date: Jul 2009
Location: Argentina, Rosario
Old 12-25-2009 , 00:34   Re: Help[add weapons and turn off and on]
Reply With Quote #3

why you are banned?
Hasler 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 04:06.


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