设为首页收藏本站新闻投稿

MOD中国同盟社

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 715|回复: 6

[求助] 如何改变SPR图标的显示方式? [复制链接]

Modchina声望-尊敬

百贴杀阵!

Rank: 7Rank: 7Rank: 7

帖子
379
精华
0
声望
3092 点
金币
371 Mold
被赞许
10 次
注册时间
2007-5-2
发表于 2011-8-4 15:49:29 |显示全部楼层
本帖最后由 Osker Lee 于 2011-8-5 00:20 编辑

最近找到了一个C4倒计时显示SPR图标的插件,不过我发现SPR图标里的数字是竖着摆放的,所以想问一下,有什么办法能把SPR图标里的数字改成横着摆放吗?(如图示)
  1. /* Copyright ?2009, ConnorMcLeod
  2. C4 Sprites Timer is free software;
  3. you can redistribute it and/or modify it under the terms of the
  4. GNU General Public License as published by the Free Software Foundation.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with C4 Sprites Timer; if not, write to the
  11. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  12. Boston, MA 02111-1307, USA.
  13. */
  14. #include <amxmodx>
  15. #include <engine>
  16. #include <fakemeta>
  17. #include <hamsandwich>
  18. #define PLUGIN "C4 Sprites Timer"
  19. #define AUTHOR "ConnorMcLeod"
  20. #define VERSION "0.1.0"
  21. #define SPRITE_DIST 36  // min = ~32
  22. new const SPRITE_NAME[] = "sprites/bomb_countdown.spr"
  23. const OFFSET_C4_EXPLODE_TIME = 100
  24. new g_iC4
  25. new g_iSprite
  26. new g_iSprite2
  27. new HamHook:g_HhGrenadeThink
  28. new g_iUnits = -1
  29. new g_iDozen = -1
  30. new Float:g_flExplodeTime
  31. new g_pCvarSpriteScale, g_pCvarEnable
  32. public plugin_precache()
  33. {
  34. precache_model(SPRITE_NAME)
  35. }
  36. public plugin_init()
  37. {
  38. register_plugin(PLUGIN, VERSION, AUTHOR)
  39. g_pCvarEnable = register_cvar("c4_sprite_timer", "1")
  40. g_pCvarSpriteScale = register_cvar("c4_sprite_scale", "0.6")
  41. if( find_ent_by_class(FM_NULLENT, "func_bomb_target") || find_ent_by_class(FM_NULLENT, "info_bomb_target") )
  42. {
  43.   g_HhGrenadeThink = RegisterHam(Ham_Think, "grenade", "C4_Think", 1)
  44.   register_event("HLTV", "StopHook", "a", "1=0", "2=0")
  45.   register_logevent("StopHook", 2, "1=Round_End")
  46.   register_logevent("StartHook", 3, "2=Planted_The_Bomb")
  47.   StopHook()
  48. }
  49. }
  50. public StopHook()
  51. {
  52. g_iC4 = 0
  53. g_iUnits = -1
  54. g_iDozen = -1
  55. DisableHamForward( g_HhGrenadeThink )
  56. if( g_iSprite )
  57. {
  58.   entity_set_int(g_iSprite, EV_INT_flags, FL_KILLME)
  59.   g_iSprite = 0
  60. }
  61. if( g_iSprite2 )
  62. {
  63.   entity_set_int(g_iSprite2, EV_INT_flags, FL_KILLME)
  64.   g_iSprite2 = 0
  65. }
  66. }
  67. public StartHook()
  68. {
  69. if( !get_pcvar_num(g_pCvarEnable) )
  70. {
  71.   return
  72. }
  73. new iC4 = FM_NULLENT
  74. new const grenade[] = "grenade"
  75. new const env_sprite[] = "env_sprite"
  76. while( (iC4 = find_ent_by_class(iC4, grenade)) )
  77. {
  78.   if( get_pdata_int(iC4, 96, 5) & (1<<8) )
  79.   {
  80.    g_iC4 = iC4
  81.    g_flExplodeTime = get_pdata_float(g_iC4, OFFSET_C4_EXPLODE_TIME, 5)
  82.    EnableHamForward( g_HhGrenadeThink )
  83.    new Float:flOrigin[3], Float:flGround[3]
  84.    entity_get_vector(iC4, EV_VEC_origin, flOrigin)
  85.    flGround[0] = flOrigin[0]
  86.    flGround[1] = flOrigin[1]
  87.    flGround[2] = flOrigin[2] - 9999.9
  88.    trace_line(FM_NULLENT, flOrigin, flGround, flGround)
  89.    new Float:flScale = get_pcvar_float(g_pCvarSpriteScale)
  90.    if( ( g_iSprite = create_entity(env_sprite) ) )
  91.    {
  92.     entity_set_string(g_iSprite, EV_SZ_model, SPRITE_NAME)
  93.     flGround[2] += max( floatround( SPRITE_DIST * flScale ) , 20 )
  94.     entity_set_vector(g_iSprite, EV_VEC_origin, flGround)
  95.     entity_set_float(g_iSprite, EV_FL_scale, flScale)
  96.     DispatchSpawn(g_iSprite)
  97.    }
  98.    if( ( g_iSprite2 = create_entity(env_sprite) ) )
  99.    {
  100.     entity_set_string(g_iSprite2, EV_SZ_model, SPRITE_NAME)
  101.     flGround[2] += floatround( SPRITE_DIST * flScale )
  102.     entity_set_vector(g_iSprite2, EV_VEC_origin, flGround)
  103.     entity_set_float(g_iSprite2, EV_FL_scale, flScale)
  104.     DispatchSpawn(g_iSprite2)
  105.    }
  106.    return
  107.   }
  108. }
  109. }
  110. public C4_Think( iC4 )
  111. {
  112. if( g_iC4 != iC4 )
  113. {
  114.   return
  115. }
  116. static Float:flTime, iTime, iUnits, iDozen
  117. flTime = g_flExplodeTime - get_gametime()
  118. iTime = floatround(flTime, floatround_ceil)
  119. iUnits = iTime % 10
  120. iDozen = (iTime - iUnits) / 10
  121. if( g_iSprite && g_iUnits != iUnits )
  122. {
  123.   g_iUnits = iUnits
  124.   entity_set_float(g_iSprite, EV_FL_frame, 0.0 + iUnits)
  125. }
  126. if( g_iSprite2 && g_iDozen != iDozen)
  127. {
  128.   g_iDozen = iDozen
  129.   if( !iDozen )
  130.   {
  131.    entity_set_int(g_iSprite2, EV_INT_flags, FL_KILLME)
  132.    g_iSprite2 = 0
  133.   }
  134.   else
  135.   {
  136.    entity_set_float(g_iSprite2, EV_FL_frame, 0.0 + iDozen)
  137.   }
  138. }
  139. }
