本帖是給與各位了解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;
}
}
}