|
楼主 |
发表于 2015-3-1 12:04:58
|
显示全部楼层
来自 中国–山西–长治
本帖最后由 k1nader 于 2015-3-1 21:08 编辑
[mw_shl_code=pawn,true]
PlaySound( i_Ent, i_SoundType )
{
switch ( i_SoundType )
{
case POWERUP_SOUND :
{
emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM );
}
case ACTIVATE_SOUND :
{
emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 );
}
case STOP_SOUND :
{
emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM );
emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 );
}
}
}
DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] )
{
new tcolor[3];
new teamid = pev(i_Ent, LASERMINE_INT_TEAM);
switch(teamid){
case 1:{
tcolor[0] = 255
tcolor[1] = 0
tcolor[2] = 0
}
case 2:{
tcolor[0] = 0
tcolor[1] = 0
tcolor[2] = 255
}
}
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_BEAMPOINTS)
engfunc(EngFunc_WriteCoord,v_Origin[0])
engfunc(EngFunc_WriteCoord,v_Origin[1])
engfunc(EngFunc_WriteCoord,v_Origin[2])
engfunc(EngFunc_WriteCoord,v_EndOrigin[0]) //Random
engfunc(EngFunc_WriteCoord,v_EndOrigin[1]) //Random
engfunc(EngFunc_WriteCoord,v_EndOrigin[2]) //Random
write_short(beam)
write_byte(0)
write_byte(0)
write_byte(11) //Life
write_byte(5) //Width
write_byte(0)//wave
write_byte(tcolor[0]) // r
write_byte(tcolor[1]) // g
write_byte(tcolor[2]) // b
write_byte(255)
write_byte(255)
message_end()
}
CreateDamage(iCurrent,DmgMAX,Float:Radius)
{
new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER)
new TeamID= pev(iCurrent,LASERMINE_INT_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM)
new Player = -1;
new Float:distance,dmg;
new Float:tOrigin[3];
new Float:vOrigin[3];
new iHitHP,iHitTeam;
pev(iCurrent,pev_origin,vOrigin);
Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius);
while(Player != 0)
{
if(is_user_alive(Player))
{
pev(Player,pev_origin,tOrigin)
distance = get_distance_f(vOrigin, tOrigin)
dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance))
iHitHP = pev_user_health(Player) - dmg
iHitTeam = int:cs_get_user_team(Player)
if(iHitHP <= 0)
{
if(iHitTeam != TeamID)
{
cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY))
set_score(AtkID,Player,1,iHitHP)
}else
{
if(get_pcvar_num(g_LFF))
{
cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY))
set_score(AtkID,Player,-1,iHitHP)
}
}
}else
{
if(iHitTeam != TeamID || get_pcvar_num(g_LFF))
{
//set_pev(Player,pev_health,iHitHP)
set_user_health(Player, iHitHP)
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player)
write_byte(dmg)
write_byte(dmg)
write_long(DMG_BULLET)
engfunc(EngFunc_WriteCoord,vOrigin[0])
engfunc(EngFunc_WriteCoord,vOrigin[1])
engfunc(EngFunc_WriteCoord,vOrigin[2])
message_end()
}
}
}
Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius)
}
return PLUGIN_CONTINUE
}
CreateExplosion(iCurrent)
{
new Float:vOrigin[3]
pev(iCurrent,pev_origin,vOrigin)
//entity_get_vector(iCurrent, EV_VEC_origin, vOrigin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(99) //99 = KillBeam
write_short(iCurrent)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
engfunc(EngFunc_WriteCoord,vOrigin[0])
engfunc(EngFunc_WriteCoord,vOrigin[1])
engfunc(EngFunc_WriteCoord,vOrigin[2])
write_short(boom)
write_byte(50)
write_byte(15)
write_byte(0)
message_end()
/*
if (iHit == -1)
{
client_print(id, print_chat, "%s %s",CHATTAG,STR_MINEDETNATED)
} else
{
szNetName[0] = '^0'
engfunc(EngFunc_AllocString,iHit,szNetName)
//entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
client_print(id, print_chat, "%s %s %s",CHATTAG,szNetName,STR_MINEDETNATED2)
}
*/
}
CreateLaserDamage(iCurrent,isHit)
{
new Float:vOrigin[3],Float:vEnd[3]
pev(iCurrent,pev_origin,vOrigin)
pev(iCurrent,pev_vuser1,vEnd)
//new isHit = fm_trace_line(iCurrent, vOrigin, vEnd, vTrace)
new teamid = pev(iCurrent, LASERMINE_INT_TEAM)
new szClassName[32]
new Alive,God
new iHitTeam,iHitHP,id
new hitscore
if(isHit < 0 ) return PLUGIN_CONTINUE
szClassName[0] = '^0'
pev(isHit,pev_classname,szClassName,32)
if(equal(szClassName, "player"))
{
Alive = is_user_alive(isHit)
God = get_user_godmode(isHit)
if(!Alive || God) return PLUGIN_CONTINUE
iHitTeam = int:cs_get_user_team(isHit)
//iHitHP = entity_get_float(isHit,EV_FL_health) - float(LASER_HIT_DMG)
iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG)
id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32]
if( get_pcvar_num(g_LMODE) == MODE_LASERMINE)
{
if(iHitHP <= 0)
{
if(iHitTeam != teamid)
{
hitscore = 1
cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY))
//set_user_health(iHit, 0)
//entity_set_float(iHit, EV_FL_health,0.0)
emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM )
set_score(id,isHit,hitscore,iHitHP)
//entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
//client_print(id, print_chat, "[Zhu Yi] %s killed your mine.",szNetName)
}else
{
if(get_pcvar_num(g_LFF))
{
hitscore = -1
cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY))
emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM )
set_score(id,isHit,hitscore,iHitHP)
//set_user_health(iHit, 0)
//entity_set_float(iHit, EV_FL_health, 0.0)
//entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
//client_print(id, print_chat, "[Zhu Yi] %s killed your mine.",szNetName)
}
}
}else if(iHitTeam != teamid || get_pcvar_num(g_LFF))
{
//entity_set_float(isHit,EV_FL_health,iHitHP)
//set_user_health(isHit, iHitHP)
set_user_health(isHit,iHitHP)
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, isHit)
write_byte(get_pcvar_num(g_LDMG))
write_byte(get_pcvar_num(g_LDMG))
write_long(DMG_BULLET)
engfunc(EngFunc_WriteCoord,vOrigin[0])
engfunc(EngFunc_WriteCoord,vOrigin[1])
engfunc(EngFunc_WriteCoord,vOrigin[2])
message_end()
}
}else
{
CreateExplosion(iCurrent)
CreateDamage(iCurrent,get_pcvar_num(g_LRDMG),get_pcvar_float(g_LRADIUS))
RemoveEntity(iCurrent);
}
}else if(equal(szClassName, ENT_CLASS_NAME3))
{
new hl;
hl = pev_user_health(isHit);
set_user_health(isHit,hl-get_pcvar_num(g_LDMG));
}
return PLUGIN_CONTINUE
}
stock pev_user_health(id)
{
new Float:health
pev(id,pev_health,health)
return floatround(health)
}
stock set_user_health(id,health)
{
health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
}
stock get_user_godmode(index)
{
new Float:val
pev(index, pev_takedamage, val)
return (val == DAMAGE_NO)
}
stock set_user_frags(index, frags)
{
set_pev(index, pev_frags, float(frags))
return 1
}
stock pev_user_frags(index)
{
new Float:frags;
pev(index,pev_frags,frags);
return floatround(frags);
}
set_score(id,target,hitscore,HP){
new idfrags = pev_user_frags(id) + hitscore// get_user_frags(id) + hitscore
set_user_frags(id,idfrags)
//set_user_frags(id, idfrags)
//entity_set_float(id, EV_FL_frags, float(idfrags))
new tarfrags = pev_user_frags(target) + 1 //get_user_frags(target) + 1
set_user_frags(target,tarfrags)
//set_user_frags(target,tarfrags)
//entity_set_float(target, EV_FL_frags, float(tarfrags))
new idteam = int:cs_get_user_team(id)
new iddeaths = cs_get_user_deaths(id)
message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0)
write_byte(id)
write_byte(target)
write_byte(0)
write_string(ENT_CLASS_NAME)
message_end()
message_begin(MSG_ALL, g_msgScoreInfo)
write_byte(id)
write_short(idfrags)
write_short(iddeaths)
write_short(0)
write_short(idteam)
message_end()
set_msg_block(g_msgDeathMsg, BLOCK_ONCE)
//entity_set_float(target, EV_FL_health,float(HP))
set_user_health(target, HP)
//set_pev(target,pev_health,HP)
}[/mw_shl_code] |
|