Raised This Month: $153 Target: $400
 38% 

native error (native "remove_entity")


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kristina
New Member
Join Date: Nov 2019
Old 11-16-2019 , 16:24   native error (native "remove_entity")
Reply With Quote #1

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)
}
Kristina is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-16-2019 , 16:56   Re: native error (native "remove_entity")
Reply With Quote #2

Check if the entity is valid before removing it.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Kristina
New Member
Join Date: Nov 2019
Old 11-16-2019 , 17:17   Re: native error (native "remove_entity")
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Check if the entity is valid before removing it.
How do it?
Kristina is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-16-2019 , 17:43   Re: native error (native "remove_entity")
Reply With Quote #4

By checking "pev_valid()" before using "remove_entity()".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Location: Derbent, Caucasian
Old 11-17-2019 , 04:47   Re: native error (native "remove_entity")
Reply With Quote #5

Quote:
Originally Posted by Kristina View Post
How do it?
Code:
    if( !pev_valid( id ) )
        return;
__________________
Quote:
Learning Application Development /Pyhton/

Last edited by Fuck For Fun; 11-17-2019 at 04:48.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 11-17-2019 , 05:20   Re: native error (native "remove_entity")
Reply With Quote #6

Replace

PHP Code:
public off_model(id)
{
    if(
pev_valid(para_ent[id]))
    {
        
remove_entity(para_ent[id])
    }
    
para_ent[id] = 0
    Kill_Trail
(id)
    
rendering_off(id)

__________________
Retired.
Xalus is offline
DJEarthQuake
Senior Member
Join Date: Jan 2014
Location: Midwest
Old 11-17-2019 , 16:08   Re: native error (native "remove_entity")
Reply With Quote #7

There's a much larger issue. Only the backpack shows when parachute is enabled. I fixed it up. Thank you for starting this. I wanted a smaller parachute plugin. Parachuting glow I set it to only happen when low on HP. There was much strobe with other plugin I use. It was tested and made stable. Once bots entered game random crashes. That should be resolved now too.

Code:
    new Float:frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0     //Insert to fix no animation     if( (is_valid_ent(para_ent[id])) && (entity_get_int(para_ent[id],EV_INT_sequence) == 0) ){         frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0     entity_set_float(para_ent[id],EV_FL_fuser1,frame)     entity_set_float(para_ent[id],EV_FL_frame,frame)         if (frame > 100.0) {     entity_set_float(para_ent[id], EV_FL_animtime, 0.0)     entity_set_float(para_ent[id], EV_FL_framerate, 0.4)     entity_set_int(para_ent[id], EV_INT_sequence, 1)     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)     }     }     //End insert. Had backpack only. Working now.
Code:
    if(is_valid_ent(para_ent[id]) ){     remove_entity(para_ent[id])
Checksum dad0030778c2f12c1b527ebea7525158 Simple_parachute.sma
Attached Files
File Type: sma Get Plugin or Get Source (Simple_parachute.sma - 15 views - 3.5 KB)
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell

Last edited by DJEarthQuake; 11-17-2019 at 19:00. Reason: Surreality: Added 3rd person at lower HP level.
DJEarthQuake is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:46.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode