native error (native "remove_entity")
L 11/16/2019 - 01:487: [AMXX] [0] Parachute.sma:: off_model (line 112)
L 11/16/2019 - 01:487: [AMXX] [1] Parachute.sma::client_PreThink (line 73)
L 11/16/2019 - 01:488: [ENGINE] Entity 0 can not be removed
L 11/16/2019 - 01:488: [AMXX] Displaying debug trace (plugin "Parachute.amxx", version "1.0")
Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
new PL[] = "[MG] Parachute"
new VE[] = "1.0"
new AU[] = "Remake Nikron"
#pragma tabsize 0
new g_bParashute[33];
new gTrail;
new para_ent[33]
public plugin_precache()
{
precache_model("models/parachute.mdl")
}
public plugin_init()
{
register_plugin(PL, VE, AU)
}
public client_connect(id)
{
g_bParashute[id] = false;
entity_set_float(id, EV_FL_gravity, 1.0);
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return;
new Float:fallspeed = 100 * -1.0;
if(g_bParashute[id] && get_entity_flags(id) & FL_ONGROUND)
{
entity_set_float(id, EV_FL_gravity, 1.0);
g_bParashute[id] = false;
return;
}
if(get_user_button(id) & IN_USE)
{
new Float:velocity[3];
get_user_velocity(id, velocity);
if(velocity[2] < 0.0)
{
g_bParashute[id] = true;
entity_set_int(id, EV_INT_sequence, 3);
entity_set_int(id, EV_INT_gaitsequence, 1);
entity_set_float(id, EV_FL_frame, 1.0);
entity_set_float(id, EV_FL_framerate, 1.0);
entity_set_float(id, EV_FL_gravity, 0.1);
velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed;
set_user_velocity(id, velocity);
modelsss(id)
set_user_rendering(id,kRenderFxGlowShell,random_num(0,255),random_num(0,255),random_num(0,255),kRenderNormal,25)
}
else if(g_bParashute[id])
{
entity_set_float(id, EV_FL_gravity, 1.0);
g_bParashute[id] = false;
}
}
else if(get_user_oldbutton(id) & IN_USE)
{
entity_set_float(id, EV_FL_gravity, 1.0);
g_bParashute[id] = false;
off_model(id)
}
}
public Kill_Trail(id)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(99); // TE_KILLBEAM
write_short(id)
message_end()
}
public modelsss(id)
{
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if (velocity[2] < 0.0) {
if(para_ent[id] <= 0) {
para_ent[id] = create_entity("info_target")
if(para_ent[id] > 0) {
entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
entity_set_edict(para_ent[id], EV_ENT_aiment, id)
entity_set_edict(para_ent[id], EV_ENT_owner, id)
entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_model(para_ent[id], "models/parachute.mdl")
entity_set_int(para_ent[id], EV_INT_sequence, 0)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
set_rendering (para_ent[id],kRenderFxNone,255,255,255,kRenderNormal,25);
}
}
}
}
public off_model(id)
{
remove_entity(para_ent[id])
para_ent[id] = 0
Kill_Trail(id)
rendering_off(id)
}
public rendering_off(id)
{
set_user_rendering(id, kRenderFxGlowShell,0,0,0,kRenderNormal,25)
}