AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   (Request) Is still impossible to pick up more than 1 weapon? (https://forums.alliedmods.net/showthread.php?t=337539)

Ark_Procession 04-26-2022 22:49

(Request) Is still impossible to pick up more than 1 weapon?
 
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

Bugsy 04-26-2022 23:23

Re: (Request) Is still impossible to pick up more than 1 weapon?
 
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" );
    }



Ark_Procession 04-27-2022 13:10

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

Originally Posted by Bugsy (Post 2778050)
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.

Bugsy 04-27-2022 13:31

Re: (Request) Is still impossible to pick up more than 1 weapon?
 
Yes, I've written this before, try searching

Ark_Procession 04-27-2022 15:58

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

Originally Posted by Bugsy (Post 2778114)
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. :)

Bugsy 04-27-2022 18:50

Re: (Request) Is still impossible to pick up more than 1 weapon?
 
https://forums.alliedmods.net/showpo...1&postcount=19

Ark_Procession 04-27-2022 20:48

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

Originally Posted by Bugsy (Post 2778135)

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?

Bugsy 04-28-2022 10:08

Re: (Request) Is still impossible to pick up more than 1 weapon?
 
I'll fix the c4 issue and add cvars so you can set primary/secondary limits

Ark_Procession 04-28-2022 15:30

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

Originally Posted by Bugsy (Post 2778178)
I'll fix the c4 issue and add cvars so you can set primary/secondary limits

Thank you :)

Bugsy 04-28-2022 20:12

Re: (Request) Is still impossible to pick up more than 1 weapon?
 
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;




All times are GMT -4. The time now is 04:39.

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