AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   May be deleted (https://forums.alliedmods.net/showthread.php?t=270651)

deviss 08-26-2015 05:35

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

Thanks.


HamletEagle 08-26-2015 05:54

Re: Picking doesn't work correctly
 
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.

deviss 08-26-2015 06:18

Re: Picking doesn't work correctly
 
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?

HamletEagle 08-26-2015 07:16

Re: Picking doesn't work correctly
 
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.

deviss 08-26-2015 07:42

Re: Picking doesn't work correctly
 
Created the thread into the right section, thanks.

HamletEagle 08-26-2015 08:58

Re: Picking doesn't work correctly
 
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.

fysiks 08-26-2015 09:42

Re: Picking doesn't work correctly
 
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).

deviss 08-26-2015 11:44

Re: Picking doesn't work correctly
 
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.


All times are GMT -4. The time now is 22:18.

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