|
发表于 2014-12-9 15:55:03
|
显示全部楼层
来自 中国–广东–深圳
重新写了一个。没测试,你试试。
[mw_shl_code=pawn,true]#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "k1nader"
new Float:g_FlashbangExplodeTime[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_forward(FM_SetModel, "fw_SetModel", 1);
RegisterHam(Ham_Think, "grenade", "HamGrenadeThink", 0);
register_message(get_user_msgid("ScreenFade"), "MsgScreenFade");
}
public fw_SetModel(Ent, model[])
{
if (strlen(model) > 8 && (model[7] == 'w' && model[8] == '_' && model[9] == 'f'))
{
new Float:dmgtime;
pev(Ent, pev_dmgtime, dmgtime);
if(dmgtime > 0.0)
{
new id = pev(Ent, pev_owner);
if (is_user_connected(id))
{
set_pev(Ent, pev_iuser3, CSW_FLASHBANG);
set_pev(Ent, pev_bInDuck, 1);
g_FlashbangExplodeTime[id] = 0.0;
}
}
}
}
public HamGrenadeThink(Ent)
{
if(pev_valid(Ent) && pev(Ent, pev_iuser3) == CSW_FLASHBANG && pev(Ent, pev_bInDuck))
{
new Float:dmgtime;
pev(Ent, pev_dmgtime, dmgtime);
if(dmgtime <= get_gametime())
{
new id = pev(Ent, pev_owner);
if (is_user_connected(id))
g_FlashbangExplodeTime[id] = get_gametime();
}
}
}
public MsgScreenFade(msgid, msgdest, id)
{
if(get_msg_arg_int(4) == 255 && get_msg_arg_int(5) == 255 && get_msg_arg_int(6) == 255)
{
if (is_user_alive(id))
{
static Sender;
Sender = 0;
static Float: fGameTime;
fGameTime = get_gametime();
for (new i = 1; i <= get_maxplayers(); i++)
{
if (g_FlashbangExplodeTime == fGameTime)
{
Sender = i;
break;
}
}
if (is_user_connected(Sender))
{
if (get_user_team(Sender) == get_user_team(id) && id != Sender)
{
new msg[125], name[32];
get_user_name(Sender, name, charsmax(name));
format(msg, charsmax(msg), "^3%s ^1闪到了你^4 揍他!", name);
client_color(id, id, msg);
user_slap(Sender, 8, 1);
}
}
}
}
}
public client_color(playerid, colorid, msg[])
{
message_begin(playerid ? MSG_ONE : MSG_ALL, get_user_msgid("SayText"), _, playerid)
write_byte(colorid)
write_string(msg)
message_end()
}[/mw_shl_code] |
|