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

MOD中国同盟社

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 612|回复: 0

[求助] 帮我修改amxx源代码,spr提示插件 [复制链接]

Rank: 2

帖子
26
精华
0
声望
333 点
金币
60 Mold
被赞许
0 次
注册时间
2009-1-6
发表于 2011-12-19 02:52:30 |显示全部楼层
本帖最后由 0001483623 于 2011-12-19 02:53 编辑

解决如下问题:
1:如何控制spr大小
2:改为出生时自动显示,并在显示5秒后消失,而不是命令触发显示
3:帮我修改后贴出完整代码

  1. #include <amxmodx>
  2. #include <amxmisc>

  3. #define PLUGIN_NAME "Team Icon Spr"
  4. #define PLUGIN_VERSION "1.0.4"
  5. #define PLUGIN_AUTHOR "tuty"

  6. #define CT_SPRITE "sprites/teamspr/ct_blue.spr"
  7. #define T_SPRITE "sprites/teamspr/t_red.spr"


  8. new g_ct_blue_spr;
  9. new g_t_red_spr;
  10. new g_sprtime;
  11. new g_plugin_mode;
  12. new g_cvarvalue;



  13. public plugin_init()
  14. {
  15. register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
  16. register_event( "DeathMsg", "remove_spr", "a" );
  17. register_logevent( "logevent_round_start", 2, "1=Round_Start" );
  18. register_clcmd( "say /teamspr", "CreateSprite" );
  19. register_clcmd( "say_team /teamspr", "CreateSprite" );
  20. register_clcmd( "say /delspr", "RemoveSprite" );
  21. register_clcmd( "say_team /delspr", "RemoveSprite" );
  22. g_sprtime = register_cvar( "teamspr_sprite_time", "32767" );
  23. g_plugin_mode = register_cvar( "teamspr_mode", "2" );
  24. register_dictionary( "teamspr.txt" );
  25. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)



  26. }


  27. public plugin_precache()
  28. {
  29. g_ct_blue_spr = precache_model( CT_SPRITE );
  30. g_t_red_spr = precache_model( T_SPRITE );
  31. }


  32. public logevent_round_start()
  33. {
  34. g_cvarvalue = get_pcvar_num( g_plugin_mode );
  35. new players[ 32 ], num, i;
  36. get_players( players, num );

  37. for( i = 0; i < num; i++ )
  38. {
  39. if( !is_user_alive( players[ i ] ) )
  40. {
  41. continue;
  42. }

  43. switch( g_cvarvalue )
  44. {
  45. case 0: return PLUGIN_HANDLED;
  46. case 1: Remove( players[ i ] );
  47. case 2:
  48. {
  49. message_begin( MSG_ALL, SVC_TEMPENTITY );
  50. write_byte( TE_PLAYERATTACHMENT );
  51. write_byte( players[ i ] );
  52. write_coord( 45 );
  53. write_short( ( get_user_team( players[ i ] ) == 1 ) ? g_t_red_spr : g_ct_blue_spr );
  54. write_short( get_pcvar_num( g_sprtime ) );
  55. message_end();
  56. }
  57. }
  58. }

  59. return PLUGIN_CONTINUE;
  60. }


  61. public CreateSprite( id )
  62. {
  63. g_cvarvalue = get_pcvar_num( g_plugin_mode );

  64. if( g_cvarvalue == 0 )
  65. {
  66. client_print( id, print_chat, "%L", id, "CANNOT_CREATE" );
  67. client_cmd( id, "speak buttons/blip1.wav" );
  68. Remove( id );

  69. return PLUGIN_HANDLED;
  70. }

  71. else if( g_cvarvalue != 1 )
  72. {
  73. client_print( id, print_chat, "%L", id, "ALLREADY_HAVE" );
  74. client_cmd( id, "speak buttons/blip1.wav" );

  75. return PLUGIN_HANDLED;
  76. }

  77. message_begin( MSG_ALL, SVC_TEMPENTITY );
  78. write_byte( TE_PLAYERATTACHMENT );
  79. write_byte( id );
  80. write_coord( 45 );
  81. write_short( ( get_user_team( id ) == 1 ) ? g_t_red_spr : g_ct_blue_spr );
  82. write_short( get_pcvar_num( g_sprtime ) );
  83. message_end();

  84. client_print( id, print_chat, "%L", id, "SUCCESSFULLY_CREATED" );
  85. client_cmd( id, "speak fvox/activated.wav" );

  86. return PLUGIN_CONTINUE;
  87. }


  88. public RemoveSprite( id )
  89. {
  90. g_cvarvalue = get_pcvar_num( g_plugin_mode );

  91. if( g_cvarvalue == 0 )
  92. {
  93. client_print( id, print_chat, "%L", id, "CANNOT_CREATE" );
  94. client_cmd( id, "speak buttons/blip1.wav" );

  95. return PLUGIN_HANDLED;
  96. }

  97. else if( g_cvarvalue != 1 )
  98. {
  99. client_print( id, print_chat, "%L", id, "MUST_STAY_UP" );
  100. client_cmd( id, "speak buttons/blip1.wav" );

  101. return PLUGIN_HANDLED;
  102. }

  103. Remove( id );
  104. client_print( id, print_chat, "%L", id, "SUCCESSFULLY_DELETED" );
  105. client_cmd( id, "speak fvox/deactivated.wav" );

  106. return PLUGIN_CONTINUE;
  107. }


  108. public remove_spr()
  109. {
  110. Remove( read_data( 2 ) );
  111. }


  112. stock Remove( index )
  113. {
  114. message_begin( MSG_ALL, SVC_TEMPENTITY );
  115. write_byte( TE_KILLPLAYERATTACHMENTS );
  116. write_byte( index );
  117. message_end();
  118. }
复制代码


使用道具 举报

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

回顶部