Raised This Month: $ Target: $400
 0% 

is it possible to unregisted +attack ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anupm
Senior Member
Join Date: May 2010
Old 06-15-2011 , 16:45   is it possible to unregisted +attack ?
Reply With Quote #1

Hi ,

Is it possible to unregister +attack and instead of it creating one more command say fight to do the attack ?

if yes then how ?
anupm is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-15-2011 , 20:27   Re: is it possible to unregisted +attack ?
Reply With Quote #2

+attack is a client side command not a server one, the client sends a flag to the server which can be read using:
Code:
if(get_user_buttons(id) & IN_ATTACK)
{
    // player "id" is holding attack button
}
Still, if you want to block weapons from firing, you can set their next attack delay to something huge and you can then reset it using a commmand.

Using Ham_Weapon_PrimaryAttack you can hook weapon primary attack, it will give you the weapon entity (NOT CSW_* constants, entity) and you can use that to set it's next attack using set_pdata_float() on the entity with 46 as offset (47 for secondary attack) and the delay added... use something like 99999.0 and store the entity name in a array for that player (preferably indexed CSW_ id)
You could also make a global bool or something to determine if it's before or after the "fight" command but it would save alot of calls just by unregistering ham events when not needed.

Then on your "fight" command just loop through all players getting their weapons and using referenced array to get entity id and use that set_pdata_float() again, this time set it to 0.0
__________________
Hunter-Digital is offline
anupm
Senior Member
Join Date: May 2010
Old 06-16-2011 , 01:57   Re: is it possible to unregisted +attack ?
Reply With Quote #3

Thank youfor your valueable input . is there any way to set like if the use is firing two command like +attack and 2ndattack then only make the use fire the bullet ?
anupm is offline
Reply



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 08:07.


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