Raised This Month: $ Target: $400
 0% 

What's the best way to detect entity type?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-26-2006 , 13:42   Re: What's the best way to detect entity type?
Reply With Quote #1

It works fine it because of your usage. You can't use it on the weaponbox entity. You have to use it on the weapon itself. So you need to search for the actually weapon entity index.

Code:
#include <amxmodx> #include <fakemeta> #include <cstrike> new g_hTouch = 0 public plugin_init() {     g_hTouch = register_forward(FM_Touch, "onTouch") } public plugin_end() {     if(g_hTouch) {         unregister_forward(FM_Touch, g_hTouch)         g_hTouch = 0     } } public onTouch(eid, pid) {     if(!eid) return FMRES_IGNORED     if(isWeapon(eid))     {         new ent = FindEntityByOwner(eid)         if(ent)         {             server_print("[AMXX] cs_get_weapon_id(%d) = %d", eid, cs_get_weapon_id(ent))         }     }     return FMRES_IGNORED } stock FindEntityByOwner(owner) {     new i;     for(i = get_maxplayers() + 1; i < global_get(glb_maxEntities); i++)     {         if(pev(i, pev_owner) == owner)         {             break;         }     }     return i; } stock bool:isWeapon(ent_id) {     static pStr     static sBuffer[11] // sizeof("weaponbox") + 1     pev(ent_id, pev_classname, pStr, sBuffer, sizeof(sBuffer)-1)     server_print("%s", sBuffer);     return bool:equal(sBuffer, "weaponbox") }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Reply



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:19.


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