复制代码



附件: 你需要登录才可以下载或查看附件。没有帐号?注册

使用道具 举报

Modchina声望-崇拜

在逃模客

Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15

帖子
2536
精华
0
声望
8050 点
金币
1500 Mold
被赞许
120 次
注册时间
2010-2-7

懒人勋章

发表于 2011-8-4 23:37:12 |显示全部楼层
这个不应该是插件的问题么?看上去这是个动态SPR啊
その一   いつもと违う髪形に気が付くこと
その二   ちゃんと靴まで见ること   いいね?
その三   わたしの一言には三つの言叶で返

使用道具 举报

Modchina声望-尊敬

百贴杀阵!

Rank: 7Rank: 7Rank: 7

帖子
379
精华
0
声望
3092 点
金币
371 Mold
被赞许
10 次
注册时间
2007-5-2
发表于 2011-8-4 23:50:47 |显示全部楼层
本帖最后由 Osker Lee 于 2011-8-4 23:51 编辑

与插件没什么关系,插件本身只是负责调用这个SPR模型而已。至于显示何种效果,就完全是SPR本身的问题了。我是想把这个SPR图标改成横向显示,竖着看不符合大多数人的习惯吧。

使用道具 举报

Rank: 10Rank: 10Rank: 10

帖子
483
精华
1
声望
3727 点
金币
607 Mold
被赞许
11 次
注册时间
2009-7-15
发表于 2011-8-4 23:54:38 |显示全部楼层
这个弄成横版后,根据角度的不同,可能就分不清是32还是23了,另外,那个闪光像K.K.Lv的
http://hi.baidu.com/ethan_xue 博客 cs修改教程

使用道具 举报

Modchina声望-尊敬

百贴杀阵!

Rank: 7Rank: 7Rank: 7

帖子
379
精华
0
声望
3092 点
金币
371 Mold
被赞许
10 次
注册时间
2007-5-2
发表于 2011-8-5 00:01:23 |显示全部楼层
本帖最后由 Osker Lee 于 2011-8-5 00:15 编辑

