Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
|
05-01-2010
, 22:43
Re: tag mismatch :(
|
#4
|
the whole code is 675 lines.
Code:
new g_health[33]
new g_bhealth[33]
new amx_overkill,amx_ok_perc,amx_ok_life_cap,amx_ok_max,amx_ok_reward_cap,amx_ok_perc_capped,amx_ok_ff,amx_ok_bb_cap,amx_ok_bb_enable
public plugin_init()
{
register_plugin(NAME,VERSION,AUTHOR)
amx_overkill = register_cvar("amx_overkill","1") /* on/off var */
amx_ok_perc = register_cvar("amx_ok_perc","100") /* starting perc */
amx_ok_life_cap =register_cvar("amx_ok_life_cap","250") /* maximum total healt*/
amx_ok_max = register_cvar("amx_ok_max","80") /* maximum reward per overkill 0 to disable */
amx_ok_reward_cap = register_cvar("amx_ok_reward_cap","5") /* hp before breaking down */
amx_ok_perc_capped = register_cvar("amx_ok_perc_capped","15") /* number to lower the perc by */
amx_ok_ff = register_cvar("amx_ok_ff","1") /* teamkills give reward? */
amx_ok_bb_cap = register_cvar("amx_ok_bb_cap", "5000") /* set the limit for the blood bank */
amx_ok_bb_enable = register_cvar("amx_ok_bb_enable", "1") /* is the bank open today? */
register_event("DeathMsg", "overkill", "a")
register_clcmd("amx_bloodbank", "bb_menu", -1, "Opens the Blood Bank Menu")
register_clcmd("say","say_help")
register_clcmd("say_team","say_help")
register_clcmd("setblood","set_user_blood",ADMIN_SLAY,"Sets a users bloodlevel")
register_forward(FM_Touch,"hook_touch")
RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
return PLUGIN_CONTINUE
}
Code:
public overkill() {
if (!get_pcvar_num(amx_overkill))
return PLUGIN_CONTINUE
new killerid = read_data(1)
new Victim = read_data(2)
new victimname[32]
get_user_name(Victim,victimname,31)
if (killerid == 0)
return PLUGIN_CONTINUE
new deadid = read_data(2)
//users should already connected and killer should be alive... duh.. >< just check for safety
if (!is_user_alive(killerid) && !is_user_connected(deadid))
return PLUGIN_CONTINUE
//Reward if it's a teamkill?
if (get_user_team(killerid) == get_user_team(deadid) && !get_pcvar_num(amx_ok_ff))
return PLUGIN_CONTINUE
g_health[deadid] = 100
new Float:hp = float(get_user_health(deadid) * -1)
if (!hp)
return PLUGIN_CONTINUE
new Float:rewardhp,Float:temp,Float:reward_cap = float(get_pcvar_num(amx_ok_reward_cap)),Float:perc = get_pcvar_num(amx_ok_perc) / 100.0,Float:perc_capped = get_pcvar_num(amx_ok_perc_capped) / 100.0,Float:tempperc
new inloop = 1
while (inloop)
{
if (hp <= reward_cap) {
temp = hp * perc
inloop = 0
}
else {
temp = reward_cap * perc
hp -= reward_cap
tempperc = perc
perc = perc - perc_capped
//client_print(killerid,print_chat,"perc %d hp %d",perc,hp)
if (perc < 0) {
tempperc = perc_capped + perc
temp += tempperc * hp
inloop=0
//client_print(killerid,print_chat,"in loop perc < 0 **perc=%d",perc)
}
}
rewardhp += temp
}
new Float:maxreward = float(get_pcvar_num(amx_ok_max))
if (maxreward)
rewardhp = rewardhp > maxreward ? maxreward : rewardhp
new Float:health = float(get_user_health(killerid))
health += rewardhp
new Float:life_cap = float(get_pcvar_num(amx_ok_life_cap))
if (life_cap)
health = health > life_cap ? life_cap : health
if(is_user_alive(killerid))
{
new Float:life_cap = float(get_pcvar_num(amx_ok_life_cap))
if(g_health[killerid] != life_cap)
{
g_health[killerid] = (floatround(health))
set_user_health(killerid,floatround(health))
client_print(killerid, print_chat, "[OK] +%dhp!",floatround(rewardhp))
if(get_pcvar_num(amx_ok_bb_enable))
{
if(killerid != Victim)
{
get_user_name(Victim,victimname,31)
new healthtransfer = g_bhealth[Victim]/2
if(healthtransfer < 1)
healthtransfer = 1
new healthloss = g_bhealth[Victim]/4
if((g_bhealth[killerid] + healthtransfer) <= (get_cvar_num(amx_ok_bb_cap)))
{
client_print(killerid,print_chat,"[OK] You have gained %d blood supply for killing %s.",healthtransfer,victimname)
client_print(Victim,print_chat,"[OK] You have lost %d blood supply for dying.",healthloss)
g_bhealth[killerid] += healthtransfer
g_bhealth[Victim] -= healthloss
}
else if((g_bhealth[killerid] + healthtransfer) > (get_pcvar_num(amx_ok_bb_cap)))
{
client_print(killerid,print_chat,"[OK] You could not gain any more Blood, because your current bank is full(%d)!",(get_cvar_num("amx_ok_bb_cap")))
}
}
}
else if(get_cvar_num("amx_ok_bb_enable") == 0)
{
client_print(killerid,print_chat,"[OK] No blood rewarded, because blood bank is disabled")
}
}
else if(g_health[killerid] == life_cap)
{
client_print(killerid,print_chat,"[OK] Could not gain any more life, you are at cap.")
}
}
return PLUGIN_CONTINUE
}
heres plugin init and the public of that code the errored line is colored again
__________________
Last edited by HLM; 05-01-2010 at 22:45.
|
|