Raised This Month: $ Target: $400
 0% 

May be deleted


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deviss
Member
Join Date: Feb 2011
Old 08-26-2015 , 05:35   May be deleted
Reply With Quote #1

I've re-posted into the right section: Suggestions / Requests

Thanks.


Last edited by deviss; 08-26-2015 at 12:25.
deviss is offline
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 #2

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
deviss
Member
Join Date: Feb 2011
Old 08-26-2015 , 06:18   Re: Picking doesn't work correctly
Reply With Quote #3

I'm not good at all on the amxx since I'm a newbie into that.

Could you point me what to change into exactly what? Which part of the plugin has to be changed and what to use instead of that?

Last edited by deviss; 08-26-2015 at 06:19.
deviss is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-26-2015 , 07:16   Re: Picking doesn't work correctly
Reply With Quote #4

I show you exactly what to change and what to use. You are in scripting help forum, this means that you are willing to try to fix it based on advices. If you want someone to do it for you then you should ask in suggestions/request forum.
__________________
HamletEagle is offline
deviss
Member
Join Date: Feb 2011
Old 08-26-2015 , 07:42   Re: Picking doesn't work correctly
Reply With Quote #5

Created the thread into the right section, thanks.

Last edited by deviss; 08-26-2015 at 12:24. Reason: miss interpreted, thread created where it should belong
deviss is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-26-2015 , 08:58   Re: Picking doesn't work correctly
Reply With Quote #6

I am not sure where did you see that I was not kind or that I didn't want to help you. You must understand that this forums have their one purposes: this one is only for scripting help, not ready made things. In fact, it took me more to explain the problem that I would take to just fix the code.
__________________
HamletEagle is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-26-2015 , 09:42   Re: Picking doesn't work correctly
Reply With Quote #7

This forum is about learning how to do it on your own (with the help of others) without just doing it for you. This takes effort on your part to do it. If you are asking Scripting Help questions in the Requests forum, you're not likely to get someone to just do it for you (that is not being mean, that is just how things work).
__________________
fysiks is offline
deviss
Member
Join Date: Feb 2011
Old 08-26-2015 , 11:44   Re: Picking doesn't work correctly
Reply With Quote #8

My bad for posting into the wrong section in this case.

@Hamlet, I think I miss wrote my post, wasn't reffering to you and was definetly not an intention either as you've helped me in the past as well and I always appreciate any help that I can find on this forum.
deviss 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