Hello.
I have a KillStreak plugin for cod servers. There is one of option in it that creates a user-controlled predator missle. Below the code that creates it.
I would like to modify it to make it has eg 50HP. I mean, make this missle breakable via gun or something. Could someone give me a hand with it, please?
PHP Code:
public CreatePredator(id)
{
if ( !is_valid_ent(id) )
return;
new num, players[32];
get_players(players, num, "gh");
for(new a = 0; a < num; a++)
{
new i = players[a];
if(cs_get_user_team(id) != cs_get_user_team(i))
client_cmd(i, "spk sound/mw/predator_enemy.wav");
else
client_cmd(i, "spk sound/mw/predator_friend.wav");
}
print_info(id, "Predator Missle");
new Float:Origin[3], Float:Angle[3], Float:Velocity[3], ent;
velocity_by_aim(id, 700, Velocity);
if ( !is_valid_ent(id) )
return;
entity_get_vector(id, EV_VEC_origin, Origin);
entity_get_vector(id, EV_VEC_v_angle, Angle);
Angle[0] *= -1.0;
ent = create_ent(id, "predator", "models/cod_predator.mdl", 2, 5, Origin);
entity_set_vector(ent, EV_VEC_velocity, Velocity);
entity_set_vector(ent, EV_VEC_angles, Angle);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMFOLLOW);
write_short(ent);
write_short(cache_trail);
write_byte(10);
write_byte(5);
write_byte(205);
write_byte(237);
write_byte(163);
write_byte(200);
message_end();
licznik_zabic[id] -= predator_steps[id];
if ( licznik_zabic[id] < 0 )
licznik_zabic[id] = 0
if ( licznik_zabic[id] < predator_steps[id] )
predator[id] = false;
attach_view(id, ent);
user_controll[id] = ent;
}