Raised This Month: $359 Target: $400
 89%   Almost there!

(Request) Is still impossible to pick up more than 1 weapon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 04-26-2022 , 22:49   (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #1

With amx 1.9 and later, i was wondering if more than 1 primary weapon was still impossible to make?

this plugin does not work properly:

https://forums.alliedmods.net/showthread.php?t=50926
Ark_Procession is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-26-2022 , 23:23   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #2

Possible
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fun>

public plugin_init()
{
    
RegisterHamHam_Spawn "player" "Spawn" true );
}

public 
SpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        
give_itemiPlayer "weapon_awp" );
        
give_itemiPlayer "weapon_m4a1" );
    }

__________________
Bugsy is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 04-27-2022 , 13:10   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Possible
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fun>

public plugin_init()
{
    
RegisterHamHam_Spawn "player" "Spawn" true );
}

public 
SpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        
give_itemiPlayer "weapon_awp" );
        
give_itemiPlayer "weapon_m4a1" );
    }

Thats seems great! but i was refering to be able to pick up whatever weapon is on the floor and have two primary and two secondary weapons as max.
Ark_Procession is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2022 , 13:31   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #4

Yes, I've written this before, try searching
__________________
Bugsy is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 04-27-2022 , 15:58   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Yes, I've written this before, try searching
haha don't punish me i always search, the thing is it is not a main plugin you developed and cannot see it on your profile, but i will look in the advanced search, if you say you developed then there must be out there.
Ark_Procession is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2022 , 18:50   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #6

https://forums.alliedmods.net/showpo...1&postcount=19
__________________
Bugsy is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 04-27-2022 , 20:48   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
Tested it a little bit! seems awesome!

Only problem i don't seem to be able to pick up C4 once i drop it! terrible bug

Edit: how to limit pickups to 2 primary and 2 secondary?

Last edited by Ark_Procession; 04-27-2022 at 20:50.
Ark_Procession is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2022 , 10:08   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #8

I'll fix the c4 issue and add cvars so you can set primary/secondary limits
__________________
Bugsy is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 04-28-2022 , 15:30   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
I'll fix the c4 issue and add cvars so you can set primary/secondary limits
Thank you
Ark_Procession is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2022 , 20:12   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #10

Some credit to Arkshine for his weapon from weaponbox to player code. Not thoroughly tested, and not sure off the top of my head what the slot maximums are. I tested only up to 3 in slots 1 and 2.

Edit: Fixed shield issue
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <hamsandwich>

new const Version[] = "0.3";

enum WeaponSlots
{
    
Slot1 1,
    
Slot2
}
new 
g_pMaxWeaponsWeaponSlots ];

public 
plugin_init() 
{
    
register_plugin"Multiple Weapons" Version "bugsy" );
   
    
register_touch"weaponbox" "player" "TouchWeaponbox" );
    
register_forwardFM_SetModel "SetModel" );
    
    
g_pMaxWeaponsSlot1 ] = register_cvar"mw_maxslot1" "2" );
    
g_pMaxWeaponsSlot2 ] = register_cvar"mw_maxslot2" "2" );
}

public 
SetModeliEntity , const szModel[] )
{
    new 
szClassname32 ] , iWeaponEntID;
    
    
peviEntity pev_classname szClassname charsmaxszClassname ) );
    
    if ( 
equal szClassname "weaponbox" ) )
    {
        if ( 
pev_valid( ( iWeaponEntID GetWeaponEntityFromWeaponboxiEntity ) ) ) )
        {
            
set_peviEntity pev_iuser2 cs_get_user_bpammopeviEntity pev_owner ) , cs_get_weapon_idiWeaponEntID ) ) );
        }
    }


public 
TouchWeaponboxiEntity id )
{    
    if ( !( 
peviEntity pev_flags ) & FL_ONGROUND ) ) 
        return 
PLUGIN_CONTINUE;
        
    new 
iWeaponIndex WeaponSlots:iSlot iWeaponEntID;

    if ( ( 
iWeaponEntID GetWeaponEntityFromWeaponboxiEntity ) ) > )
    {
        
iWeaponIndex cs_get_weapon_idiWeaponEntID );
        
        if ( ( 
CSW_P228 <= iWeaponIndex <= CSW_P90 ) && ( iWeaponIndex != CSW_C4 ) && !cs_get_user_shieldid ) && !user_has_weaponid iWeaponIndex ) )
        {
            
iSlot WeaponSlots:ExecuteHamHam_Item_ItemSlot iWeaponEntID );

            if ( 
GetWeaponCountBySlotid iSlot ) < get_pcvar_numg_pMaxWeaponsiSlot ] ) )
            {
                if ( 
ExecuteHamHam_AddPlayerItem id iWeaponEntID ) )
                {
                    
ExecuteHamHam_Item_AttachToPlayer iWeaponEntID id );
                    
cs_set_user_bpammoid iWeaponIndex peviEntity pev_iuser2 ) );
                    
emit_soundid CHAN_ITEM "items/gunpickup2.wav" VOL_NORM ATTN_NORM PITCH_NORM );
                    
set_peviEntity pev_flagspeviEntity pev_flags ) | FL_KILLME );
                }
            }
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

GetWeaponCountBySlotid WeaponSlots:iSlot )
{    
    new 
iWeapons iEntity;
    new const 
m_rgpPlayerItems_Player] = { 367 368 369 370 371 372 };
    const 
m_pNext 42;
    
    
iEntity get_pdata_cbaseid m_rgpPlayerItems_Player_:iSlot ] );

    while ( 
iEntity )
    {
        
iWeapons++;
        
iEntity get_pdata_cbaseiEntity m_pNext );
    }
    
    return 
iWeapons;
}

GetWeaponEntityFromWeaponboxiWeaponBox )
{
    new const 
m_rgpPlayerItems_Weaponbox] = { 34 35 , ... };
    new 
iWeaponEntID;

    for ( new 
WeaponSlots:iSlot Slot1 iSlot <= Slot2 iSlot++ )
    {
        if ( ( 
iWeaponEntID get_pdata_cbaseiWeaponBox m_rgpPlayerItems_Weaponbox] + _:iSlot ) ) > )
            break;
    }    
    
    return ( 
iWeaponEntID ) ? iWeaponEntID 0;

__________________

Last edited by Bugsy; 05-29-2022 at 01:51.
Bugsy is offline
Reply


Thread Tools
Display Modes

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 21:30.


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