|
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
|

06-18-2009
, 17:18
Overkill fix please
|
#1
|
The plugin OverKill (originally for cs but said to work for all), on tfc it wants me to enable debug, but it wont work on my linux box, but when I debug on my windows box this is what I get
Code:
L 06/18/2009 - 23:14:00: Start of error session.
L 06/18/2009 - 23:14:00: Info (map "crossover2") (file "addons/amxmodx/logs/error_20090618.log")
L 06/18/2009 - 23:14:00: [AMXX] Displaying debug trace (plugin "overkill.amxx")
L 06/18/2009 - 23:14:00: [AMXX] Run time error 4: index out of bounds
L 06/18/2009 - 23:14:00: [AMXX] [0] overkill.sma::overkill (line 132)
and the main problem is that I will be put on my own team, but still on the same team
example:
Blue (7 players)
Red (1 player)
Red (6 players)
and another problem is after reaching the max overkill it will reset to the default health..
can someone help me please?
PHP Code:
/**************************************** * Author: TwN * * Credits (in random order) * * Yamikaitou * * connorr * * kingpin (idea of saving * * also borrowed * * some code) * * Greenberet * * Howdy * * * * Note, I like to use inline * * comments more, dno why... * * * * Similair plugins * * hitreward (mistagee) * * repay (kingpin port) * * * *****************************************/
#include <amxmodx> #include <fun>
#define AUTHOR "TwN" #define NAME "OverKill" #define VERSION "0.7.7.7"
enum Color { YELLOW = 1, // Yellow GREEN, // Green Color TEAM_COLOR, // Red, grey, blue GREY, // grey RED, // Red BLUE, // Blue }
new TeamInfo; new SayText;
new TeamName[][] = { "", "TERRORIST", "CT", "SPECTATOR" }
//new bool:IsConnected[33];
new g_health[33] new color[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_savehp
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","200") /* 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_savehp = register_cvar("amx_ok_savehp","1") /* save hp? */ register_event("DeathMsg","overkill","ade","5=0") /* 5=0 -> no car kills/trigger hurts etc. */ register_event("ResetHUD","load_health","be") register_logevent("save_health",2,"1=Round_End") TeamInfo = get_user_msgid("TeamInfo"); SayText = get_user_msgid("SayText"); return PLUGIN_CONTINUE }
public load_health(id) { if (!get_pcvar_num(amx_overkill) || !get_pcvar_num(amx_ok_savehp)) return PLUGIN_CONTINUE new hp = g_health[id] if (hp > 100) { // avoid conflicts with other plugins. Hope this works >< new curhp = get_user_health(id) hp = hp - 100 + curhp set_user_health(id,hp) switch(hp) { case 0..115: // green { color[0] = 0x04; } case 116..130: // yellow { color[0] = 0x01; } default: color[0] = 0x03; } //ColorChat(0, RED, "%s, This color is %s.", "Hello", "red"); ColorChat(id, RED, "^x04[^x1OK^x04]^x01 * You have %s%d^x01 health because of your previous OverKilling!",color,hp) client_print(id,print_chat,"[OK] * You have %d health because of your previous overkilling!",hp) } return PLUGIN_CONTINUE }
public save_health() { if (!get_pcvar_num(amx_overkill) || !get_pcvar_num(amx_ok_savehp)) return PLUGIN_CONTINUE for (new i = 1; i <= get_maxplayers(); ++i) g_health[i] = get_user_health(i) return PLUGIN_CONTINUE }
public overkill(id) { if (!get_pcvar_num(amx_overkill)) return PLUGIN_CONTINUE new killerid = read_data(1) 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 set_user_health(killerid,floatround(health)) //client_print(killerid,print_chat,"[OK] +%dhp.",floatround(rewardhp)) //ColorChat(0, RED, "%s, This color is %s.", "Hello", "red"); switch(floatround(rewardhp)) { case 0..25: // green { color[0] = 0x04; } default: color[0] = 0x03; } ColorChat(killerid, RED, "^x01[^x04OK^x01]^x01 +%s%d^x01hp!",color,floatround(rewardhp)) return PLUGIN_CONTINUE }
/* public client_putinserver(player) { IsConnected[player] = true; }
public client_disconnect(player) { IsConnected[player] = false; }*/
public ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) { if(get_playersnum() < 1) { return; } static message[256]; switch(type) { case YELLOW: // Yellow { message[0] = 0x01; } case GREEN: // Green { message[0] = 0x04; } default: message[0] = 0x03; } vformat(message[1], 251, msg, 4); // Make sure message is not longer than 192 character. Will crash the server. message[192] = '^0'; new ColorChange ColorChange = ColorSelection(id, MSG_ONE, type); ShowColorMessage(id, MSG_ONE, message); if(ColorChange) { Team_Info(id, MSG_ONE, TeamName[get_user_team(id)]); } }
public ShowColorMessage(id, type, message[]) { message_begin(type, SayText, _, id); write_byte(id) write_string(message); message_end(); }
public Team_Info(id, type, team[]) { message_begin(type, TeamInfo, _, id); write_byte(id); write_string(team); message_end(); return 1; }
public ColorSelection(index, type, Color:Type) { switch(Type) { case RED: { return Team_Info(index, type, TeamName[1]); } case BLUE: { return Team_Info(index, type, TeamName[2]); } case GREY: { return Team_Info(index, type, TeamName[0]); } } return 0; }
__________________
|
|