本帖是给与各位了解SMA的 麻烦不是SMA 格式的请不要发言 谢谢 各位
如有喜欢 请给予花 如果友意见请私下询问 谢谢配合
由我先开始分享 显示FPS跟速度插件
以下代码是SMA搂
#include < amxmodx >
#include < fakemeta >
#define PLUGIN "New hud system"
#define VERSION "0.1"
new Float:g_fGameTime[ 33 ];
new g_iFramesPer[ 33 ];
new g_iCurFPS[ 33 ];
new g_iFPS[ 33 ];
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, "falseq" );
register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
}
public client_putinserver( id )
{
set_task( 0.1, "showHudPlayer", id, _, _, "b", _ );
}
public showHudPlayer( id )
{
new Float:POSX, Float:POSY, Float:fVelocity[ 3 ], Float:fSpeed, RRR, GGG, BBB;
if( is_user_alive( id ) )
{
switch( get_user_team( id ) )
{
case 1:
{
RRR = 230;
GGG = 10;
BBB = 10;
}
case 2:
{
RRR = 10;
GGG = 10;
BBB = 230;
}
}
pev( id, pev_velocity, fVelocity );
fSpeed = vector_length( fVelocity );
POSX = -1.0;
POSY = 0.80;
set_hudmessage( RRR, GGG, BBB, POSX, POSY, 0, 1.0 );
show_hudmessage( id, "%2.3f [ SPEED ] ^n- - - - - - - - -^n%i [ FPS ]", fSpeed, g_iCurFPS[ id ] );
}
}
public fwdPlayerPreThink( id )
{
if( !is_user_bot( id ) )
{
g_fGameTime[ id ] = get_gametime( );
if( g_iFramesPer[ id ] > g_fGameTime[ id ] )
{
g_iFPS[ id ] += 1;
}
else
{
g_iFramesPer[ id ] += 1;
g_iCurFPS[ id ] = g_iFPS[ id ];
g_iFPS[ id ] = 0;
}
}
}