Raised This Month: $ Target: $400
 0% 

VS Limbshot


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Afion
Junior Member
Join Date: Apr 2007
Location: Belgium
Old 04-16-2007 , 09:43   VS Limbshot
Reply With Quote #1

I made a plugin for the Vampire Slayer mod but it has a nasty bug in it. The idea is that vampires should always kill the slayer and not slap them to 5 hp if you hit them on a limb. This is my code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#define PLUGIN "VS No-Limbshot"
#define VERSION "2.0beta2"
#define AUTHOR "Afion"
////////////////////////////////////////////////////////////////////////////////////////////////////
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_event("Damage", "Event_Damage", "b")
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public Event_Damage(id) 
{
 new attacker = get_user_attacker(id)
 new victim = id
 new attackername[21]
 new victimname[21]
 
 get_user_name(attacker,attackername,20)
 get_user_name(victim,victimname,20)
 
 if(attacker == 0 || victim==0)
  return PLUGIN_CONTINUE
 
 if ((get_team(victim) == 2) && (get_team(attacker) == 1) && is_user_alive(victim)) 
  {
  user_silentkill(victim) 
 
  set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
  DeathMessage(attacker,victim,"claw")
 
  set_user_frags(attacker, get_user_frags(attacker)+1)
 
  console_print(0, "%s limbed %s", attackername, victimname)
  }
 return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////////////
stock get_team(id)
{
 new Team[8]
 get_user_team(id,Team,7)
 if(equali(Team,"VAMPIRE"))
  return 1
 if(equali(Team,"SLAYER"))
  return 2
 return 0
}
////////////////////////////////////////////////////////////////////////////////////////////////////
stock DeathMessage(attacker, victim, const weapon[])
{
    message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0) 
    write_byte(attacker)
    write_byte(victim)
    write_string(weapon)
    message_end()
}
It seems to work just fine. The slayer dies, the correct deathmessage pops up, but vamp stats dont change and the slayer gets -1 frag and +1 death. The really strange thing is that the next time the slayer dies (doesnt matter how), the vamp does get the +1 frag and the -1 frag for the slayer disappears. Im a noob at scripting and dont know how to fix it. The code probably has some other things that could be improved too.
Any reply that will improve the plugin or help me understand small and amxx better will be very appreciated
Afion is offline
 



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 06:46.


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