|
Author
|
Message
|
|
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
|

04-04-2017
, 02:37
Re: [ H3LP ] Explode entity ?
|
#1
|
Quote:
Originally Posted by CrazY.
Hey AlliedModders, currently I am developing a simple spawn model effect. Crazy? about what you are talkig (what the hell are this) ? Well, when a player spawn, a egg model is added into the player origin. I want explode this egg, but the egg model dont have a explode animation, then I used the following code to do that, but dont work well. Any idea?
Code:
public fw_PlayerSpawn_Post(id)
{
if (!is_user_alive(id) || !cs_get_user_team(id))
return;
new entity = create_entity("info_target");
if (!pev_valid(entity))
return;
new Float:origin[3];
entity_get_vector(id, EV_VEC_origin, origin);
set_pev(entity, pev_body, 1);
entity_set_model(entity, EGG_MODEL);
origin[2] -= 25;
entity_set_origin(entity, origin);
set_pev(entity, pev_owner, id);
entity_set_string(entity, EV_SZ_classname, "egg_class");
entity_set_int(entity, EV_INT_solid, 2);
if (get_cvar_num("mp_freezetime") <= 0)
explode_egg(id);
}
public explode_egg(id)
{
if (!is_user_connected(id))
return;
new entity = find_ent_by_owner(0, "egg_class", id);
// I dont know exactly if this is correct.
set_pev(entity, pev_framerate, 1.0);
//remove_entity(entity);
}
|
When using find_ent_by_x the starting index has to be -1 not 0.
Code:
find_ent_by_owner(0, "egg_class", id);
-->
Code:
find_ent_by_owner(-1, "egg_class", id);
__________________
|
|
|
|