[Solved] How to remove entity using ReAPI.

Coding Help/Re-API Supported
Post Reply
User avatar
Z0uha1r_LK
Mapper
Mapper
Morocco
Posts: 317
Joined: 2 Years Ago
Location: Morocco
Has thanked: 82 times
Been thanked: 35 times
Age: 19
Contact:

[Solved] How to remove entity using ReAPI.

#1

Post by Z0uha1r_LK » 1 Month Ago

If someone want remove entity, It's use this :

Fake Meta:
  1. // Remove entity by Fake Meta.
  2. engfunc(EngFunc_RemoveEntity, iEnt)
I'm use this:
ReAPI:
  1. // Remove entity by ReAPI.
  2. set_entvar(iEnt, var_flags, FL_KILLME)
Question:
Are this is method correct to remove entity by ReAPI?
Last edited by Z0uha1r_LK on 27 Sep 2021, 21:44, edited 1 time in total.
Z0uha1r_LK

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 13
Joined: 3 Months Ago
Location: Malaysia
Has thanked: 0
Been thanked: 7 times
Contact:

#2

Post by wbyokomo » 1 Month Ago

From my experience.
EngFunc_RemoveEntity -- May cause server crash with improper use of these function.

Safely remove entity i always use:
set_pev(ent, pev_flags, FL_KILLME)
dllfunc(DLLFunc_Think, ent)
These users thanked the author wbyokomo for the post:
Z0uha1r_LK (1 Month Ago)
YOkOmO Zombie Escape X
Image
Zombie Plague
Image
MultiMod
Image

User avatar
Z0uha1r_LK
Mapper
Mapper
Morocco
Posts: 317
Joined: 2 Years Ago
Location: Morocco
Has thanked: 82 times
Been thanked: 35 times
Age: 19
Contact:

#3

Post by Z0uha1r_LK » 1 Month Ago

Like this?
  1. stock Remove_Entity(const iEnt) {
  2.     set_entvar(iEnt, var_flags, FL_KILLME)
  3.     set_entvar(iEnt, var_targetname, 0)
  4.     set_entvar(iEnt, var_nextthink, get_gametime())
  5. }
I see FL_KILLME in plugin Star Chaser AR, Entity is removing like this:
  1. UTIL_RemoveEntity(const Ent) {
  2.     set_entvar(iEnt, var_flags, FL_KILLME)
  3.     set_entvar(iEnt, var_targetname, 0)
  4. }
Z0uha1r_LK

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 13
Joined: 3 Months Ago
Location: Malaysia
Has thanked: 0
Been thanked: 7 times
Contact:

#4

Post by wbyokomo » 1 Month Ago

This is enough:

Code: Select all

stock RemoveEntitySafe(ent)
{
	set_pev(ent, pev_flags, FL_KILLME)
	dllfunc(DLLFunc_Think, ent)
}
These users thanked the author wbyokomo for the post:
Z0uha1r_LK (1 Month Ago)
YOkOmO Zombie Escape X
Image
Zombie Plague
Image
MultiMod
Image

User avatar
Z0uha1r_LK
Mapper
Mapper
Morocco
Posts: 317
Joined: 2 Years Ago
Location: Morocco
Has thanked: 82 times
Been thanked: 35 times
Age: 19
Contact:

#5

Post by Z0uha1r_LK » 1 Month Ago

wbyokomo wrote:
1 Month Ago
This is enough:

Code: Select all

stock RemoveEntitySafe(ent)
{
	set_pev(ent, pev_flags, FL_KILLME)
	dllfunc(DLLFunc_Think, ent)
}
If was we will use natives of Fakemeta library, Let's use easy method: :lol:
  1. engfunc(EngFunc_RemoveEntity, iEnt)
I try use natives of ReAPI only.
  1. set_entvar(iEnt, var_flags, FL_KILLME)
  2. set_entvar(iEnt, var_nextthink, get_gametime())
Thanks for relay :D
Z0uha1r_LK

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 13
Joined: 3 Months Ago
Location: Malaysia
Has thanked: 0
Been thanked: 7 times
Contact:

#6

Post by wbyokomo » 1 Month Ago

Like i said in my previous post above, improper use of EngFunc_RemoveEntity may lead to server crash. So i avoid that by using the stock i posted above. the reapi and fakemeta pev_ dont have any different in speed. For easy coding i still prefer pev and set_pev from fakemeta. But for private data i prefer to use reapi get/set_member.

[ Post made via Android ]
These users thanked the author wbyokomo for the post:
Z0uha1r_LK (4 Weeks Ago)
YOkOmO Zombie Escape X
Image
Zombie Plague
Image
MultiMod
Image

User avatar
Z0uha1r_LK
Mapper
Mapper
Morocco
Posts: 317
Joined: 2 Years Ago
Location: Morocco
Has thanked: 82 times
Been thanked: 35 times
Age: 19
Contact:

#7

Post by Z0uha1r_LK » 4 Weeks Ago

wbyokomo wrote:
1 Month Ago
Like i said in my previous post above, improper use of EngFunc_RemoveEntity may lead to server crash. So i avoid that by using the stock i posted above. the reapi and fakemeta pev_ dont have any different in speed. For easy coding i still prefer pev and set_pev from fakemeta. But for private data i prefer to use reapi get/set_member.

The last time I use FL_KILLME so much in plugin boss, server is still working well.
Thanks for help!
Z0uha1r_LK

User avatar
Z0uha1r_LK
Mapper
Mapper
Morocco
Posts: 317
Joined: 2 Years Ago
Location: Morocco
Has thanked: 82 times
Been thanked: 35 times
Age: 19
Contact:

#8

Post by Z0uha1r_LK » 4 Weeks Ago

Solved
Z0uha1r_LK

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest