Raised This Month: $ Target: $400
 0% 

Solved Orpheu & WeaponBox


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 07:38   Re: Orpheu & WeaponBox
Reply With Quote #1

Quote:
Originally Posted by HamletEagle View Post
You are looking at the wrong class. This one is from class CGrenade, but you want CWeaponBox class.
Ah, you're right
PHP Code:
class CWeaponBox: public CBaseEntity
void EXPORT Kill
(); 
Thanks a bunch!
__________________
edon1337 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 12:37   Re: Orpheu & WeaponBox
Reply With Quote #2

So this plugin is supposed to create the weapons listed in the g_szWeapons string, but apparently it's not. I debugged and everything was okay, are the models not being set?

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < superspawns >
#include < cstrike >
#include < orpheu >
#include < orpheu_advanced >

const XO_CWEAPONBOX 4;
const 
m_iId 43;
const 
m_pfnThink 4

new IntClassNameString;
new 
OrpheuFunction:HandleCreateNamedEntityFunc;
new 
OrpheuFunction:HandlePackWeaponFunc;
new 
CWeaponBoxKill_Address;

new const 
WeaponBoxModels[ ][ ] = 

    
"""models/w_p228.mdl",  ""
    
"models/w_scout.mdl",  "models/w_hegrenade.mdl""models/w_xm1014.mdl"
    
"""models/w_mac10.mdl""models/w_aug.mdl""models/w_smokegrenade.mdl"
    
"models/w_elite.mdl""models/w_fiveseven.mdl",  "models/w_ump45.mdl",  
    
"models/w_sg550.mdl""models/w_galil.mdl",  "models/w_famas.mdl",  
    
"models/w_usp.mdl""models/w_glock18.mdl""models/w_awp.mdl",  
    
"models/w_mp5.mdl""models/w_m249.mdl",  "models/w_m3.mdl"
    
"models/w_m4a1.mdl""models/w_tmp.mdl""models/w_g3sg1.mdl",  
    
"models/w_flashbang.mdl""models/w_deagle.mdl""models/w_sg552.mdl""models/w_ak47.mdl"
    
"""models/w_p90.mdl",  """" 
}

new const 
g_szWeapons[ ][ ] =
{
    
"",
    
"weapon_p228",
    
"",
    
"weapon_scout",
    
"weapon_hegrenade",
    
"weapon_xm1014",
    
"",
    
"weapon_mac10",
    
"weapon_aug",
    
"weapon_smokegrenade",
    
"weapon_elite",
    
"weapon_fiveseven",
    
"weapon_ump45",
    
"weapon_sg550",
    
"weapon_galil",
    
"weapon_famas",
    
"weapon_usp",
    
"weapon_glock18",
    
"weapon_awp",
    
"weapon_mp5navy",
    
"weapon_m249",
    
"weapon_m3",
    
"weapon_m4a1",
    
"weapon_tmp",
    
"weapon_g3sg1",
    
"weapon_flashbang",
    
"weapon_deagle",
    
"weapon_sg552",
    
"weapon_ak47",
    
"",
    
"weapon_p90"
}

public 
plugin_init( )
{
    
HandleCreateNamedEntityFunc OrpheuGetFunction"CREATE_NAMED_ENTITY" );
    
HandlePackWeaponFunc        OrpheuGetFunction"PackWeapon""CWeaponBox" );
    
    
CWeaponBoxKill_Address OrpheuGetFunctionAddressOrpheuGetFunction"Kill""CWeaponBox" ) );
    
    
register_logevent"OnNewRound"2"1=Round_Start" );
}

public 
OnNewRound( )
{
    new 
Float:fOrigin], WeaponEntity;
    
    if( 
SsGetOriginfOrigin ) )
    {
        new 
WeaponBoxEntity OrpheuCallHandleCreateNamedEntityFuncIntClassNameString ) ;
        if( ! 
pev_validWeaponBoxEntity ) )
        {
            return 
PLUGIN_CONTINUE;
        }
        
        
engfuncEngFunc_SetOriginWeaponBoxEntityfOrigin );
        
ExecuteHamHam_SpawnWeaponBoxEntity );
        
        for( new 
i=1sizeof g_szWeaponsi++ )
        {
            if( 
g_szWeapons][ ] != EOS )
            {
                
WeaponEntity create_entityg_szWeapons] );
                
                if( ! 
pev_validWeaponEntity ) )
                {
                    
remove_entityWeaponBoxEntity );
                }

                
ExecuteHamHam_SpawnWeaponEntity );
                new 
WeaponID cs_get_weapon_idWeaponEntity );
                
                
OrpheuCallHandlePackWeaponFuncWeaponBoxEntityWeaponEntity );
                if( 
WeaponBoxModelsWeaponID ][ ] != EOS 
                { 
                    
engfuncEngFunc_SetModelWeaponBoxEntityWeaponBoxModelsWeaponID ] );
                } 

                
set_pdata_intWeaponBoxEntitym_pfnThinkCWeaponBoxKill_Address);
            }
        }
    }
    return 
PLUGIN_CONTINUE;

I'm sure it's an obvious thing that I'm missing
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-15-2018 , 12:59   Re: Orpheu & WeaponBox
Reply With Quote #3

You want to create a single box will all weapons or one weaponbox for each weapon?
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 13:02   Re: Orpheu & WeaponBox
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
You want to create a single box will all weapons or one weaponbox for each weapon?
One weaponbox for each weapon
__________________

Last edited by edon1337; 07-15-2018 at 13:04.
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-15-2018 , 13:42   Re: Orpheu & WeaponBox
Reply With Quote #5

But your code is creating only one box. The weaponbox creation code should be inside for( new i=1; i < sizeof g_szWeapons; i++ ) loop.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-16-2018 , 05:57   Re: Orpheu & WeaponBox
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
But your code is creating only one box. The weaponbox creation code should be inside for( new i=1; i < sizeof g_szWeapons; i++ ) loop.
Yea and I was setting the same origin for all the weaponboxes, SsGetOrigin also had to be inside the loop. Thnx!
__________________
edon1337 is offline
Reply



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 12:39.


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