Finding Weapon Entities
How can I find weapon entities that are on the floor? For instance, I'm trying to find out if the client is close enough to a m4a1 (classname "weapon_m4a1", I think) to do something. Its not working and I don't know why. Maybe I have the wrong classname, what IS the right classname for a dropped m4a1 (or any other weapon) or an easier way to find a dropped weapon without find_ent_in_sphere().[/i]
|
Classname of any dropped weapon is "weaponbox" I believe. You just have to figure out what the model name is (I would look in the server's basedir in the models directory) then you cna use find_ent_by_class or some such and then figure out if they're close enough.
I think that's right. |
Huh...Weapon box...I'll try it out then.
|
armoury_entity
It would have an index to indicate which weapon it is, but I am not exactly sure how to grab it in amx.. maybe an offset value, but I have never experimented with it... Also, here is the listing for it found in the Expert FGDs for making maps... Code:
@PointClass iconsprite("sprites/CS/Armoury.spr") size(-16 -16 0, 16 16 16) = armoury_entity : "Items in the armoury" |
You could just catch it AFTER spawn, when they are weapon_*'s.
|
You have to tell *dropped* weapons from weapons that are onground as they are compiled into the map.
Classname "weaponbox" is a dropped weapon. Classname "armoury_entity" is an onground weapon. You could loop through the weaponboxes but then you're not always sure which weapon entity it is tied to (I haven't found out a way). Instead you can loop through all weapon_m4a1 for instance, and check its EV_ENT_owner. If it's above get_maxplayers() it will be a weaponbox entity, and thus, a dropped weapon. For onground, compiled weapons you could just loop through the armoury_entity:s and check their EV_SZ_model. There is no weapon entity ever tied to an armoury_entity. To check if you are near the m4a1 then just compare the origin of the weaponbox. |
Does the weaponbox have the same key values as armoury_entity?
And, when looking at an fgd file, how can I tell which are the values and which are the actual keys? Like here Code:
item(choices) : "Item" : 0 = |
| All times are GMT -4. The time now is 14:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.