Raised This Month: $4 Target: $400
 1% 

Message 'Brass'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Welgericht
Member
Join Date: Jul 2010
Old 01-14-2012 , 14:01   Message 'Brass'
Reply With Quote #1

I have some problems with message 'Brass', plug-in compiles but it doesn't work. Here is the code:
PHP Code:
#include < amxmodx >

#include < fakemeta >

#define PLUGIN  "Test"
#define VERSION "Test"
#define AUTHOR  "Test"

new model

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("say /test""clcmd_test")
}

public 
plugin_precache()
{
    
model precache_model("models/shell.mdl")
}

public 
clcmd_test(id)
{
    new 
origin[3], fAngle[3]

    
pev(idpev_originorigin)
    
pev(idpev_view_ofsfAngle)

    
message_begin(MSG_ONEget_user_msgid("Brass"), {0,0,0}, id );
    
write_byte(TE_MODEL// MessageID
    
write_coord(origin[0]) // Start X
    
write_coord(origin[1]) // Start Y
    
write_coord(origin[2]) // Start Z
    
write_coord(fAngle[0]) // Velocity X
    
write_coord(fAngle[1]) // Velocity Y
    
write_coord(fAngle[2]) // Velocity Z
    
write_angle(30.0// Angle Rotation
    
write_short(model// Model Index
    
write_byte(1// Bounce sound type
    
write_byte(25// Life (2.5 sec.)
    
message_end()

Where is my mistake?
Welgericht is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2012 , 14:10   Re: Message 'Brass'
Reply With Quote #2

Use get_user_origin to you can retrieve an integer vector.
view_ofs is just holding head offset in the .z part, if you want angles use rather pev_angles or pev_v_angle, and to use Float vector, use engfunc(EngFunc_WriteCoord, instead of write_coord.
In write_angle pass 30 and not 30.0
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-14-2012 at 14:11.
ConnorMcLeod is offline
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 01-14-2012 , 20:21   Re: Message 'Brass'
Reply With Quote #3

I'm using this:

PHP Code:
// Temp entity bounce sound types
#define TE_BOUNCE_NULL            0
#define TE_BOUNCE_SHELL            1
#define TE_BOUNCE_SHOTSHELL        2

#define DEFAULT_VIEWHEIGHT        28.0
#define VEC_DUCK_VIEW            12.0

GetDefaultShellInfo(const iPlayer, const FloatvecOrigin[3], const FloatvecVelocity[3], FloatvecShellVelocity[3], FloatvecShellOrigin[3], 
    const 
FloatvecForward[3], const FloatvecRight[3], const FloatvecUp[3], const FloatflForwardScale, const FloatflUpScale, const FloatflRightScale)
{
    new 
FloatflR
    
new FloatflU
    
new FloatvecViewOfs[3]
    
    
vecViewOfs[2] = pev(iPlayerpev_flags) & FL_DUCKING VEC_DUCK_VIEW DEFAULT_VIEWHEIGHT
    
    flR 
random_float(50.070.0)
    
flU random_float(100.0150.0)
    
    for (new 
03i++)
    {
        
vecShellVelocity[i] = vecVelocity[i] + vecRight[i] * flR vecUp[i] * flU vecForward[i] * 25
        vecShellOrigin
[i] = vecOrigin[i] + vecViewOfs[i] + vecUp[i] * flUpScale vecForward[i] * flForwardScale vecRight[i] * flRightScale
    
}
}

UTIL_EjectBrass(const FloatvecOrigin[3], const FloatvecVelocity[3], const FloatflRotation, const iModelIndex, const iSoundtype)
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOrigin0);
    
write_byte(TE_MODEL);
    
engfunc(EngFunc_WriteCoordvecOrigin[0]);
    
engfunc(EngFunc_WriteCoordvecOrigin[1]);
    
engfunc(EngFunc_WriteCoordvecOrigin[2]);
    
engfunc(EngFunc_WriteCoordvecVelocity[0]);
    
engfunc(EngFunc_WriteCoordvecVelocity[1]);
    
engfunc(EngFunc_WriteCoordvecVelocity[2]);
    
engfunc(EngFunc_WriteAngleflRotation)
    
write_short(iModelIndex)
    
write_byte(iSoundtype)
    
write_byte(25);// 2.5 seconds
    
message_end
}


/* LOL.
*
* native hl_wpn_eject_brass(const iPlayer, const iShellModelIndex, const iSoundtype, const Float: flForwardScale, const Float: flUpScale, const Float: flRightScale);
*/
public _hl_wpn_eject_brass(iPluginiParams)
{
    if (
iParams != 6)
    {
        
log_error(AMX_ERR_NATIVE"Bad arguments num, expected 6, passed %d"iParams);
        return 
0;
    }
    
    new 
iPlayer
    
    CHECK_PLAYER
((iPlayer get_param(1)))
    
    new 
FloatvecUp[3]
    new 
FloatvecRight[3]
    new 
FloatvecForward[3]
    new 
FloatvecAngles[3]
    new 
FloatvecOrigin[3]
    new 
FloatvecVelocity[3]
    new 
FloatvecShellVelocity[3]
    new 
FloatvecShellOrigin[3]
    
    
pev(iPlayerpev_anglesvecAngles)
    
pev(iPlayerpev_originvecOrigin)
    
pev(iPlayerpev_velocityvecVelocity)
    
    
global_get(glb_v_forwardvecForward)
    
global_get(glb_v_rightvecRight)
    
global_get(glb_v_upvecUp)
    
    
GetDefaultShellInfo(iPlayervecOriginvecVelocityvecShellVelocityvecShellOriginvecForwardvecRightvecUpFloatget_param(4), Floatget_param(5), Floatget_param(6));
    
UTIL_EjectBrass(vecShellOriginvecShellVelocityvecAngles[2], get_param(2), get_param(3))
    
    return 
1;

__________________

Vi Veri Veniversum Vivus Vici
Russian Half-Life and Adrenaline Gamer community
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-15-2012 , 07:02   Re: Message 'Brass'
Reply With Quote #4

Quote:
Originally Posted by KORD_12.7 View Post
I'm using this:
Counter-Strike has a specific Brass message, where in HL temp entities are used, maybe your code could be used replacing SVC_TEMPENTITY with gmsgBrass though
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 13:02.


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