Raised This Month: $ Target: $400
 0% 

Checking for primary or secondary attack?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Accela
New Member
Join Date: May 2006
Old 05-25-2006 , 21:19   Checking for primary or secondary attack?
Reply With Quote #1

Does anyone have even have a direction to point me at for this?

I'd like to check for secondary and restrict primary. Been reading for a couple hours now @_@
Accela is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-25-2006 , 21:24  
Reply With Quote #2

entity_get_button(id,EV_INT_button)

And then check & IN_ATTACK

So you have:

Code:
if(entity_get_button(id,EV_INT_button) & IN_ATTACK) {      // code }

And do the same for IN_ATTACK2 for alt attack.

To restrict it, it involves a bit more work. You basically have to constantly run this, in something like client_PreThink:

Code:
entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_ATTACK)

Or if that doesn't work, you can use:

Code:
entity_set_int(id,EV_INT,button,IN_CANCEL)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Accela
New Member
Join Date: May 2006
Old 05-25-2006 , 21:44  
Reply With Quote #3

Okay, i also added

#define IN_ATTACK2 (1<<11)

But i am getting this error when trying to compile :

/home/users/amxmodx/tmp3/phpSSBOGn.sma(70) : error 017: undefined symbol "entity_get_button"
Accela is offline
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 05-25-2006 , 22:55  
Reply With Quote #4

use get_user_button(id)
KCE is offline
Accela
New Member
Join Date: May 2006
Old 05-25-2006 , 23:04  
Reply With Quote #5

Well it was a good learning lesson. Time for me to start learning all this up again. I'll look around for guides. Anywho, i should have done this from the start!

I am just trying to modify this plugin (cs_OneHitKnifeKills) so that it only works with the secondary knife attack, not primary. So, any fixes you guys may have would help! Here is the code!

Code:
/************************************************     One Hit Knife Kills     Author: Rabid Baboon     Version: 1.3     Mod: Counter-Strike     Requires: AMX mod X v1.01     Required Modules: cstrike, fakemeta engine and csx     Description:         Kills a player in one hit from the knife.         Special Thanks:         FireStorm  - For the sucide message block function.         Changelog:         v1.3             Fixed getting knife kills when another player takes fall damage.         v1.2             Blocked sucide message from knife kills.         v1.1             Self-kill from fall damage while knife is out fixed. ************************************************/ #include <amxmodx> #include <cstrike> #include <csx> #include <fakemeta> #include <engine> #include <engine_stocks> #include <fun> /************************************************     Global Variables ************************************************/ new knifekill = 0 /************************************************     Main Functions ************************************************/ /************************************************     plugin_modules()         Required modules listed here. Plugin will not work if they are not loaded. ************************************************/ public plugin_modules() {     require_module("cstrike");     require_module("csx");     require_module("fakemeta");     require_module("engine"); } /************************************************     plugin_init()         Initializes the plugin. ************************************************/ public plugin_init() {     register_plugin("One Hit Knife Kills", "1.3", "Rabid Baboon")     register_forward(FM_AlertMessage,"blocksuicide")         return PLUGIN_HANDLED } /************************************************     client_damage(attacker, victim, damage, wpnindex, hitplace, TA)         Kills a player if he was damaged by a knife.         Called when a player takes damage ************************************************/ public client_damage(attacker, victim, damage, wpnindex, hitplace, TA) {       if(is_user_alive(victim))     {         if((attacker != victim)) //prevents killing self with knife from fall damage.         {             if(wpnindex == CSW_KNIFE && TA != 1)             {                 if(damage != DMG_FALL)                 {                     knifekill = 1                     if(hitplace == HIT_HEAD)                     {                         make_deathmsg(attacker, victim, 1, "knife")                     }                     else                     {                         make_deathmsg(attacker, victim, 0, "knife")                     }                     user_silentkill(victim)                     set_user_frags(attacker, get_user_frags(attacker)+1)                 }                       }         }     }                 return PLUGIN_HANDLED } /************************************************     blocksuicide(at_type, message[])         Blocks the sucide message caused user_silentkill        ************************************************/ public blocksuicide(at_type, message[]) {     if(containi(message,"suicide") > -1 && containi(message,"world") > -1 && knifekill == 1)     {         knifekill = 0         return FMRES_SUPERCEDE     }     return PLUGIN_CONTINUE } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par } */
Accela is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 05-26-2006 , 02:52  
Reply With Quote #6

in your client_damage forward, check if damage is more than 60. i don't know of any way to get that much damage on a single hit from a knife slash.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
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 16:18.


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