Raised This Month: $51 Target: $400
 12% 

[Request] Curse plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 10-19-2017 , 03:55   [Request] Curse plugin
Reply With Quote #1

Hello.
Can anyone edit this plugin and add a /curse function which takes 20 HP from a player just like how /pray adds 20hp to the player.

https://forums.alliedmods.net/showpo...7&postcount=10
WhiteFang1319 is offline
imindfreak
Senior Member
Join Date: Oct 2007
Location: 127.0.0.1
Old 10-23-2017 , 00:06   Re: [Request] Curse plugin
Reply With Quote #2

Quote:
Originally Posted by WhiteFang1319 View Post
Hello.
Can anyone edit this plugin and add a /curse function which takes 20 HP from a player just like how /pray adds 20hp to the player.

https://forums.alliedmods.net/showpo...7&postcount=10
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(PLUGINVERSIONAUTHOR); 
    
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=133i++) 
    { 
        
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 
iSpecModeiSpecPlayerszName[32], szSpecName[32], izParam[1]; 
     
    
iSpecMode entity_get_int(idEV_INT_iuser1); 
    if(
iSpecMode == || iSpecMode == 3
    { 
        
client_printidprint_chat"You are not Spectating a player." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
HasCursed[id][0]) 
    { 
        
client_printidprint_chat"You have to wait for 2.5 seconds." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
HasCursed[id][1]) 
    { 
        
client_printidprint_chat"You have already cursed this round." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    
iSpecPlayer entity_get_int(idEV_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(iSpecPlayerEV_FL_health) <= 20.00//Change 20.00 to whatever limit you want otherwise just delete the if statement completely. 
    
{     
        
client_printidprint_chat"The Player you are spectating has less than 20 Hp and cannot be cursed to death." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    
get_user_nameidszNamecharsmax(szName)); 
    
get_user_nameiSpecPlayerszSpecNamecharsmax(szSpecName)); 
     
    
client_print0print_chat"%s has just cursed %s."szNameszSpecName); 
    
izParam[0] = iSpecPlayer
    
HasCursed[id][0] = true
    
set_task2.5"Curse", (TASK_CURSE+id), izParam1); 
    return 
PLUGIN_CONTINUE


public 
Curseparam[1], id 

    
id -= TASK_CURSE
    static 
Float:flCvarHealthFloat:flHealthFloat: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_healthentity_get_float(param[0], EV_FL_health)-flHealth); 
        
HasCursed[id][1] = true
    } 
    
HasCursed[id][0] = false

__________________
BeastGaming Community - Map Maker & Coder.
imindfreak is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 10-23-2017 , 08:37   Re: [Request] Curse plugin
Reply With Quote #3

Quote:
Originally Posted by imindfreak View Post
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(PLUGINVERSIONAUTHOR); 
    
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=133i++) 
    { 
        
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 
iSpecModeiSpecPlayerszName[32], szSpecName[32], izParam[1]; 
     
    
iSpecMode entity_get_int(idEV_INT_iuser1); 
    if(
iSpecMode == || iSpecMode == 3
    { 
        
client_printidprint_chat"You are not Spectating a player." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
HasCursed[id][0]) 
    { 
        
client_printidprint_chat"You have to wait for 2.5 seconds." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    if(
HasCursed[id][1]) 
    { 
        
client_printidprint_chat"You have already cursed this round." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    
iSpecPlayer entity_get_int(idEV_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(iSpecPlayerEV_FL_health) <= 20.00//Change 20.00 to whatever limit you want otherwise just delete the if statement completely. 
    
{     
        
client_printidprint_chat"The Player you are spectating has less than 20 Hp and cannot be cursed to death." ); 
        return 
PLUGIN_CONTINUE
    } 
     
    
get_user_nameidszNamecharsmax(szName)); 
    
get_user_nameiSpecPlayerszSpecNamecharsmax(szSpecName)); 
     
    
client_print0print_chat"%s has just cursed %s."szNameszSpecName); 
    
izParam[0] = iSpecPlayer
    
HasCursed[id][0] = true
    
set_task2.5"Curse", (TASK_CURSE+id), izParam1); 
    return 
PLUGIN_CONTINUE


public 
Curseparam[1], id 

    
id -= TASK_CURSE
    static 
Float:flCvarHealthFloat:flHealthFloat: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_healthentity_get_float(param[0], EV_FL_health)-flHealth); 
        
HasCursed[id][1] = true
    } 
    
HasCursed[id][0] = false

Thanks. I actually needed both of the functions. I had tried editing pray to curse before but it didn't work. I'll try this.

Edit: I tried it, it works like the edit I had done. Curse works but doesn't when the player has 100 hp. Do you think you can fix this?

Last edited by WhiteFang1319; 10-23-2017 at 09:08.
WhiteFang1319 is offline
imindfreak
Senior Member
Join Date: Oct 2007
Location: 127.0.0.1
Old 10-23-2017 , 18:20   Re: [Request] Curse plugin
Reply With Quote #4

Quote:
Originally Posted by WhiteFang1319 View Post
Thanks. I actually needed both of the functions. I had tried editing pray to curse before but it didn't work. I'll try this.

Edit: I tried it, it works like the edit I had done. Curse works but doesn't when the player has 100 hp. Do you think you can fix this?
Change 100.0 to 20.0 @ line 87
PHP Code:
flRemPlayerHealth 20.0+entity_get_float(param[0], EV_FL_health); 
__________________
BeastGaming Community - Map Maker & Coder.

Last edited by imindfreak; 10-23-2017 at 18:33.
imindfreak is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 10-24-2017 , 04:05   Re: [Request] Curse plugin
Reply With Quote #5

Quote:
Originally Posted by imindfreak View Post
Change 100.0 to 20.0 @ line 87
PHP Code:
flRemPlayerHealth 20.0+entity_get_float(param[0], EV_FL_health); 
Thanks. I'll try this when I reach home. Can you explain what the line does in both cases? And why did you change it to 20- ?

Edit: Thanks a lot. It works.

Last edited by WhiteFang1319; 10-24-2017 at 08:57.
WhiteFang1319 is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 10-25-2017 , 09:31   Re: [Request] Curse plugin
Reply With Quote #6

The plugin works but some players get cursed to death even though the condition for hp <= 20 is there. Anything?
WhiteFang1319 is offline
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 03-22-2018 , 14:25   Re: [Request] Curse plugin
Reply With Quote #7

Bump
WhiteFang1319 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode