Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <fun>
- new const Cvars[][] = { "bhp_killhp", "bhp_hshp", "bhp_hehp", "bhp_knifehp" };
- new const Values[] = { 5, 10, 20, 15 };
- new const HudMessages[][] = { "for kill", "for headshot", "for kill with HE", "for knife kill" };
- new g_Cvars[33], HudMsg[33], Health[33], g_HudSyncObj;
- public plugin_init()
- {
- register_plugin("Bonus HP", "v1.1", "N3u[T]r4L & AlerteR");
- for(new i = 0;i < sizeof Cvars;i++)
- g_Cvars[i] = register_cvar(Cvars[i], Values[i]);
- g_HudSyncObj = CreateHudSyncObj();
- register_event("DeathMsg", "PlayerDeath", "ade");
- }
- public PlayerDeath()
- {
- new Attacker = read_data(1);
- new Victim = read_data(2);
- new Headshot = read_data(3);
- new HEAttack = get_user_weapon(Attacker) == CSW_HEGRENADE;
- new KnifeAttack = get_user_weapon(Attacker) == CSW_KNIFE;
- set_hudmessage(60, 200, 25, -1.0, 0.25, 0, 1.0, 2.0, 0.1, 0.2, 2);
- if(Attacker != Victim && is_user_connected(Attacker))
- {
- Health[Attacker] += get_pcvar_num(g_Cvars[1]);
- HudMsg[Attacker] += 1;
- if(Headshot)
- {
- Health[Attacker] += get_pcvar_num(g_Cvars[2]);
- HudMsg[Attacker] += 2;
- }
- if(HEAttack)
- {
- Health[Attacker] += get_pcvar_num(g_Cvars[3]);
- HudMsg[Attacker] += 3;
- }
- if(KnifeAttack)
- {
- Health[Attacker] += get_pcvar_num(g_Cvars[4]);
- HudMsg[Attacker] += 4;
- }
- ShowSyncHudMsg(Attacker, g_HudSyncObj, "You've got %i HP %s.", Health[Attacker], HudMessages[HudMsg[Attacker]]);
- set_user_health(Attacker, get_user_health(Attacker) + Health[Attacker]);
- }
- return PLUGIN_CONTINUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement