Coding Help/Re-API Supported
-
z0h1r-LK
- Mod Developer
- Posts: 486
- Joined: 5 years ago
- Location: The Red City ❤
-
Contact:
#1
Post
by z0h1r-LK » 2 years ago
If someone want remove entity, It's use this :
Fake Meta:
// Remove entity by Fake Meta.
engfunc(EngFunc_RemoveEntity, iEnt)
I'm use this:
ReAPI:
// Remove entity by ReAPI.
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.
-
wbyokomo
- VIP
- 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
[MMG]~Zombie-Plague-X
[MMG]~Multi-Mod-X
-
z0h1r-LK
- Mod Developer
- Posts: 486
- Joined: 5 years ago
- Location: The Red City ❤
-
Contact:
#3
Post
by z0h1r-LK » 2 years ago
Like this?
stock Remove_Entity(const iEnt) {
set_entvar(iEnt, var_flags, FL_KILLME)
set_entvar(iEnt, var_targetname, 0)
set_entvar(iEnt, var_nextthink, get_gametime())
}
I see FL_KILLME
in plugin Star Chaser AR, Entity is removing like this:
UTIL_RemoveEntity(const Ent) {
set_entvar(iEnt, var_flags, FL_KILLME)
set_entvar(iEnt, var_targetname, 0)
}
-
wbyokomo
- VIP
- 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
[MMG]~Zombie-Plague-X
[MMG]~Multi-Mod-X
-
z0h1r-LK
- Mod Developer
- Posts: 486
- 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:
engfunc(EngFunc_RemoveEntity, iEnt)
I try use natives of ReAPI only.
set_entvar(iEnt, var_flags, FL_KILLME)
set_entvar(iEnt, var_nextthink, get_gametime())
Thanks for relay
-
wbyokomo
- VIP
- 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
[MMG]~Zombie-Plague-X
[MMG]~Multi-Mod-X
-
z0h1r-LK
- Mod Developer
- Posts: 486
- 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!
-
z0h1r-LK
- Mod Developer
- Posts: 486
- Joined: 5 years ago
- Location: The Red City ❤
-
Contact:
#8
Post
by z0h1r-LK » 2 years ago
Solved
Users browsing this forum: No registered users and 3 guests