This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

plugin help, i need adapt 2 weapons+


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MaNuCs
BANNED
Join Date: Oct 2009
Location: Venezuela
Old 12-23-2009 , 23:57   plugin help, i need adapt 2 weapons+
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;
 } 
HELP
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)

PD:

2) i can use bool but... i dont khow use the bool in this plugin :S
3) i use the ham spawn but... need te variable or bool for desactivating..

help me pls

i Give Double Karma

+Karma +Karma

Last edited by MaNuCs; 12-24-2009 at 05:40.
MaNuCs is offline
Send a message via MSN to MaNuCs
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 12:48.


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