Raised This Month: $ Target: $400
 0% 

CSW_SHIELD id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-30-2012 , 21:27   CSW_SHIELD id
Reply With Quote #1

What is weapon id of shield?

Code:
#define CSW_SHIELD      2
or
Code:
#define CSW_SHIELD      35
OvidiuS is offline
Send a message via Skype™ to OvidiuS
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-31-2012 , 00:45   Re: CSW_SHIELD id
Reply With Quote #2

Both are custom things coders are using.
Shield is not a weapon and has no weapon index in game code.
What do you need ?
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-31-2012 at 00:45.
ConnorMcLeod is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-31-2012 , 08:02   Re: CSW_SHIELD id
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Both are custom things coders are using.
Shield is not a weapon and has no weapon index in game code.
What do you need ?
After a little thinking, it doesn't even matter what is the id.
You are right.
Anyway i need to block weapon pickup for specific class.
Part of code:
Code:
new const global_ClassWeapons[ CLASSES ] = {     (1<<CSW_AWP)|(1<<CSW_DEAGLE),     (1<<CSW_DEAGLE),     (1<<CSW_AK47)|(1<<CSW_M4A1),     (1<<CSW_M249),     (1<<CSW_UMP45)|(1<<CSW_TMP),     (1<<CSW_MP5NAVY)|(1<<CSW_ELITE),     (1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN),     (1<<CSW_SG552)|(1<<CSW_ELITE),     (1<<CSW_M3)|(1<<CSW_UMP45),     (1<<CSW_DEAGLE),     (1<<CSW_P90)|(1<<CSW_DEAGLE),     (1<<CSW_SG552)|(1<<CSW_TMP),     (1<<CSW_AUG),     (1<<CSW_G3SG1)|(1<<CSW_DEAGLE),     (1<<CSW_P90),     (1<<CSW_MAC10),     (1<<CSW_GALIL)|(1<<CSW_FAMAS),     (1<<CSW_M4A1)|(1<<CSW_FIVESEVEN),     (1<<CSW_AK47)|(1<<CSW_ELITE),     (1<<CSW_GALIL)|(1<<CSW_MP5NAVY),     (1<<CSW_UMP45)|(1<<CSW_DEAGLE),     (1<<CSW_M4A1),     (1<<CSW_M4A1),     (1<<CSW_XM1014)|(1<<CSW_FAMAS),     (1<<CSW_AK47)|(1<<CSW_ELITE),     (1<<CSW_SHIELD)|(1<<CSW_DEAGLE),     (1<<CSW_TMP)|(1<<CSW_DEAGLE),     (1<<CSW_AK47)|(1<<CSW_XM1014) } public plugin_init( ) {     RegisterHam( Ham_Touch, "armoury_entity", "ham_Touch_weapon" );     RegisterHam( Ham_Touch, "weapon_shield", "ham_Touch_weapon" );     RegisterHam( Ham_Touch, "weaponbox", "ham_Touch_weapon" );         new const sWorldModels[ ][ ] =     {         "models/w_p228.mdl", "models/w_scout.mdl", "models/w_xm1014.mdl", "models/w_mac10.mdl","models/w_aug.mdl", "models/w_elite.mdl",         "models/w_fiveseven.mdl", "models/w_ump45.mdl", "models/w_sg550.mdl", "models/w_galil.mdl", "models/w_famas.mdl", "models/w_usp.mdl",         "models/w_glock18.mdl", "models/w_awp.mdl", "models/w_mp5.mdl", "models/w_m249.mdl", "models/w_m3.mdl", "models/w_m4a1.mdl", "models/w_tmp.mdl",         "models/w_g3sg1.mdl", "models/w_deagle.mdl", "models/w_sg552.mdl", "models/w_ak47.mdl", "models/w_p90.mdl", "models/w_shield.mdl"     }     new const iWeaponIds[ ] =     {         CSW_P228, CSW_SCOUT, CSW_XM1014, CSW_MAC10, CSW_AUG, CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45         CSW_SG550, CSW_GALIL, CSW_FAMAS, CSW_USP, CSW_GLOCK18, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1,         CSW_TMP, CSW_G3SG1, CSW_DEAGLE, CSW_SG552, CSW_AK47, CSW_P90, CSW_SHIELD     }         for( new i = 0; i < sizeof iWeaponIds; i++ )         TrieSetCell( global_tWeapons, sWorldModels[ i ], iWeaponIds[ i ] ) } public ham_Touch_weapon( iWeapon, id ) {     if( !g_boolConnected[ id ] )         return HAM_IGNORED;     new sModel[ 32 ];     pev( iWeapon, pev_model, sModel, charsmax( sModel ) );     if( TrieKeyExists( global_tWeapons, sModel ) )     {         new iValue;         if( TrieGetCell( global_tWeapons, sModel, iValue ) )         {             if( !( 1 & ( global_ClassWeapons[ global_iClass[ id ] ] >> iValue ) ) )                 return HAM_SUPERCEDE;         }     }     return HAM_IGNORED; }

Last edited by OvidiuS; 08-31-2012 at 08:07.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-31-2012 , 13:06   Re: CSW_SHIELD id
Reply With Quote #4

Problem with using the same callback for the 3 hooks is that you can't figure what you are touching.
This method is fine if you don't need to filter what you are touching.
Use 3 different callbacks gonna make your life easier, also will allow you to remove model check that is a poor method.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-31-2012 at 13:07.
ConnorMcLeod is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-31-2012 , 15:51   Re: CSW_SHIELD id
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Problem with using the same callback for the 3 hooks is that you can't figure what you are touching.
This method is fine if you don't need to filter what you are touching.
Use 3 different callbacks gonna make your life easier, also will allow you to remove model check that is a poor method.
Misread, i get it now

EDIT: hm, i dont see the advantage of this. Can you explain it :S

Last edited by OvidiuS; 08-31-2012 at 15:55.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
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 05:52.


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