The plugin offers a forward that allow you to hook any buy attempt.
.: Forward :.
client_buy < player index > < item type >
Returns : PLUGIN_CONTINUE , PLUGIN_HANDLED
.: Item indexes :.
For weapons, index is the weapon type, so CSW_AK47 or CSW_MP5NAVY for example.
For vest and helmet, this is amxx defines : CSW_VEST and CSW_VESTHELM.
I had to introduce new indexes for the plugin, here they are :
user_has_item(id, iItem) { switch( iItem ) { case CSW_VEST, CSW_VESTHELM : { new CsArmorType:iArmorType cs_get_user_armor(id, iArmorType) return iArmorType == (iItem == CSW_VEST ? CS_ARMOR_KEVLAR : CS_ARMOR_VESTHELM) } case CSW_DEFUSER: { return cs_get_user_defuse(id) } case CSW_NVGS: { return cs_get_user_nvg(id) } case CSW_SHIELD: { cs_get_user_shield(id) } case CSW_PRIMAMMO, CSW_SECAMMO: { return 0 } } return user_has_weapon(id, iItem) }
PHP Code:
Message_Alias_Not_Avail(id, iId) { if( !user_has_item(id, iId) ) { message_begin(MSG_ONE_UNRELIABLE, g_iTextMsg, .player=id) // have to set g_iTextMsg = get_user_msgid("TextMsg") at plugin_init write_byte( print_center ) write_string( "#Alias_Not_Avail" ) write_string( g_szLabels[iId] ) message_end() } }
Asd'
02-06-2011 03:46
Re: [CS][Forward] client_buy
Thanks for this contribution, it will help me a lot.
By the way, Good job.
Greetings.
Exolent[jNr]
02-06-2011 04:16
Re: [CS][Forward] client_buy
Great work.
Arkshine
02-06-2011 06:36
Re: [CS][Forward] client_buy
1 Attachment(s)
Since it's always interesting to show severals ways of something, I post just another way using Orpheu. No harcoding. Also, to piss Connor off. :twisted:
Plugin not really tested. I won't develop more, it was just to see how it can be handled with orpheu. Feel free to Connor to do what he wants with it. :P
Signatures attached.
bibu
02-06-2011 06:43
Re: [CS][Forward] client_buy
:mrgreen:
Will use this for sure in the future.
xPaw
02-06-2011 06:51
Re: [CS][Forward] client_buy
Good job connor and arkshine
rx1983
02-06-2011 11:24
Re: [CS][Forward] client_buy
I read everything and could not understand anything. :down:
bibu
02-06-2011 12:04
Re: [CS][Forward] client_buy
Quote:
Originally Posted by rx1983
(Post 1408578)
I read everything and could not understand anything. :down:
Isn't the right section. And if you do not understand, you don't need to show like that this forward is bad for you. (meant your smile, yes)