Raised This Month: $12 Target: $400
 3% 

What's the best way to detect entity type?


Post New Thread Reply   
 
Thread Tools Display Modes
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 12-27-2006 , 05:37   Re: What's the best way to detect entity type?
Reply With Quote #21

In CS yes 1 weaponbox = 1 containing weapon.

Why CS is designed like this we do not know, piss poor if you ask me. Since it means each weapon dropped = 2 entities instead of 1. I suppose in the cleanup code ie New Round they only search for weaponbox entities then remove them, still its a waste of entities IMHO.
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 12-28-2006 , 05:10   Re: What's the best way to detect entity type?
Reply With Quote #22

weaponbox really very funny thing. when you dropped a weapon an actual weapon has coodrinates where the player dropped a gun. i thought it should have the same origin as weaponbox and use appropriate function to search entity in radius to get real weapon entity (to make search function by owner MORE faster). it's very uncomfortable.

PS. This does not work:
Code:
new g_sEntvarOwner[] = "owner" new sOwner[5]; num_to_str(eid, sOwner, sizeof(sOwner)-1); new ent = engfunc(EngFunc_FindEntityByString, 0, g_sEntvarOwner, sOwner)
I think FindEntityByString works with string type entvars only.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 12-28-2006 , 06:28   Re: What's the best way to detect entity type?
Reply With Quote #23

Expanding on what team06 did.
Code:
new entlimit public plugin_init() {     // This should be fine here, might need abit more delay?     entlimit = engfunc(EngFunc_NumberOfEntities) } public FindEntityByOwner(owner) {     new i     for(i = entlimit+1; i < global_get(glb_maxEntities); ++i)     {         if(pev(i, pev_owner) == owner)             break     }     return i }
You'll save processes now, since you will be starting from like 100+ entity index instead of from maxplayers+1
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-30-2006 , 15:57   Re: What's the best way to detect entity type?
Reply With Quote #24

I guess i'll clear this up a bit and summarize.

You obviously messed the terms and weapon system construction principle. The weaponbox entity is not the actual weapon, it is the "box" entity that "contain" the weapon_* entity, i.e. the actual weapon entity. Of course weapon_* entities classnames are unique for the different weapon types. And as you noticed the actual weapon type is stored in the weapon's entity private data area that can be easily accessed via corresponding native function from the cstrike module.
As for the getting weapon type on drop, i recommend to review this thread: HOWTO: detect weapon drop details [including drop type, weapon type, etc]
VEN is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:03.


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