View Single Post
Author Message
LordDeath
Member
Join Date: Feb 2019
Old 05-09-2020 , 21:26   remove_entity crash - amxx 1.9
Reply With Quote #1

Well, I have an entity index which I remove with remove_entity native. everything goes fine till I try to remove it the next round using checks (which shouldn't crash the server), but the if condition path somehow and then the server crashes.
Ex:
Code:
public basic_entity(id)
{
new Entity = create_entity("info_target");
Entity settings code (Model, Owner, Origin,etc...)
myEnt[id] = Entity
}
now, let's say I kill the entity and it goes fine
Code:
if(myEnt[id] && is_valid_ent(myEnt[id]))
remove_entity(myEnt[id])
it gets removed normally and it goes fine, then I kill it again while it's not there using the same code
Code:
if(myEnt[id] && is_valid_ent(myEnt[id]))
remove_entity(myEnt[id])
The server crashes, as if the entity is in the world (if condintion passes while it shouldn't).
even keeping the native alone, the server still crashes and the code gets excuted regardless of the check
Code:
if(is_valid_ent(myEnt[id]))
remove_entity(myEnt[id])
the IF condiontions shouldn't pass since the entity isn't there, but still, it passes and the code native gets executed and crashes the server. any solution?

Last edited by LordDeath; 05-10-2020 at 14:08.
LordDeath is offline