搜索
楼主: OMG

求一个新的稳定的team_objectives.AMXX插件

[复制链接]
发表于 2009-2-24 19:38:35 | 显示全部楼层 来自 江西南昌
本帖最后由 nopain 于 2009-2-25 12:30 编辑

有时不会处死是因为AMXX函数的一个BUG,下面是修正后的代码,不会出现出现这种情况,死法只保留了一种,被雷打死。
  1. /* AMX MOD X script.
  2. * This file is provided as is with no warranty.
  3. *
  4. * Effect: Losing the objective results in a random orgy of GFX destruction
  5. *           for the losing team (everyone on the losing team DIES).
  6. * CVAR: Set mp_slaylosers to 0 if you want to turn it off.
  7. */

  8. #include <amxmodx>
  9. #include <amxmisc>
  10. #include <cstrike>

  11. new lightning
  12. new g_sModelIndexSmoke

  13. public plugin_init()
  14. {
  15.     register_plugin("AMX Slay Losers","1.1","d3n14@yahoo.com")
  16.     register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
  17.      register_cvar("mp_slaylosers","1",FCVAR_SERVER)
  18.    
  19.     return PLUGIN_CONTINUE
  20. }


  21. public end_round()
  22. {
  23.     // Only active if CVAR is not equal to 0
  24.     if( get_cvar_num("mp_slaylosers") )
  25.     {
  26.         new parm[32]
  27.         new len = read_data(2,parm,31)
  28.         set_task(0.3,"slay_those_losers",0,parm, len + 1)
  29.     }
  30.     return PLUGIN_CONTINUE
  31. }

  32. // Slays each player who failed to stop the other team from completing the objective.
  33. public slay_those_losers(parm[])
  34. {
  35.         new origin[3], srco[3]
  36.         new player[32], playersnum
  37.         new id
  38.        
  39.         new CsTeams:team = (parm[7] == 't') ? CS_TEAM_CT : CS_TEAM_T
  40.         get_players(player,playersnum,"a")
  41.        
  42.         for(new i = 0; i < playersnum; ++i)
  43.         {       
  44.                 id = player[i]
  45.                 // 不是失败方队员直接跳过
  46.                 if(team != cs_get_user_team(id))
  47.                       continue;       
  48.                 get_user_origin(id,origin)                       
  49.                 origin[2] -= 26
  50.                 srco[0]=origin[0]+150
  51.                 srco[1]=origin[1]+150
  52.                 srco[2]=origin[2]+800
  53.                 slay_lightning(srco,origin)
  54.                 emit_sound(id,CHAN_ITEM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  55.                 set_hudmessage(178, 14, 41, -1.0, -0.4, 1, 0.5, 1.7, 0.2, 0.2,3);
  56.                 show_hudmessage(id, "任务失败^n所有失败方幸存队员将被处死!" );
  57.                 user_kill(id,1)       
  58.                 //set_user_frags(id, get_user_frags(id)+0)
  59.         }       
  60. }

  61. slay_lightning(vec1[3],vec2[3])
  62. {
  63.         //Lightning
  64.         message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  65.         write_byte( 0 )
  66.         write_coord(vec1[0])
  67.         write_coord(vec1[1])
  68.         write_coord(vec1[2])
  69.         write_coord(vec2[0])
  70.         write_coord(vec2[1])
  71.         write_coord(vec2[2])
  72.         write_short( lightning )
  73.         write_byte( 1 ) // framestart
  74.         write_byte( 5 ) // framerate
  75.         write_byte( 2 ) // life
  76.         write_byte( 20 ) // width
  77.         write_byte( 30 ) // noise
  78.         write_byte( 200 ) // r, g, b
  79.         write_byte( 200 ) // r, g, b
  80.         write_byte( 200 ) // r, g, b
  81.         write_byte( 200 ) // brightness
  82.         write_byte( 200 ) // speed
  83.         message_end()
  84.         //Sparks
  85.         message_begin( MSG_PVS, SVC_TEMPENTITY,vec2)
  86.         write_byte( 9 )
  87.         write_coord( vec2[0] )
  88.         write_coord( vec2[1] )
  89.         write_coord( vec2[2] )
  90.         message_end()
  91.         //Smoke     
  92.         message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec2)
  93.         write_byte( 5 )
  94.         write_coord(vec2[0])
  95.         write_coord(vec2[1])
  96.         write_coord(vec2[2])
  97.         write_short( g_sModelIndexSmoke )
  98.         write_byte( 10 )  
  99.         write_byte( 10 )  
  100.         message_end()
  101. }

  102. public plugin_precache()
  103. {
  104.         g_sModelIndexSmoke = precache_model("sprites/steam1.spr")
  105.         lightning = precache_model("sprites/lgtning.spr")
  106.         precache_sound( "ambience/thunder_clap.wav")
  107.         return PLUGIN_CONTINUE
  108. }
复制代码
回复

使用道具 举报

发表于 2010-2-10 02:17:56 | 显示全部楼层 来自 广东深圳
team_objectives
回复

使用道具 举报

发表于 2010-5-22 12:23:55 | 显示全部楼层 来自 江苏苏州
插件名字真多,功能差不多的吧,这个坛子里有
回复

使用道具 举报

发表于 2011-9-20 23:17:03 | 显示全部楼层 来自 广西南宁
我下下来试试
回复

使用道具 举报

发表于 2011-9-20 23:18:44 | 显示全部楼层 来自 广西南宁
我下下来试试
回复

使用道具 举报

发表于 2011-9-20 23:22:04 | 显示全部楼层 来自 广西南宁
我下下来试试
回复

使用道具 举报

发表于 2011-9-20 23:23:42 | 显示全部楼层 来自 广西南宁
我下下来试试
回复

使用道具 举报

发表于 2011-9-20 23:25:53 | 显示全部楼层 来自 广西南宁
不过好像换下一个地图就没事了把。
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表