Raised This Month: $ Target: $400
 0% 

The Specialists - Brass Knuckles (Melee_Attack Usage)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Calimaw
Junior Member
Join Date: Dec 2006
Old 12-31-2006 , 19:46   Re: The Specialists - Brass Knuckles (Melee_Attack Usage)
Reply With Quote #1

Code:
#include <amxmodx> #include <fakemeta> #include <tsfun> #include <tsx> #include <engine> #define PLUGIN "Brass Knuckles" #define VERSION "1.0" #define AUTHOR "Calimaw/stupok69/Da_Ghost/XxAvalanchexX" new bool:g_brassknuckles[33] new bool:g_is_in_kungfu[33] public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)  register_message(get_user_msgid("WeaponInfo"), "WeaponInfo_function")  register_event("DeathMsg", "Event_Death", "a")  register_clcmd("say /brassknuckles", "cmdBrassKnuckles")  register_forward(FM_EmitSound, "EmitSound") } public plugin_precache() {  precache_sound("bknuckles/hit_01.wav") } public client_connect(id) {  g_brassknuckles[id] = false  g_is_in_kungfu[id] = true } public Event_Death() {  new id = read_data(2)  g_brassknuckles[id] = false  g_is_in_kungfu[id] = true } public WeaponInfo_function(msg_id, msg_dest, msg_entity) {  if(!get_msg_arg_int(1))  {   g_is_in_kungfu[msg_dest] = true  }  else  {   g_is_in_kungfu[msg_dest] = false  } } public cmdBrassKnuckles(id) {  if(!is_user_alive(id))   client_print(id, print_chat, "The dead cannot buy items!")  else if(g_brassknuckles[id])   client_print(id, print_chat, "What good would that do?")  else  {   g_brassknuckles[id] = true   client_print(id, print_chat, "You bought a pair of brass knuckles!")  }  return PLUGIN_HANDLED } public EmitSound(id, channel, sample[], Float:volume, Float:att, flags, pitch) {         if(!is_user_alive(id))                 return FMRES_IGNORED           if(equal(sample,"player/kungfuhit.wav"))         {                 new attacker = get_user_attacker(id);                   if(is_user_connected(attacker) && attacker != id                 && g_brassknuckles[attacker] && g_is_in_kungfu[attacker])                 {                         emit_sound(id,channel,"bknuckles/hit_01.wav",volume,att,flags,pitch+random_num(-30,60));                         return FMRES_SUPERCEDE;                 }         }           return FMRES_IGNORED }   public client_damage(attacker,victim,damage,wpnindex,hitplace,TA) {         if(!g_brassknuckles[attacker] || (wpnindex != 0 && wpnindex != TSW_KUNG_FU))                 return PLUGIN_CONTINUE;           extra_damage(attacker,victim,random_float(18.0,36.0),"Brass Knuckles");           new Float:punch[3];         punch[0] = random_float(-30.0,30.0);         punch[1] = random_float(-15.0,15.0);         punch[2] = random_float(-20.0,20.0);           set_pev(victim,pev_punchangle,punch);         set_pev(victim,pev_fixangle,1);           return PLUGIN_CONTINUE; }   public extra_damage(attacker,victim,Float:damage,weapon[]) {         if(pev(victim,pev_health) - damage <= 0.0)         {                 new Float:frags;                 pev(attacker,pev_frags,frags);                   user_silentkill(victim);                 set_pev(attacker,pev_frags,frags+1.0);                   message_begin(MSG_ALL,get_user_msgid("DeathMsg"));                 write_byte(attacker);                 write_byte(victim);                 write_string(weapon);                 message_end();                   pev(attacker,pev_frags,frags);                 message_begin(MSG_ALL,get_user_msgid("ScoreInfo"));                 write_byte(attacker);                 write_short(floatround(frags));                 write_short(get_user_deaths(attacker));                 write_short(0);                 write_short(0);                 message_end();                   pev(victim,pev_frags,frags);                 message_begin(MSG_ALL,get_user_msgid("ScoreInfo"));                 write_byte(victim);                 write_short(floatround(frags));                 write_short(get_user_deaths(victim));                 write_short(0);                 write_short(0);                 message_end();         }         else fakedamage(victim,weapon,damage,0); }

This is what I've got so far, alot of help and many thanks to XxAvalanchexX.

This is working fairly well for the most part, except that the damage, and sound will play on the 2nd hit, never the first. The hit_01.wav seems to be working normally, altho it takes a while to kick in or something, Im not sure. It's a bit strange.

The next step is to make it so that brass knuckles do not effect kicks (+attack2?) and stunts moves. Im still disecting the code to learn from the bits Avalanche added.
Calimaw is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 01-01-2007 , 04:38   Re: The Specialists - Brass Knuckles (Melee_Attack Usage)
Reply With Quote #2

I have an idea for making brass knuckles work only for +attack and not +attack2. I can't say how effective the method may be without actually testing it, but you can have a boolean for each player, and in a prethink function set the boolean to true when +attack button is pushed and false when +attack2 button is pushed. Then in the damage function check if the boolean is true before dealing the extra damage.
stupok 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 22:22.


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