|
楼主 |
发表于 2011-8-17 13:20:12
|
显示全部楼层
来自 中国–山东
register_event("CurWeapon","eWeaponChange","be")//没收闪光
gMaxPlayers = get_maxplayers()
db_slot_i = gMaxPlayers+1
}
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, teamnum,g_punishmoney,msg[168]
flashed = 0
teamnum = 0 //初始化闪到队友的人数
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
g_punishmoney = get_cvar_num("sl_punishmoney")
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 && is_user_alive(id) ){
if(is_player_in_buyzone(id)&& z_teamFlash && is_player_in_buyzone(flasher))//在购买区域,购时间的范围内!在基地乱丢闪光并闪到在基地的队友!
{
if(is_user_alive(flasher))
{
user_kill(flasher);//处死
ryu_set_money(flasher,0,1)//没收全部金钱
format(msg,sizeof msg - 1,"^x04[基地故意闪光]::^x03%s^x01在基地恶意扔闪光,已被^x04吊死^x01!!!,并^x04没收个人所有财产",name)
client_color(0, id, msg)
return FMRES_HANDLED
}
}else if(ryu_get_money(flasher) >= g_punishmoney){
format(msg,sizeof msg - 1,"^x04[^x03队友闪光提示^x04]::^x01队友 ^x03%s ^x01闪到你,赔偿你精神损失费^x04[^x03$%d^x04]",name,g_punishmoney)
client_color(id, id, msg)
client_cmd(id, "q3/hit" )
ryu_set_money(id,ryu_get_money(id)+g_punishmoney,1)
ryu_set_money(flasher,ryu_get_money(flasher) - g_punishmoney,1)
}else{
format(msg,sizeof msg - 1,"^x04[^x03队友闪光提示^x04]::^x01队友^x03 %s,^x01可他好穷啊!连 ^x04[$%d^x04] ^x01都赔不起,扁他...!",name,g_punishmoney)
client_color(id, id, msg)
user_slap(flasher,8,1)
client_cmd(id, "spk q3/hit" )
}
flashed = 1
teamnum++ //闪到队友的累计
}
save_stats(flasher)
}
if (flashed)
{
// 这个闪光的人 flasher 通知或惩罚他
if (playerFlash[flasher] >= get_pcvar_num(g_team_flashnum) ){
g_playerFlash[flasher] = true
format(msg,sizeof msg - 1,"^x04[^x03队友闪光处罚^x04]:^x01你因闪到队友超过^x04[^x03%d^x04]^x01次,当前地图已^x03禁止你使用闪光弹",get_pcvar_num(g_team_flashnum))
client_color(flasher, flasher, msg)
client_cmd(flasher, "spk q3/hit" )
save_stats(flasher)
return FMRES_HANDLED
}
else if(ryu_get_money(flasher) >= g_punishmoney){
format(msg,sizeof msg - 1,"^x04[^x03队友闪光处罚^x04]:^x01闪到^x04[^x03%d^x04]^x01个队友,赔偿^x03精神损失费^x04[^x03$%d^x04][^x01禁闪次数:^x03%d^x01次^x04/^x01此次是第^x03%d^x01次^x04]",teamnum,g_punishmoney*teamnum,get_pcvar_num(g_team_flashnum),playerFlash[flasher]+1)
client_color(flasher, flasher, msg)
}
else{
format(msg,sizeof msg - 1,"^x04[^x03队友闪光处罚^x04]:^x01闪到^x04[^x03%d^x04]^x01个队友,有钱赔钱,^x03没钱一人一拳^x04[^x01禁闪次数:^x03%d^x01次^x04/^x01此次是第^x03%d^x01次^x04]",teamnum,get_pcvar_num(g_team_flashnum),playerFlash[flasher]+1)
client_color(flasher, flasher, msg)
ryu_set_money(flasher,0,1)
}
client_cmd(flasher, "spk q3/hit" )
playerFlash[flasher]++
}
}
return FMRES_IGNORED
}
public client_putinserver(id)
{
load_stats(id)
}
public eNewRound(){
z_teamFlash=true
set_task(get_cvar_float("mp_buytime")*60+get_cvar_float("mp_freezetime"),"set_cvar")
}
public set_cvar()
{
z_teamFlash=false;
}
//防止用户断开后,之前记录的闪光闪到队友次数为0了
save_stats(id)
{
static name[64]
get_user_name(id, name, sizeof name - 1)
if (db_name[id][0] && !equal(name, db_name[id]))
{
if (db_slot_i >= sizeof db_name)
db_slot_i = gMaxPlayers+1
if ( !is_user_connected(id))
return;
copy(db_name[db_slot_i], 63, db_name[id])
db_playerFlash[db_slot_i] = db_playerFlash[id]
db_slot_i++
}
copy(db_name[id], 63, name)
db_playerFlash[id] = playerFlash[id]
}
//载入之前保存的数据!
load_stats(id)
{
static name[64], i
get_user_name(id, name, sizeof name - 1)
for (i = 0; i < sizeof db_name; i++)
{
if (equal(name, db_name[i]))
{
playerFlash[id] = db_playerFlash[i];
if(playerFlash[id] >= get_pcvar_num(g_team_flashnum))
{
g_playerFlash[id] = true
}
return;
}
}
}
// 记录被闪的人的闪光信息
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)) // 他的队伍是?
}
}
public HookBuyFlash(id)
{
if(!z_teamFlash && !is_player_in_buyzone(id))//购买时间内,购买区域内
return PLUGIN_HANDLED
if( get_pcvar_num(pTeamFlashed) && g_playerFlash[id])
{
client_print(id, print_center, "当前地图你闪到队友超过 %d 次,服务器禁止你购买闪光弹",get_pcvar_num(g_team_flashnum))
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public eAmmoX(id)
{
new clip, ammo
new wpnid = get_user_weapon(id, clip, ammo)
if ( wpnid == CSW_FLASHBANG && g_playerFlash[id] && get_pcvar_num(pTeamFlashed))
{
client_print(id, print_center, "当前地图你闪到队友超过 %d 次,服务器禁止你购买和使用闪光弹",get_pcvar_num(g_team_flashnum))
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public eWeaponChange(id)
{
new wpnid = read_data(2)
if ( wpnid == CSW_FLASHBANG && g_playerFlash[id] && get_pcvar_num(pTeamFlashed))
{
client_print(id, print_center, "当前地图你闪到队友超过 %d 次,服务器没收你的闪光弹",get_pcvar_num(g_team_flashnum))
fm_set_user_bpammo(id,CSW_FLASHBANG,0)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// Set User BP Ammo
stock fm_set_user_bpammo(id, weapon, amount)
{
static offset
switch(weapon)
{
case CSW_AWP: offset = OFFSET_AWM_AMMO;
case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO;
case CSW_M249: offset = OFFSET_PARA_AMMO;
case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO;
case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO;
case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO;
case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO;
case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO;
case CSW_P228: offset = OFFSET_P228_AMMO;
case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO;
case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO;
case CSW_HEGRENADE: offset = OFFSET_HE_AMMO;
case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO;
case CSW_C4: offset = OFFSET_C4_AMMO;
default: return;
}
set_pdata_int(id, offset, amount, 5);
}
stock ryu_set_money(id,money,flash=0)
{
set_pdata_int(id,OFFSET_CSMONEY,money,5);
message_begin(MSG_ONE,get_user_msgid("Money"),{0,0,0},id);
write_long(money);
write_byte(flash);
message_end();
}
stock ryu_get_money(id)
{
return get_pdata_int(id,OFFSET_CSMONEY,5);
}
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()
} |
|