Quote:
Originally Posted by bat
|
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(iArmoury, id)
{
if(IsPlayer(id) && !CanUserPickupWeapon(id, cs_get_armoury_type(iArmoury)))
{
return HAM_SUPERCEDE
}
return HAM_IGNORED;
}
public OnCWeaponBox_Touch(iWeaponBox, id)
{
if(IsPlayer(id) && is_user_alive(id) && pev(iWeaponBox, pev_flags) & FL_ONGROUND && !get_pdata_bool(id, m_bUsesShield) && !CanUserPickupWeapon(id, cs_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=1; i<=5; i++)
{
iWeapon = get_pdata_cbase(iWeaponBox, m_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX)
if(iWeapon > 0)
{
return cs_get_weapon_id(iWeapon)
}
}
return 0
}
bool:CanUserPickupWeapon(id, iWeaponType) // if( CanUserPickupWeapon(id, CSW_AWP) )
{
if(CanUserPickupWeapon(id, CSW_DEAGLE)) //Not sure what I am doing here
return true
return false
}
/////////
case LR_TOSS:
{
g_bDropWeapon = false
CanUserPickupWeapon(tempid, CSW_DEAGLE) //Is thir right?
CanUserPickupWeapon(id, CSW_DEAGLE) //Is thir right?
strip_user_weapons(tempid);
new weapon = give_item(tempid, "weapon_deagle")
cs_set_weapon_ammo(weapon, 0)
cs_set_user_bpammo(tempid,CSW_DEAGLE, 0)
give_item(tempid, "weapon_knife")
strip_user_weapons(id);
new weapon2 = give_item(id, "weapon_deagle")
cs_set_weapon_ammo(weapon2, 0)
cs_set_user_bpammo(id,CSW_DEAGLE, 0)
give_item(id, "weapon_knife")
new szName[32], szName2[32]
get_user_name(id, szName, 31);
get_user_name(tempid, szName2, 31);
client_print(0, print_center, "%s pries %s^n Ginklo metimas",szName, szName2)
if( is_user_alive(tempid) )
set_user_health(tempid, 100);
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).