| danielkza |
07-02-2007 00:19 |
Problems with FM_KeyValue forward
Hi ,i've been working on a weapon management plugin,and i'm trying to log keyvalues from all armoury_entity.
Code:
PHP Code:
public forward_keyvalue(ent, handle) { // Skip Players and check if entity is valid if (ent <= get_maxplayers() || !pev_valid(ent) || g_WeapIndexSize >= MAX_ARMOURY_ENTITIES) return FMRES_IGNORED // Start reading of KeyValues static class[32] get_kvd(handle, KV_ClassName, class,31) // Too Obvious if (!equali(class, "armoury_entity",14)) return FMRES_IGNORED static key[32], value[32] new numvalue get_kvd(handle, KV_KeyName, key, 31) get_kvd(handle, KV_Value, value, 31) numvalue = str_to_num(value) // Log the keys and values of the weapons to an array if (equali(key,"count",5)) { server_print("Ent #%d count=%d", ent, numvalue) g_WeapCount[g_WeapIndexSize] = numvalue } if(equali(key,"item",4)) { new solid = pev(ent,pev_solid) server_print("Ent #%d item=%d solid=%d", ent, numvalue,solid) g_WeapItem[g_WeapIndexSize] = numvalue } // Check if entity's position haven't been logged yet // and do it if (ent != g_LastEnt) { pev(ent, pev_origin, g_WeapOrigin[g_WeapIndexSize]) if (g_LastEnt > 0) { g_WeapIndex[g_WeapIndexSize] = ent g_WeapIndexSize++ } // Prevent skipping 1st weapon's item g_LastEnt = ent } return FMRES_IGNORED }
the console output is
Code:
Ent #66 count=1
Ent #67 count=1
Ent #68 item=16 solid=0
Ent #68 count=1
Ent #69 item=16 solid=0
Ent #69 count=1
Ent #103 item=4 solid=0
Ent #103 count=1
...
Why is it skipping 1st ent. item? Can anyone help me with this ?
|