Checking if an entity is an NPC?
Discussion in 'Rust Development' started by Romzes, Sep 26, 2016.
-
Code:
bool isNPC( BaseEntity e ){ return e is BaseNPC; } -
How about this?
PHP:BasePlayer player -
I need to identify these NPC's:
Human NPC - Core for Rust | Oxide -
Thats simple. It generates random userID for each HumanNPC by this:
It tests against real humans like this:Code:var userId = (ulong) UnityEngine.Random.Range(0, 2147483647);
Code:void KillNpc(BasePlayer player) { if (player.userID >= 76560000000000000L || player.userID <= 0L || player.isDestroyed) return; cache.Remove(player.userID); player.KillMessage(); } -
Code:
bool isNPC(ulong _id) { if (_id < 76560000000000000L) return true; else return false; } -
Code:
static bool isNPC(ulong id) => id < 76560000000000000L;
