Raised This Month: $ Target: $400
 0% 

May be deleted


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-26-2015 , 05:54   Re: Picking doesn't work correctly
Reply With Quote #1

The code is wrong, touch is hooked between armoury_entity, weaponbox and any other entity. You should make sure that the id is a player. Also the classname check is wrong, because it will always be armoury_entity or weaponbox and not the weapon classname.

To know what weapon an armoury_entity contain do:
PHP Code:
new Weapon cs_get_armoury_type(armoury_entity
To know what weapon a weaponbox entity contain use this stock by connor:
PHP Code:
const XO_CWEAPONBOX 4
new const 
m_rgpPlayerItems_CWeaponBox[6] = {34,35,...}; 

GetWeaponBoxWeaponTypeent 

    new 
weapon
    for(new 
1i<= 5i++) 
    { 
        
weapon get_pdata_cbase(entm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX); 
        if( 
weapon 
        { 
            return 
cs_get_weapon_id(weapon); 
        } 
    } 

    return 
0

It basically loop all weapon slots from the weaponbox and return the found weapon. It's not 100% correct, but should work in most of conditions. This code assume that the box contain only one weapon, but it can contain more. In CS it usually contain only one weapon, so it's ok.

To know if he touched an armoury_entity or a weaponbox you should have two different callbacks for the Ham_Touch forward or check inside it the classname like:
PHP Code:
switch(ClassName[0])
{
    case 
'a':
    {
        
//armoury entity touched
    
}
    case 
'w':
    {
        
//weaponbox entity touched
    
}

After you get the weapon index check if it is the restricted weapon(CSW_AWP), if so supercede the hook, else do nothing.
__________________

Last edited by HamletEagle; 08-26-2015 at 05:56.
HamletEagle is offline
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 22:18.


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