Raised This Month: $ Target: $400
 0% 

How to get Armoury Entity Weapon ID ( CSW_* ) ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 05-09-2014 , 09:20   How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #1

How to get Armoury Entity Weapon ID ( CSW_* ) ?

I am trying Ham_touch for armoury_entity but how to resolve the entity into its Weapon ID?

For WeaponBox types, we have fm_get_weaponbox_type () but that doesn't work on Maps where weapons are dropped by default ( no owner ). eg. aa_dima2, $1000$, etc. Only Once we pickup the weapon and drop it back, that this function responds to it on Touch.

( In Simple Words, If I want to touch an already dropped weapons on certain maps, I should be able to get its weapon id even before picking it up )

I was thinking of somehow temporarily faking weaponbox for armoury_entity. But I don't know how to do so.

Thanks!

Last edited by souvikdas95; 05-09-2014 at 09:26.
souvikdas95 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-09-2014 , 09:34   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #2

Code:
/* Get what weapon type (CSW_*) an armoury_entity is.  */ native cs_get_armoury_type(index);
__________________
hleV is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 05-09-2014 , 10:05   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #3

can you tell me the difference b/w cs_get_weapon_id(index) and cs_get_armoury_type(index). I mean, difference in usage. eg. Can I directly use cs_get_weapon_id(index) with weapon entities having class "weaponbox" ?
souvikdas95 is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-09-2014 , 12:27   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #4

Quote:
Originally Posted by souvikdas95 View Post
can you tell me the difference b/w cs_get_weapon_id(index) and cs_get_armoury_type(index). I mean, difference in usage. eg. Can I directly use cs_get_weapon_id(index) with weapon entities having class "weaponbox" ?
cs_get_armoury_type(index) returns type of weapon that's "armoury_entity"
cs_get_weapon_id(index) returns type of weapon

the answer to your question that should solve all questions is that weapons on the ground on maps like fy_snow are armoury_entity(is that even spelled right?) from mapping knowledge, so you will need to use it to detect weapons that are on the ground(if it's the only one you want to detect)

use cs_get_weapon_id(index) if you want to detect all weapons including the ones that spawn on the ground at newround
aron9forever is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 05-09-2014 , 13:02   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #5

@aron9forever - Then what is this -_- :

PHP Code:
GetWeaponBoxType ent )
{
    static 
weapon;
    for ( new 
i=1i<=5i++ )
    {
        
weapon get_pdata_cbase entm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX );
        if( 
weapon )
            return 
cs_get_weapon_id weapon );
    }
    return 
0;

Couldn't I simply use cs_get_weapon_id ( ent ) instead of using this function?

What I think is, it's based on the class of weapons. Armoury Entity is what we get in maps where weapons are spawned on the ground. Once we pick it up, it turns into Weaponbox type ( as tested from Ham_Touch ). So I will have to make 2 different checks for that.

Last edited by souvikdas95; 05-09-2014 at 13:05.
souvikdas95 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-09-2014 , 13:05   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #6

The function above is for "weaponbox" entity.
cs_get_armoury_type() is for "armoury_entity" entity.
__________________
hleV is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-09-2014 , 13:19   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #7

Quote:
Originally Posted by souvikdas95 View Post
@aron9forever - Then what is this -_- :

PHP Code:
GetWeaponBoxType ent )
{
    static 
weapon;
    for ( new 
i=1i<=5i++ )
    {
        
weapon get_pdata_cbase entm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX );
        if( 
weapon )
            return 
cs_get_weapon_id weapon );
    }
    return 
0;

Couldn't I simply use cs_get_weapon_id ( ent ) instead of using this function?

What I think is, it's based on the class of weapons. Armoury Entity is what we get in maps where weapons are spawned on the ground. Once we pick it up, it turns into Weaponbox type ( as tested from Ham_Touch ). So I will have to make 2 different checks for that.
you're losing me with all these questions, your original post does not explain what you want, all it says is you want to get the CSW_* of a weapon, well then cs_get_weapon_id ( index ) is the answer.

the correct way to get the CSW_* equivalent of the weapon a player touches then use the snippet taken from connormcleod.

his snippet goes all the way trough checking what weapon was picked up by index, then transforming said index and returning it as a CSW_*

cs_get_armoury_type(index) is for an entity, index as in entity index not as in weapon index, a weapon is an entity when it's on the ground, but it's armoury only when it was spawned with the map
once the gun is in your hand it's no longer an entity, you are the entity holding the gun(I think, I'm not sure of this one)
aron9forever is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-09-2014 , 14:18   Re: How to get Armoury Entity Weapon ID ( CSW_* ) ?
Reply With Quote #8

There're 3 different things.

1) A "weaponbox" entity
2) An "armoury_entity" entity
3) A "weapon_*" entity

A weaponbox it's an entity that carries a weapon_* entity on it.
An armoury_entity it's an entity which just gives a new weapon (defined on a member(offset)) when touching it
A weapon_* entity it's the weapon attached to the player. (it doesn't have model)
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS 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 09:45.


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