搜索
查看: 5298|回复: 11

求同队闪光无效的插件!

[复制链接]
发表于 2008-4-18 13:55:09 | 显示全部楼层 |阅读模式 来自 湖北孝感
使用被闪后一定时间内身体变透明的插件效果不好!!

//防队友闪光
no_team_flash 1
// 闪光后隐身
nf_on 1
negativeflash.amxx

使用插件:OooH Team Flashed 被队友闪到时,闪光为红色
效果达到,如果能把红色设为透明色,问题就能解决,问题是RGB好像不支持透明,只能设Alpha值.希望高手修改.

------------------------------
/*
   插件:OooH Team Flashed 被队友闪到时,闪光为红色
   作者:PooHoo@老友记
   来源:http://cs-friends.com.cn
   [2007/11/20], CS/CZ 3329+, AMXX 1.76, 测试通过
   功能:
      当被队友闪到时,闪光为红色,被敌人或自己闪不改原有设置,依然是白色
   说明:
      team_flashed "1" // 插件开关(默认1)
   附言:
      这个插件,难就难在如何确定被闪时,这个闪光是谁扔的?
      判断方法有好多种,在官方论坛里有几个关于闪光的插件
      “No Team Flash”“Team Flash Snitch”。。等等
      但处理方法不理想,不能100%正确判断扔雷的人。
      我使用不同的处理方法,准确判断扔闪光的人100%有效。
      正确获得扔雷的人后,我们可以修改扩展一下功能:
      1,惩罚闪队友的人(掉血,扣金钱,没收武器。。)
      2,进行计数,闪队友N次后,踢出,处死
      3,去掉队友的闪光,
      4,禁止他再购买或使用闪光弹
      5,等等。。。
      注意:如果惩罚过度,会激化玩家之间的矛盾,需谨慎。
*/
#include <amxmodx>
#include <fakemeta>
#include <csx>
// 被队友闪后的颜色(R, G, B)
new const COLOR[3]={255, 50, 50} // 红色
enum FLASH{
   Float:GameTime,
   Duration,
   HoldTime,
   FadeType,
   Alpha
}
new PLAYER[33][FLASH]
new pTeamFlashed
new gMsgScreenFade
new gMaxPlayers
new const FLASHSOUND[2][]={
"weapons/flashbang-1.wav",
"weapons/flashbang-2.wav"
}
public plugin_init()
{
   register_plugin("OooH Team Flashed", "1.0", "PooHoo@cs-friends.com.cn")
   register_forward(FM_EmitSound, "fw_FM_EmitSound")
   register_event("ScreenFade", "event_ScreenFade", "be", "4=255", "5=255", "6=255", "7>199")
   pTeamFlashed   = register_cvar("team_flashed", "1")
   gMsgScreenFade = get_user_msgid("ScreenFade")
   gMaxPlayers    = get_maxplayers()
}
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch)
{
   if(!get_pcvar_num(pTeamFlashed))
      return FMRES_IGNORED
   // 闪光?
   if(!equali(sample, FLASHSOUND[0]) && !equali(sample, FLASHSOUND[1]))
      return FMRES_IGNORED
   static flashed, Float:time, name[32], flasher, team
   flashed = 0
   flasher = pev(entity, pev_iuser3)
   team    = pev(entity, pev_iuser4)
   time    = get_gametime()
   get_user_name(flasher, name, 31)
   if (is_user_connected(flasher))
   {
      for(new id=1; id<=gMaxPlayers; id++)
      {
         // 如果这个闪光闪到队友,改变其闪光颜色
         if (is_user_connected(id)
            && PLAYER[id][GameTime]==time
            && team==get_user_team(id)
            && flasher!=id)
         {
            client_print(id, print_chat, "[cs-friends.com.cn]: OooH, 队友[%s] 闪到你了", name)
            FlashedEvent(id, PLAYER[id][Duration], PLAYER[id][HoldTime], PLAYER[id][FadeType], COLOR[0], COLOR[1], COLOR[2], PLAYER[id][Alpha])
            flashed = 1
         }
      }
      if (flashed)
      {
         // 这个闪光的人 flasher 通知或惩罚他
         client_print(flasher, print_chat, "[cs-friends.com.cn]: OH NO, 老兄,你闪到队友了,要注意哦...")
         // 添加其他惩罚代码。。。
         
         
      }
   }
   return FMRES_IGNORED
}
// 记录被闪的人的闪光信息
public event_ScreenFade(id)
{
   PLAYER[id][GameTime] = _:get_gametime()
   PLAYER[id][Duration] = read_data(1)
   PLAYER[id][HoldTime] = read_data(2)
   PLAYER[id][FadeType] = read_data(3)
   PLAYER[id][Alpha]    = read_data(7)
}
// 记录仍雷人的信息
public grenade_throw(id, entity, WpnID)
{
   if (WpnID == CSW_FLASHBANG)
   {
      set_pev(entity, pev_iuser3, id)                 // 这个雷是谁的
      set_pev(entity, pev_iuser4, get_user_team(id))  // 他的队伍是?
   }
}
// 发送闪光效果
stock FlashedEvent(id, iDuration, iHoldTime, iFadeType, iRed, iGreen, iBlue, iAlpha)
{
   message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
   write_short(iDuration)   // Duration
   write_short(iHoldTime)   // Hold time
   write_short(iFadeType)   // Fade type
   write_byte (iRed)        // Red
   write_byte (iGreen)      // Green
   write_byte (iBlue)       // Blue
   write_byte (iAlpha)      // Alpha
   message_end()}
 楼主| 发表于 2008-4-21 11:32:40 | 显示全部楼层 来自 湖北孝感

回复: 求同队闪光无效的插件!

期待中!!!!谢谢!
回复

使用道具 举报

发表于 2008-4-21 16:35:02 | 显示全部楼层 来自 北京海淀

回复: 求同队闪光无效的插件!

颜色改成0,0,0, alpha也改成0, fade type改成1<<2, duration和holdtime都改成0
回复

使用道具 举报

 楼主| 发表于 2008-4-22 14:31:59 | 显示全部楼层 来自 湖北孝感

回复: 求同队闪光无效的插件!

能提供修改的具体方法吗?
回复

使用道具 举报

发表于 2011-1-20 14:05:52 | 显示全部楼层 来自 天津
能提供修改的具体方法吗?
回复

使用道具 举报

发表于 2011-2-7 02:58:00 | 显示全部楼层 来自 上海普陀区
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2011-5-2 16:10:10 | 显示全部楼层 来自 湖南株洲
有AMMX么
回复

使用道具 举报

发表于 2011-5-15 10:00:23 | 显示全部楼层 来自 广东云浮
具体方法
回复

使用道具 举报

发表于 2011-5-15 10:01:31 | 显示全部楼层 来自 广东云浮
具体方法
回复

使用道具 举报

发表于 2011-5-15 10:02:54 | 显示全部楼层 来自 广东云浮
具体方法
回复

使用道具 举报

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

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