Wilson [29th ID]
03-20-2007, 03:54 AM
Post your useful stocks here.
This one turns a weapon ID into a weapon Name. The one that comes with AMXX core doesn't do it properly.
stock dod_get_weaponname( wpnID, szWpnName[32] ) {
xmod_get_wpnlogname( wpnID, szWpnName, 31 );
format( szWpnName, 31, "weapon_%s", szWpnName );
}
This one gets the users weapon entity number, based on the weapon the client is currently holding. It incorporates the above stock into it.
stock detect_weapon_id( id ) {
new m_iCurEnt = -1, m_iWpnEnt = 0, m_szWpn[32];
// Get User Weapon and WpnName
new clip, ammo, m_iWpn = get_user_weapon(id,clip,ammo);
xmod_get_wpnlogname( m_iWpn, m_szWpn, 31 ); // Requires DoDX Module
format( m_szWpn, 31, "weapon_%s", m_szWpn );
// Get User Origin
new Float:m_flOrigin[3];
pev( id, pev_origin, m_flOrigin );
// Find Dummy Weapon
while( ( m_iCurEnt = engfunc( EngFunc_FindEntityInSphere, m_iCurEnt, m_flOrigin, Float:1.0 ) ) != 0 ) {
new m_szClassname[32];
pev( m_iCurEnt, pev_classname, m_szClassname, 31 );
if( equal( m_szClassname, m_szWpn ) )
m_iWpnEnt = m_iCurEnt;
}
return m_iWpnEnt;
}
This one tests whether a player has his bazooka shouldered. Requires Fakemeta module and the detect_weapon_id stock.
// Returns 1 if rocket is shouldered
#if defined _fakemeta_included
stock dod_is_shouldered( id ) {
return get_pdata_int( detect_weapon_id(id), 115, 4 );
}
#end if
Set User Pronestate. Requires either FM or Engine.
stock dod_set_pronestate( id, flag ) {
#if defined _fakemeta_included
set_pev( id, pev_iuser3, flag );
#elseif defined _engine_included
entity_set_int( id, EV_INT_iuser3, flag );
#endif
}
Attached Below
Const file for Model Sequences in DoD by Wilson
This one turns a weapon ID into a weapon Name. The one that comes with AMXX core doesn't do it properly.
stock dod_get_weaponname( wpnID, szWpnName[32] ) {
xmod_get_wpnlogname( wpnID, szWpnName, 31 );
format( szWpnName, 31, "weapon_%s", szWpnName );
}
This one gets the users weapon entity number, based on the weapon the client is currently holding. It incorporates the above stock into it.
stock detect_weapon_id( id ) {
new m_iCurEnt = -1, m_iWpnEnt = 0, m_szWpn[32];
// Get User Weapon and WpnName
new clip, ammo, m_iWpn = get_user_weapon(id,clip,ammo);
xmod_get_wpnlogname( m_iWpn, m_szWpn, 31 ); // Requires DoDX Module
format( m_szWpn, 31, "weapon_%s", m_szWpn );
// Get User Origin
new Float:m_flOrigin[3];
pev( id, pev_origin, m_flOrigin );
// Find Dummy Weapon
while( ( m_iCurEnt = engfunc( EngFunc_FindEntityInSphere, m_iCurEnt, m_flOrigin, Float:1.0 ) ) != 0 ) {
new m_szClassname[32];
pev( m_iCurEnt, pev_classname, m_szClassname, 31 );
if( equal( m_szClassname, m_szWpn ) )
m_iWpnEnt = m_iCurEnt;
}
return m_iWpnEnt;
}
This one tests whether a player has his bazooka shouldered. Requires Fakemeta module and the detect_weapon_id stock.
// Returns 1 if rocket is shouldered
#if defined _fakemeta_included
stock dod_is_shouldered( id ) {
return get_pdata_int( detect_weapon_id(id), 115, 4 );
}
#end if
Set User Pronestate. Requires either FM or Engine.
stock dod_set_pronestate( id, flag ) {
#if defined _fakemeta_included
set_pev( id, pev_iuser3, flag );
#elseif defined _engine_included
entity_set_int( id, EV_INT_iuser3, flag );
#endif
}
Attached Below
Const file for Model Sequences in DoD by Wilson