Quote:
Originally Posted by WhiteFang1319
|
It's pretty simple to just rename pray to curse and change it to remove hp instead of add hp...
PHP Code:
#include <amxmodx>
#include <engine>
#define PLUGIN "Curse Plugin"
#define VERSION "1.0"
#define AUTHOR "Shooting King"
//created from Shooting King's Pray plugin and renamed Curse in order to remove hp instead of add
#define TASK_CURSE 78238
new bool:HasCursed[33][2];
new pCvar_Hp;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /curse", "cmd_TakeHp");
register_clcmd("say_team /curse", "cmd_TakeHp");
pCvar_Hp = register_cvar("amx_sk_curse_hp", "20");
register_event("HLTV", "event_NewRound", "a", "1=0", "2=0");
}
public event_NewRound()
{
for(new i=1; i < 33; i++)
{
HasCursed[i][1] = false;
HasCursed[i][0] = false;
}
}
public client_putinserver(id)
{
HasCursed[id][1] = false;
HasCursed[id][0] = false;
}
public cmd_TakeHp(id)
{
static iSpecMode, iSpecPlayer, szName[32], szSpecName[32], izParam[1];
iSpecMode = entity_get_int(id, EV_INT_iuser1);
if(iSpecMode == 0 || iSpecMode == 3)
{
client_print( id, print_chat, "You are not Spectating a player." );
return PLUGIN_CONTINUE;
}
if(HasCursed[id][0])
{
client_print( id, print_chat, "You have to wait for 2.5 seconds." );
return PLUGIN_CONTINUE;
}
if(HasCursed[id][1])
{
client_print( id, print_chat, "You have already cursed this round." );
return PLUGIN_CONTINUE;
}
iSpecPlayer = entity_get_int(id, EV_INT_iuser2);
//Change the value from 20.00 to something else if you don't want them to be cursed to death below
if(entity_get_float(iSpecPlayer, EV_FL_health) <= 20.00) //Change 20.00 to whatever limit you want otherwise just delete the if statement completely.
{
client_print( id, print_chat, "The Player you are spectating has less than 20 Hp and cannot be cursed to death." );
return PLUGIN_CONTINUE;
}
get_user_name( id, szName, charsmax(szName));
get_user_name( iSpecPlayer, szSpecName, charsmax(szSpecName));
client_print( 0, print_chat, "%s has just cursed %s.", szName, szSpecName);
izParam[0] = iSpecPlayer;
HasCursed[id][0] = true;
set_task( 2.5, "Curse", (TASK_CURSE+id), izParam, 1);
return PLUGIN_CONTINUE;
}
public Curse( param[1], id )
{
id -= TASK_CURSE;
static Float:flCvarHealth, Float:flHealth, Float:flRemPlayerHealth;
flRemPlayerHealth = 100.0-entity_get_float(param[0], EV_FL_health);
if( is_user_alive(param[0]) && (flRemPlayerHealth > 0.0))
{
flCvarHealth = get_pcvar_float(pCvar_Hp);
flHealth = ( flRemPlayerHealth >= flCvarHealth )? flCvarHealth:flRemPlayerHealth;
entity_set_float(param[0], EV_FL_health, entity_get_float(param[0], EV_FL_health)-flHealth);
HasCursed[id][1] = true;
}
HasCursed[id][0] = false;
}
__________________