其实SPR倒计时显示的时候,只是右边的数字在变动而已,只有当右边的数字一直倒数变成零以后,左边的数字才开始变化,很好分辨的。插件的源代码贴在一楼,大家可以自行测试。至于C4周围显示的光圈效果,用的其实就是K.K.Lv的插件,源代码如下:
  1. /* Plugin generated by AMXX-Studio */
  2. #include <amxmodx>
  3. #include <engine>
  4. #include <fakemeta>
  5. #include <hamsandwich>
  6. #define PLUGIN "Bomb Blast"
  7. #define VERSION "0.4"
  8. #define AUTHOR "K.K.Lv"
  9. new HamHook:g_BombThink
  10. new g_Bomb
  11. new g_SpriteCircle
  12. new Float:g_fExplodeTime
  13. new Float:g_fNextBlastGameTime
  14. new g_pCvarColor
  15. public plugin_precache()
  16. {
  17. g_SpriteCircle = precache_model( "sprites/shockwave.spr" )
  18. }
  19. public plugin_init()
  20. {
  21. register_plugin( PLUGIN, VERSION, AUTHOR )

  22. g_pCvarColor = register_cvar( "bb_color", "250250250" ) //RRRGGGBBB

  23. if( find_ent_by_class( FM_NULLENT, "func_bomb_target" ) || find_ent_by_class( FM_NULLENT, "info_bomb_target" ) )
  24. {
  25.   g_BombThink = RegisterHam( Ham_Think, "grenade", "Bomb_Think", 1 )
  26.   
  27.   register_event( "HLTV", "Stop", "a", "1=0", "2=0" )
  28.   register_logevent( "Stop", 2, "1=Round_End" )
  29.   
  30.   register_logevent( "PlantedBomb", 3, "2=Planted_The_Bomb" )
  31. }
  32. }
  33. public Stop()
  34. {
  35. g_Bomb = 0
  36. DisableHamForward( g_BombThink)
  37. }
  38. public PlantedBomb()
  39. {
  40. new C4 = FM_NULLENT
  41. while( ( C4 = find_ent_by_class( C4, "grenade" ) ) )
  42. {
  43.   if ( get_pdata_int( C4, 96 ) & ( 1<<8 ) )
  44.   {
  45.    g_Bomb = C4
  46.    g_fExplodeTime = get_pdata_float( g_Bomb, 100 )
  47.    EnableHamForward( g_BombThink )
  48.    
  49.    g_fNextBlastGameTime = 0.0
  50.    break
  51.   }
  52. }
  53. }
  54. public Bomb_Think( iEnt )
  55. {
  56. if ( g_Bomb != iEnt )
  57.   return

  58. new Float:fGameTime = get_gametime()
  59. if( g_fNextBlastGameTime > fGameTime )
  60.   return

  61. new Float:fTime, iTime, Float:fThinkTime

  62. fTime = g_fExplodeTime - fGameTime
  63. iTime = floatround( fTime )

  64. if ( iTime > 13 ) fThinkTime = 1.0
  65. else if ( iTime > 7 ) fThinkTime = 0.5
  66. else  fThinkTime = 0.3

  67. g_fNextBlastGameTime = fGameTime + fThinkTime

  68. create_blast_circle( iEnt )
  69. }
  70. public create_blast_circle( iEnt ) {
  71. new Float:fOrigin[ 3 ]

  72. pev( iEnt, pev_origin, fOrigin )

  73. new szColor[ 12 ], iColor[ 3 ]
  74. get_pcvar_string( g_pCvarColor, szColor, charsmax( szColor ) )

  75. iColor[ 2 ] = str_to_num( szColor[ 6 ] )

  76. szColor[ 6 ] = 0
  77. iColor[ 1 ] = str_to_num( szColor[ 3 ] )

  78. szColor[ 3 ] = 0
  79. iColor[ 0 ] = str_to_num( szColor[ 0 ] )

  80. engfunc( EngFunc_MessageBegin, MSG_BROADCAST, SVC_TEMPENTITY, fOrigin )
  81. write_byte( TE_BEAMCYLINDER )
  82. engfunc( EngFunc_WriteCoord, fOrigin[ 0 ] )
  83. engfunc( EngFunc_WriteCoord, fOrigin[ 1 ] )
  84. engfunc( EngFunc_WriteCoord, fOrigin[ 2 ] )
  85. engfunc( EngFunc_WriteCoord, fOrigin[ 0 ] )
  86. engfunc( EngFunc_WriteCoord, fOrigin[ 1 ] )
  87. engfunc( EngFunc_WriteCoord, fOrigin[ 2 ] + 125 )
  88. write_short( g_SpriteCircle )
  89. write_byte( 0 )
  90. write_byte( 1 )
  91. write_byte( 6 )
  92. write_byte( 8 )
  93. write_byte( 1 )
  94. write_byte( iColor[ 0 ] )
  95. write_byte( iColor[ 1 ] )
  96. write_byte( iColor[ 2 ] )
  97. write_byte( 128 )
  98. write_byte( 5 )
  99. message_end()
  100. }
复制代码

使用道具 举报

Super Moderator

MODCHINA 之 土匪

Rank: 10Rank: 10Rank: 10

帖子
1231
精华
6
声望
4643 点
金币
1276 Mold
被赞许
90 次
注册时间
2007-5-4

MTT职员 Modchina元老 精华帖制造者

发表于 2011-8-5 21:53:44 |显示全部楼层
似乎~有种SPR能锁定方向~

使用道具 举报

Rank: 7Rank: 7Rank: 7

帖子
249
精华
0
声望
1627 点
金币
438 Mold
被赞许
7 次
注册时间
2011-1-27

可爱小猫 懒人勋章

发表于 2011-8-5 22:43:05 |显示全部楼层
怎么调整SPR角度,就像9变成6
路见不顺     拳打脚踢

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

回顶部