[Solved] How to remove entity using ReAPI.

Coding Help/Re-API Supported
Locked
User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

[Solved] How to remove entity using ReAPI.

#1

Post by z0h1r-LK » 2 years 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 z0h1r-LK 2 years ago, edited 1 time in total.

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 15
Joined: 2 years ago
Location: Malaysia
Contact:

#2

Post by wbyokomo » 2 years 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)
[MMG]~Zombie-Escape-X
Image
[MMG]~Zombie-Plague-X
Image
[MMG]~Multi-Mod-X
Image

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#3

Post by z0h1r-LK » 2 years 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. }

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 15
Joined: 2 years ago
Location: Malaysia
Contact:

#4

Post by wbyokomo » 2 years ago

This is enough:

Code: Select all

stock RemoveEntitySafe(ent)
{
	set_pev(ent, pev_flags, FL_KILLME)
	dllfunc(DLLFunc_Think, ent)
}
[MMG]~Zombie-Escape-X
Image
[MMG]~Zombie-Plague-X
Image
[MMG]~Multi-Mod-X
Image

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#5

Post by z0h1r-LK » 2 years ago

wbyokomo wrote: 2 years 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

User avatar
wbyokomo
VIP
VIP
Malaysia
Posts: 15
Joined: 2 years ago
Location: Malaysia
Contact:

#6

Post by wbyokomo » 2 years 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.
[MMG]~Zombie-Escape-X
Image
[MMG]~Zombie-Plague-X
Image
[MMG]~Multi-Mod-X
Image

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#7

Post by z0h1r-LK » 2 years ago

wbyokomo wrote: 2 years 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!


Locked

Who is online

Users browsing this forum: No registered users and 2 guests