【分享】SMA 寫法 Or 函數

Home Home
引用 | 編輯 Taiwan™
2013-12-25 16:35
樓主
推文 x0
本帖是給與各位了解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;
}
}
}

獻花 x0
引用 | 編輯 mp031201
2013-12-27 21:23
1樓
  
不懂哦...有點文字的解說嗎?? 表情

獻花 x1
引用 | 編輯 情歌乱弹
2014-01-15 18:19
2樓
  
應該說明某些代碼的意思

獻花 x0
引用 | 編輯 zxzx45248
2014-01-27 23:05
3樓
  
從頭到尾 沒看懂過一句 表情

獻花 x0
引用 | 編輯 zxzyman
2014-05-10 22:52
4樓
  
只有寫出SMA

卻沒註解是怎樣寫 怎模用...

(這樣就像,學習英文,卻要自己去生出所有的語法一樣...)

獻花 x0
引用 | 編輯 ‏xxxxxxxx
2016-11-24 19:15
5樓
  
回 覆 鎖 定 :

  此回覆已被鎖定,只有『管理員及回覆者』看的到 !!!



獻花 x0
引用 | 編輯 丘俊
2016-11-24 21:41
6樓
  
.....不带这样的

獻花 x0