凌雪无晴 发表于 2008-7-12 17:17:27

队友闪到时,闪光为红色,请指教!

加了两行扣15HP血,不过下次其他人再闪到自己人的时候,总是把扣血加到第一个闪到自己人的那个人上,想问下如何解决这个BUG,请指点!
// 添加其他惩罚代码。。。
new user_health = get_user_health(flashed)
set_user_health( flashed, user_health - 15 )


/*
插件:OooH Team Flashed 被队友闪到时,闪光为红色
作者:PooHoo@老友记
来源:http://cs-friends.com.cn
, 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, ": 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, ": OH NO, 老兄,你闪到队友了,要注意哦...")
// 添加其他惩罚代码。。。
new user_health = get_user_health(flashed)
set_user_health( flashed, user_health - 15 )

}
}
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-7-16 16:44:06

回复: 队友闪到时,闪光为红色,请指教!

// 如果这个闪光闪到队友,改变其闪光颜色
if (is_user_connected(id)
&& PLAYER[id][GameTime]==time
&& team==get_user_team(id)
&& flasher!=id)
{
set_user_health( flasher, get_user_health(flasher)- 15 );
client_print(id, print_chat, ": 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
}
}

想问版主一下:为何无缘无故减俺的港币?

凌雪无晴 发表于 2008-7-16 20:14:15

回复: 队友闪到时,闪光为红色,请指教!

呵呵,LS的搞笑!!!
不过不知道版主会不会回答你,可能你贪污!:rolleyes:

狙神wmQ 发表于 2008-7-17 18:04:26

回复: 队友闪到时,闪光为红色,请指教!

Post by 凌雪无晴
加了两行扣15HP血,不过下次其他人再闪到自己人的时候,总是把扣血加到第一个闪到自己人的那个人上,想问下如何解决这个BUG,请指点!
// 添加其他惩罚代码。。。
new...
顶上来,上次冰河大哥修改的也出现如上问题,高手解决一下!

52yz 发表于 2008-7-17 23:27:37

回复: 队友闪到时,闪光为红色,请指教!

建议楼主试试这个
http://forums.alliedmods.net/showthread.php?t=68336

狙神wmQ 发表于 2008-7-18 13:21:28

回复: 队友闪到时,闪光为红色,请指教!

Post by 52yz
建议楼主试试这个
http://forums.alliedmods.net/showthread.php?t=68336
不知能否帮忙汉化一下?

狙神wmQ 发表于 2008-7-18 13:23:55

回复: 队友闪到时,闪光为红色,请指教!

测试了,好像不是一个概念的!

凌雪无晴 发表于 2008-7-18 18:00:26

回复: 队友闪到时,闪光为红色,请指教!

谢谢LS的兄弟
此插件判断还是比较准确,不惩罚代码怎么加都不如意!!!
:cold:

52yz 发表于 2008-7-18 21:21:29

回复: 队友闪到时,闪光为红色,请指教!

Post by 凌雪无晴
谢谢LS的兄弟
此插件判断还是比较准确,不惩罚代码怎么加都不如意!!!
:cold:

带惩罚的啊,你可以改啊,汉化我就不帮你改了,原文太简单,我随便按意思翻了翻,你知道下面几个参数修改了写在amxx.cfg里就行


原文:You are not allowed to throw flashbangs anymore

由于你闪到队友过多已禁止你使用闪光弹

原文:Be careful with flashbangs !!

小心使用你的闪光弹,否则你将被处罚







      tfp_count < 0|1|2 >

[*]Count: 0: nothing - 1: only full flashed teamates - 2: all teamflashes (def:1)
[*]选0不计数,1:全闪白了计数(默认) 2:闪到队友了就计数
[*]tfp_max_count < X > Restrict a player from throwing flash nades after X counted teamflash (see previous cvar) (def:10)
[*]只要闪了队友达到一定的次数就限制该玩家使用闪光,默认10次
[*]tfp_slap < 0|1|2 > Slap: 0: never - 1: only on fully flashed teamates - 2: on all teamflashes (def:1)
[*]减血惩罚:0:不惩罚 1:全白了惩罚 (默认)2:闪到了就惩罚
[*]tfp_slap_amount < X > Power of slaps (def:0)
[*]减血的多少,默认是0

tiantian1632472 发表于 2008-7-20 18:32:41

页: [1] 2
查看完整版本: 队友闪到时,闪光为红色,请指教!