AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change armoury_entity bpammo (https://forums.alliedmods.net/showthread.php?t=134813)

andregb8 08-08-2010 22:56

Change armoury_entity bpammo
 
How can I change armoury_entities bpammo when they spawn? I want that all armoury_entities spawn with their max bpammo. Sorry for my english...

I tried:

PHP Code:

#include < amxmodx >
#include < fakemeta >

new const g_iMaxBpAmmo[ ] =
{
    
0309020090,
    
321001003552,
    
1202111
}

const 
m_iPrimaryAmmoType 49
const m_iDefaultAmmo 56

new g_iFwdPrecacheSpawn;

public 
plugin_precache( )
{
    
g_iFwdPrecacheSpawn register_forwardFM_Spawn"FwdPrecacheSpawn");
}

public 
plugin_init( )
{
    
register_plugin"armoury_entity max bpammo""1.0""!-Radio-man" );
    
unregister_forwardFM_Spawng_iFwdPrecacheSpawn);
}

public 
FwdPrecacheSpawniEnt )
{
    if( !
pev_validiEnt ) )
    {
        return 
FMRES_IGNORED;
    }
   
    static 
szClass15 ];
    
peviEntpev_classnameszClass14 );
   
    if( !
equalszClass"armoury_entity" ) )
    {
        return 
FMRES_IGNORED;
    }
   
    
set_pdata_intiEntm_iDefaultAmmog_iMaxBpAmmoget_pdata_intiEntm_iPrimaryAmmoType) ], );
    return 
FMRES_IGNORED;



ConnorMcLeod 08-09-2010 05:25

Re: Change armoury_entity bpammo
 
your offsets are wrong.

armouries offsets are :

34 m_iType
35 m_iCount // that one you need

You have to set them after each new round, you can hook Ham_Respawn post for this.

ResgisterHam(Ham_Respawn, "armoury_entity", "Armoury_Entity_Respawn", 1)

Code:
public Armoury_Entity_Respawn( iEnt ) {   set_pdata_int(iEnt, m_iCount, ANYVALUE, ARMOURY_ENTITY_EXTRAOFFSET) }

andregb8 08-09-2010 16:10

Re: Change armoury_entity bpammo
 
It still didn't work:

PHP Code:

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

const m_iCount 35;

public 
plugin_init( )
{
    
register_plugin"armoury_entity max bpammo""1.1""!-Radio-man" );
    
    
RegisterHamHam_Respawn"armoury_entity""FwdRespawn");
}

public 
FwdRespawniEnt )
{
    
set_pdata_intiEntm_iCount90); // 90 bullets only to test



xPaw 08-09-2010 16:59

Re: Change armoury_entity bpammo
 
Try Ham_CS_Restart

andregb8 08-09-2010 17:34

Re: Change armoury_entity bpammo
 
Now it works. But this offset changes the number of weapons, not the number of bullets in the backpack.

ConnorMcLeod 08-09-2010 19:59

Re: Change armoury_entity bpammo
 
Then extraoffset could be 5.
Look at cstrike module sources cstrike.h


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

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