AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Adding Burst-Fire Mode to a weapon (https://forums.alliedmods.net/showthread.php?t=308742)

D4rkSiD3Rs 07-01-2018 16:24

Adding Burst-Fire Mode to a weapon
 
Hello,
I'm looking for a plugin which add Burst-Fire Mode mod automatically to a weapon (like glock, famas..)

maqi 07-01-2018 16:27

Re: Adding Burst-Fire Mode to a weapon
 
This is simple, give me more info ill make it. When someone spawns u want his burst mode to be set ?

Also, is it not ? I have no idea hahaha

D4rkSiD3Rs 07-01-2018 16:33

Re: Adding Burst-Fire Mode to a weapon
 
No, I want it to be only on a specific weapon not for all weapons (for example M249)

maqi 07-01-2018 16:36

Re: Adding Burst-Fire Mode to a weapon
 
I have no idea what M249 is, what mod is this for ?

D4rkSiD3Rs 07-01-2018 16:37

Re: Adding Burst-Fire Mode to a weapon
 
It's the machine gun, on Counter-Strike 1.6 x)

maqi 07-01-2018 16:39

Re: Adding Burst-Fire Mode to a weapon
 
It can't have burst, only famas and glock can.

D4rkSiD3Rs 07-01-2018 16:44

Re: Adding Burst-Fire Mode to a weapon
 
That's why i'm asking for that plugin!

maqi 07-01-2018 16:45

Re: Adding Burst-Fire Mode to a weapon
 
Sure, give me a few minutes to finish a dungeon.

maqi 07-01-2018 17:09

Re: Adding Burst-Fire Mode to a weapon
 
This should work

PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >

#pragma semicolon 1

#define PLUGIN "Force burst"
#define VERSION "1.0a"

#define TASKID_BURST 16123

new const m_rgpPlayerItems_CBasePlayer[6] = {367,368,...};

public 
plugin_init( ) 
{
    
register_pluginPLUGINVERSION"maqi" );
    
    
RegisterHamHam_Spawn"player""Event_PlayerSpawnPost");
    
    
register_event"WeapPickup""Event_WeaponPickup""be" );
}

public 
Event_WeaponPickupiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Event_PlayerSpawnPostiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Task_EnablePlayerBurst( const iTaskID )
{
    new 
iIndex iTaskID TASKID_BURST;
    
    if( 
user_has_weaponiIndexCSW_FAMAS ) && HamGetWeaponEntityIDiIndexCSW_FAMAS ) )
        
EnableWeaponBurstiIndexCSW_FAMAS );
    
    if( 
user_has_weaponiIndexCSW_GLOCK18 ) && HamGetWeaponEntityIDiIndexCSW_GLOCK18 ) )
        
EnableWeaponBurstiIndexCSW_GLOCK18 );
}


EnableWeaponBurstiIndexiWeapon )
{
    if( !
cs_get_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ) ) )
        
cs_set_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ), );
}

stock HamGetWeaponEntityIDiIndexiWeaponID )
{
    new 
iWeaponEnt;
    for(new 
i=1i<6i++)
    {
        
iWeaponEnt get_pdata_cbaseiIndexm_rgpPlayerItems_CBasePlayer[i] );
        while( 
pev_valid(iWeaponEnt) )
        {
            if( 
get_pdata_int(iWeaponEnt434) == iWeaponID )
                return 
iWeaponEnt;
                
            
iWeaponEnt get_pdata_cbaseiWeaponEnt42);
        }
    }
    return 
0;


EDIT: Edited the code above to actually work when people are buying/picking up weapons.

D4rkSiD3Rs 07-01-2018 17:35

Re: Adding Burst-Fire Mode to a weapon
 
Quote:

Originally Posted by maqi (Post 2600413)
This should work

PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >

#pragma semicolon 1

#define PLUGIN "Force burst"
#define VERSION "1.0a"

#define TASKID_BURST 16123

new const m_rgpPlayerItems_CBasePlayer[6] = {367,368,...};

public 
plugin_init( ) 
{
    
register_pluginPLUGINVERSION"maqi" );
    
    
RegisterHamHam_Spawn"player""Event_PlayerSpawnPost");
    
    
register_event"WeapPickup""Event_WeaponPickup""be" );
}

public 
Event_WeaponPickupiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Event_PlayerSpawnPostiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Task_EnablePlayerBurst( const iTaskID )
{
    new 
iIndex iTaskID TASKID_BURST;
    
    if( 
user_has_weaponiIndexCSW_FAMAS ) && HamGetWeaponEntityIDiIndexCSW_FAMAS ) )
        
EnableWeaponBurstiIndexCSW_FAMAS );
    
    if( 
user_has_weaponiIndexCSW_GLOCK18 ) && HamGetWeaponEntityIDiIndexCSW_GLOCK18 ) )
        
EnableWeaponBurstiIndexCSW_GLOCK18 );
}


EnableWeaponBurstiIndexiWeapon )
{
    if( !
cs_get_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ) ) )
        
cs_set_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ), );
}

stock HamGetWeaponEntityIDiIndexiWeaponID )
{
    new 
iWeaponEnt;
    for(new 
i=1i<6i++)
    {
        
iWeaponEnt get_pdata_cbaseiIndexm_rgpPlayerItems_CBasePlayer[i] );
        while( 
pev_valid(iWeaponEnt) )
        {
            if( 
get_pdata_int(iWeaponEnt434) == iWeaponID )
                return 
iWeaponEnt;
                
            
iWeaponEnt get_pdata_cbaseiWeaponEnt42);
        }
    }
    return 
0;


EDIT: Edited the code above to actually work when people are buying/picking up weapons.

I tested it on my furien mod but it's not working! I edited it to be on M249

PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < cstrike >

#pragma semicolon 1

#define PLUGIN "Force burst"
#define VERSION "1.0a"

#define TASKID_BURST 16123

new const m_rgpPlayerItems_CBasePlayer[6] = {367,368,...};

public 
plugin_init( ) 
{
    
register_pluginPLUGINVERSION"maqi" );
    
    
RegisterHamHam_Spawn"player""Event_PlayerSpawnPost");
    
    
register_event"WeapPickup""Event_WeaponPickup""be" );
}

public 
Event_WeaponPickupiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Event_PlayerSpawnPostiIndex )
{
    if( !
is_user_connectediIndex ) )
        return;
    
    if( 
remove_taskTASKID_BURST iIndex ) )
        
set_task0.5"Task_EnablePlayerBurst"TASKID_BURST iIndex );
}

public 
Task_EnablePlayerBurst( const iTaskID )
{
    new 
iIndex iTaskID TASKID_BURST;
    
    if( 
user_has_weaponiIndexCSW_M249 ) && HamGetWeaponEntityIDiIndexCSW_M249 ) )
        
EnableWeaponBurstiIndexCSW_M249 );
}


EnableWeaponBurstiIndexiWeapon )
{
    if( !
cs_get_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ) ) )
        
cs_set_weapon_burstHamGetWeaponEntityIDiIndexiWeapon ), );
}

stock HamGetWeaponEntityIDiIndexiWeaponID )
{
    new 
iWeaponEnt;
    for(new 
i=1i<6i++)
    {
        
iWeaponEnt get_pdata_cbaseiIndexm_rgpPlayerItems_CBasePlayer[i] );
        while( 
pev_valid(iWeaponEnt) )
        {
            if( 
get_pdata_int(iWeaponEnt434) == iWeaponID )
                return 
iWeaponEnt;
                
            
iWeaponEnt get_pdata_cbaseiWeaponEnt42);
        }
    }
    return 
0;




All times are GMT -4. The time now is 05:07.

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