rxki,
C++:
public MakeBonusFx(iEnt, id)
{
iEnt -= TASK_BONUS_FX;
if(!is_valid_ent(iEnt) || g_IsGameEnded)
return;
if(entity_get_float(iEnt, EV_FL_health) <= 0.0)
return;
new entlist[33];
new num
static iChance;
if(!iChance) iChance = g_ConfigValues[CFG_BONUS_STAEL_CHANCE];
if( (num = find_sphere_class(iEnt, "player", g_BonusThiefRange, entlist, 32) ) )
{
new Float:fOrigin[3], Origin[3];
new iPlayer, iRandom, plMoney;
for(new i ; i < num ; i++)
{
iPlayer = entlist[i];
if(!is_user_alive(iPlayer))
continue;
if(random(iChance - 1) == 0)
{
if(!fm_is_ent_visible(iPlayer, iEnt))
continue;
plMoney = cs_get_user_money(id);
if(!plMoney)
continue;
static iMin, iMax;
if(!iMin) iMin = g_ConfigValues[CFG_BONUS_MIN_GOLD]
if(!iMax) iMax = g_ConfigValues[CFG_BONUS_MAX_GOLD]
iRandom = random_num(iMin, iMax)
if(iRandom == 0)
continue;
entity_get_vector(iPlayer, EV_VEC_origin, fOrigin);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY )
write_byte(TE_BEAMENTPOINT)
write_short(iEnt | 0x1000)
write_coord_f(fOrigin[0])
write_coord_f(fOrigin[1])
write_coord_f(fOrigin[2])
write_short(g_SpriteLighting)
write_byte(0) // framerate
write_byte(4) // framerate
write_byte(4) // life
write_byte(40) // width
write_byte(0) // noise
write_byte(255) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(255) // brightness
write_byte(10) // speed
message_end()
entity_get_vector(iPlayer, EV_VEC_origin, fOrigin);
FVecIVec(fOrigin, Origin);
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY, Origin,iPlayer) //message begin
write_byte(TE_SPRITETRAIL)
write_coord(Origin[0]) // start position
write_coord(Origin[1])
write_coord(Origin[2])
write_coord(Origin[0] + random_num(-3,3)) // end position
write_coord(Origin[1]+ random_num(-3,3))
write_coord(Origin[2]+ random_num(-3, 3))
write_short(g_SpriteBloodDrop) // sprite index
write_byte(random_num(30, 60)) // count
write_byte(random_num(5, 15)) // life in 0.1's
write_byte(5) // scale in 0.1's
write_byte(random_num(10, 30)) // velocity along vector in 10's
write_byte(random_num(3, 5)) // randomness of velocity in 10's
message_end()
client_cmd(iPlayer, "spk sound/%s", g_SoundFile[SND_COIN]);
static szName[33];
get_user_name(iPlayer, szName, 32);
// g_BonusRobbedGold += iRandom;
plMoney -= iRandom
if(plMoney <= 0))
{
client_print_color(0, print_team_default, "%s^x01 Бонусный монстр убит и ограблен ^x03%s^x01", CHAT_PREFIX, szName);
cs_set_user_money(id, 0)
}
else
{
client_print_color(0, print_team_default, "%s^x01 Бонусный монстр украл ^x04%d золота^x01 у ^x03%s^x01", CHAT_PREFIX,iRandom, szName);
cs_set_user_money(id, plMoney);
}
}
}
}
set_task(0.5, "MakeBonusFx", iEnt + TASK_BONUS_FX);
}