PDA

View Full Version : Vampiric Code ok ?


anakin_cstrike
05-01-2008, 12:58
It's ok ? :oops:


#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Vampiric Aura"
#define VERSION "1.0"
#define AUTHOR "v3x"

new toggle,procentaje,proc_p,limit,limit_p;
new g_MsgSync;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

toggle = register_cvar("vampiric_aura","1");
procentaje = register_cvar("vampirica_drain","30");
limit = register_cvar("hp_limit","100");
limit_p = get_pcvar_num(limit);
proc_p = get_pcvar_num(procentaje);
g_MsgSync = CreateHudSyncObj();
}

public client_damage(attacker,victim,damage){

if(get_pcvar_num(toggle) != 1)
return;

if(!attacker || !victim)
return;

new bonus = damage * 100 / proc_p
new hp = get_user_health(attacker);

if(hp > limit_p){
set_user_health(attacker,limit);
}
if(hp < limit_p){
set_user_health(attacker,hp + bonus)
}
set_hudmessage(0,255,0,0.8,0.85,0,6.0,12.0)
ShowSyncHudMsg(attacker,g_MsgSync,"%d",bonus)}

Styles
05-01-2008, 13:25
If it w orks then yes. But I do see some dumb things right away. Also, I would recommend Ham_TakeDamage for this. Its more direct.

You can change:

limit = register_cvar("hp_limit","100");
limit_p = get_pcvar_num(limit);



limit = register_cvar("hp_limit","100");

Theres no need to get the percent there. You should do itin client damage. But yeah, :P

hazard1337
05-01-2008, 16:04
new Float: bonus You will get a decimal eventually

v3x
05-01-2008, 16:10
Don't take credit for other people's plugins just 'cause you changed a line or two! You actually thought that I wouldn't notice? Don't be stupid :stupid:

anakin_cstrike
05-10-2008, 14:34
Don't take credit for other people's plugins just 'cause you changed a line or two! You actually thought that I wouldn't notice? Don't be stupid :stupid:
WHAT ?!:o LOL:| somebody has edit my post:evil: at author it was my name...now it's yours :)
Now i see that somebody gives -karma to me..the code is 100% made by me...i asked that is ok,because it's a part of my plugin...i saw v3x's code for vampiric and is not even equal with this....