AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   pev_valid cache (https://forums.alliedmods.net/showthread.php?t=132078)

Empowers 07-11-2010 16:10

pev_valid cache
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define ENT_NUM 1024

new ent_valid[ENT_NUM]

public 
plugin_precache() {
    
register_forward(FM_CreateEntity,"ent_create")
    
register_forward(FM_CreateNamedEntity,"ent_create")
    
register_forward(FM_RemoveEntity,"ent_kill")    
}

public 
ent_create(ent)
    
ent_valid[ent] = true;
    
public 
ent_kill(ent)
    
ent_valid[ent] = false

Would such a caching work properly?

ConnorMcLeod 07-11-2010 17:17

Re: pev_valid cache
 
No.
Use pev_valid is fine.

Empowers 07-12-2010 05:44

Re: pev_valid cache
 
In my plugin I'm using pev_valid in the begining of prethink and addtofullpack. Would it make high CPU usage?

Arkshine 07-12-2010 05:47

Re: pev_valid cache
 
It's a small native, it's fine. But if you can, use it at the right moment.

Empowers 07-12-2010 05:49

Re: pev_valid cache
 
Quote:

Originally Posted by Arkshine (Post 1236423)
It's a small native, it's fine. But if you can, use it at the right moment.

Ok thx :wink:


All times are GMT -4. The time now is 07:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.