|
我那旮旯论坛也有人去发帖,真晕死,非要写个啥闪光惩罚,刚好拿团队闪光插件修改了一二,也不整啥附件了,直接复制吧,hamsandwich这个模块没想到如此强大。。。
[PHP]
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "FlashPunish"
#define VERSION "1.0"
#define AUTHOR "[Grief.QQ]"
new g_nMsgScreenFade
new team
new owner
static const punish_money[5]= {200, 400, 600, 800, 1000}
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")
RegisterHam(Ham_Think,"grenade","on_nadethink")
g_nMsgScreenFade = get_user_msgid("ScreenFade")
}
public plugin_precache()
{
precache_sound("声音文件目录/声音文件")
}
public on_nadethink(id)
{
team = pev(id,pev_team)
owner = pev(id,pev_owner)
}
public grenade_throw(id, greindex, wpnid)
{
if(wpnid==CSW_FLASHBANG)
set_pev(greindex,pev_team,get_user_team(id))
}
public FlashedEvent( id )
{
new iRed,iGreen,iBlue
if (owner == id)
{
iRed = 255
iGreen = 255
iBlue = 128
}
else if (team==1)
{
iRed = 255
iGreen = 90
iBlue = 90
}
else
{
iRed = 125
iGreen = 125
iBlue = 255
}
message_begin( MSG_ONE,g_nMsgScreenFade,{0,0,0},id )
write_short( read_data( 1 ) )
write_short( read_data( 2 ) )
write_short( read_data( 3 ) )
write_byte ( iRed )
write_byte ( iGreen )
write_byte ( iBlue )
write_byte ( read_data( 7 ) )
message_end()
if (cs_get_user_team(owner) == cs_get_user_team(id) && (owner != id) && is_user_alive(id))
{
new money = punish_money[random_num(0,4)]
new user_money = cs_get_user_money(owner)
if ( user_money < money )
cs_set_user_money(owner,user_money / 2)
else
cs_set_user_money(owner,user_money - money)
client_print(owner,print_chat,"【警告】你闪到队友了,将随机给予金钱惩罚")
emit_sound(owner,CHAN_ITEM , "声音文件目录/声音文件", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
return PLUGIN_HANDLED
}
[/PHP]
PS:没做多的测试和编写,代码写在这份上了,有啥问题就自己解决吧,毕竟带孩子太辛苦了。 |
|