Raised This Month: $ Target: $400
 0% 

Jetpack+Bazooka


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-26-2011 , 15:17   Re: Jetpack+Bazooka
Reply With Quote #4

zombie_plague40.sma:
On drop:
PHP Code:
stock drop_weapons(iddropwhat)
{
    
// Get user weapons
    
static weapons[32], numiweaponid
    num 
// reset passed weapons count (bugfix)
    
get_user_weapons(idweaponsnum)
    
    
// Loop through them and drop primaries or secondaries
    
for (0numi++)
    {
        
// Prevent re-indexing the array
        
weaponid weapons[i]
        
        if ((
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
        {
            
// Get weapon entity
            
static wname[32], weapon_ent
            get_weaponname
(weaponidwnamecharsmax(wname))
            
weapon_ent fm_find_ent_by_owner(-1wnameid)
            
            
// Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO
            
set_pev(weapon_entPEV_ADDITIONAL_AMMOcs_get_user_bpammo(idweaponid))
            
            
// Player drops the weapon and looses his bpammo
            
engclient_cmd(id"drop"wname)
            
cs_set_user_bpammo(idweaponid0)
        }
    }

On pickup:
PHP Code:
public fw_AddPlayerItem(idweapon_ent)
{
    
// HACK: Retrieve our custom extra ammo from the weapon
    
static extra_ammo
    extra_ammo 
pev(weapon_entPEV_ADDITIONAL_AMMO)
    
    
// If present
    
if (extra_ammo)
    {
        
// Get weapon's id
        
static weaponid
        weaponid 
cs_get_weapon_id(weapon_ent)
        
        
// Add to player's bpammo
        
ExecuteHamB(Ham_GiveAmmoidextra_ammoAMMOTYPE[weaponid], MAXBPAMMO[weaponid])
        
set_pev(weapon_entPEV_ADDITIONAL_AMMO0
I told you to store fuel in pev_iuser2 (since pev_iuser1 is used by ZP to store BP ammo) on drop and restore on pickup, just like in code above. But instead of giving ammo, set fuel.
Read ZP plugin source code for more information.
__________________

SonicSonedit is offline
 



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 19:47.


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