Raised This Month: $ Target: $400
 0% 

Pick up only deagle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Unkolix
Veteran Member
Join Date: Sep 2012
Old 09-01-2014 , 17:19   Re: Pick up only deagle
Reply With Quote #3

Thanks, but that code is way too complicated and I am not sure if it will work with my code...
Here's what I've done (I am 95% sure, that I've done something wrong):

PHP Code:
RegisterHam(Ham_Touch"armoury_entity""OnCArmoury_ArmouryTouch"false);
RegisterHam(Ham_Touch"weapon_shield""OnCArmoury_ArmouryTouch"false); //Should I add this? Or the code will stop from picking shield too?
RegisterHam(Ham_Touch"weaponbox""OnCWeaponBox_Touch"false);

/////////

public OnCArmoury_ArmouryTouch(iArmouryid
{          
    if(
IsPlayer(id) && !CanUserPickupWeapon(idcs_get_armoury_type(iArmoury)))
    {
        return 
HAM_SUPERCEDE
    
}
    
    return 
HAM_IGNORED;


public 
OnCWeaponBox_Touch(iWeaponBoxid
{
    if(
IsPlayer(id) && is_user_alive(id) && pev(iWeaponBoxpev_flags) & FL_ONGROUND && !get_pdata_bool(idm_bUsesShield) && !CanUserPickupWeapon(idcs_get_weaponbox_type(iWeaponBox)))
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;


cs_get_weaponbox_type(iWeaponBox// assuming weaponbox contain only 1 weapon
{
    new 
iWeapon
    
for(new i=1i<=5i++)
    {
        
iWeapon get_pdata_cbase(iWeaponBoxm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX)
        if(
iWeapon 0)
        {
            return 
cs_get_weapon_id(iWeapon)
        }
    }
    return 
0
}

bool:CanUserPickupWeapon(idiWeaponType// if( CanUserPickupWeapon(id, CSW_AWP) )
{
    if(
CanUserPickupWeapon(idCSW_DEAGLE)) //Not sure what I am doing here
        
return true
        
    
return false
}

/////////

        
case LR_TOSS:
        {
            
g_bDropWeapon false
            CanUserPickupWeapon
(tempidCSW_DEAGLE//Is thir right?
            
CanUserPickupWeapon(idCSW_DEAGLE//Is thir right?
            
            
strip_user_weapons(tempid);
            new 
weapon give_item(tempid"weapon_deagle")
            
cs_set_weapon_ammo(weapon0)
            
cs_set_user_bpammo(tempid,CSW_DEAGLE0)
            
give_item(tempid"weapon_knife")
            
            
strip_user_weapons(id);
            new 
weapon2 give_item(id"weapon_deagle")
            
cs_set_weapon_ammo(weapon20)
            
cs_set_user_bpammo(id,CSW_DEAGLE0)
            
give_item(id"weapon_knife")
            
            new 
szName[32], szName2[32]
            
get_user_name(idszName31);
            
get_user_name(tempidszName231);
            
client_print(0print_center"%s pries %s^n Ginklo metimas",szNameszName2)    
            
            if( 
is_user_alive(tempid) )
                
set_user_health(tempid100);
                
            
set_task(0.1"beacon"id)
            
set_task(0.1"beacon"tempid)
        } 
Basicly, I want this code to work only when LR_TOSS is active (JB Last Request toss challenge, where palyer drop their deagles as far as possible and I want them to be able to pick up the deagles).
Unkolix 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 00:09.


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