【随手】闪光惩罚
我那旮旯论坛也有人去发帖,真晕死,非要写个啥闪光惩罚,刚好拿团队闪光插件修改了一二,也不整啥附件了,直接复制吧,hamsandwich这个模块没想到如此强大。。。#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "FlashPunish"
#define VERSION "1.0"
#define AUTHOR ""
new g_nMsgScreenFade
new team
new owner
static const punish_money= {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
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
}
PS:没做多的测试和编写,代码写在这份上了,有啥问题就自己解决吧,毕竟带孩子太辛苦了。
回复: 【随手】闪光惩罚
:cool:嘿嘿加个语音就更好咯回复: 【随手】闪光惩罚
另外你要检查下这个和银行插件的起冲突不..如果玩家把钱全部存入了银行.这个惩罚就可以不可以变成处死呢?
上次发的那个基地乱扔闪光处死的那个插件.
如果玩家把钱全存入了银行.罚多少钱就变成给玩家加多少钱了:boss:
回复: 【随手】闪光惩罚
代码已经很精简了,说白了,只是个示范代码而已,要添加啥功能、更改相关的惩罚条件和与其他插件的矛盾,那就要自己看着办了,如果和银行插件一起,我估计扣钱就写成直接从银行扣吧。回复: 【随手】闪光惩罚
你忽略了一点,你没有检查被闪中者是不是活着的,这样观察者被闪到也会扣钱.这是不合理的回复: 【随手】闪光惩罚
Post by zwfgdlc你忽略了一点,你没有检查被闪中者是不是活着的,这样观察者被闪到也会扣钱.这是不合理的
哦,是的,懒得更新了,自己改正吧:byebye: :byebye:
回复: 【随手】闪光惩罚
Post by '']哦,是的,懒得更新了,自己改正吧:byebye: :byebye:
我靠 懒虫一个:brick: :brick:砸砖:brick: :brick:
回复: 【随手】闪光惩罚
算了,好人做到底吧。。。回复: 【随手】闪光惩罚
完全有劳兄了~~:super:我这就测试测试~~
Post by '
']哦,是的,懒得更新了,自己改正吧:byebye: :byebye:
能不能加变量代码啊:byebye:~~~让他显示出的效果更为好点,那位高人帮忙下~~~我不会呀~~~http://gg.a.5d6d.com/userdirs/b/2/ysjz/attachments/month_0809/20080907_a89463c458d6a96c0820i6WAZCUbRbpG.gif