Raised This Month: $ Target: $400
 0% 

HP Modification Issue: Need Help! KNIFE PLUGIN


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
101
Member
Join Date: Nov 2023
Old 12-12-2023 , 03:35   Re: HP Modification Issue: Need Help! KNIFE PLUGIN
Reply With Quote #1

Quote:
Originally Posted by vres View Post
it has a flaw: when an admin types /35hp, 1hp, or acer, only their HP changes, and others remain unaffected.
you may applied the function while other players were dead .

this is general , u can edit the cmd as u like :
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fun>

new MaxP,hp;
new 
bool:gBotsReg;

public 
plugin_init() 
{
    
MaxP get_maxplayers()+1;
    
hp 100;
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost",1);
    
register_clcmd("say","cmdhp");
}

public 
cmdhp(id)
{
    new 
Args[16];
    
read_args(Args,16);
    if (
contain(Args,"/mod")!=-1)
    {
        if ( 
get_user_flags(id)&ADMIN_RCON )
        {
            new 
index strfind(Args,"d",false,4)+1;    // start from 4 , bring what is after "d" letter (in case admin was drunk)
            
new value str_to_num(Args[index]);
            if (! 
value)
            {        
                
client_print(idprint_chat,"Usage /mod%d",random(99)+1);
            }
            else
            {
                
hp=value;
                
Start_Mod();    // You Can do <Restart Round> instead of the loop below : server_cmd("sv_restart 1");
            
}
        }
        else 
client_print(idprint_chat,"You don't have access to this command");
    }
    return 
PLUGIN_CONTINUE;
}

Start_Mod()
{
    new 
P_Team;
    for (new 
i=1iMaxP i++)
    {
        
P_Team get_user_team(i);
        if (
P_Team==|| P_Team==2)
            
ExecuteHamB(Ham_CS_RoundRespawn,i);
    }
}
    
public 
hudgoster()
{
    
set_hudmessage(2001000, -0.98, -0.73, .effects, .holdtime0.8)
    if (!
show_hudmessage(0"%dHP mode active",hp))
        
remove_task(100);
}

public 
client_authorized(id)
{
    if(!
task_exists(100))
        
set_task(1.0,"hudgoster",100,_,_,"b");
    if(!
gBotsReg    &&    get_cvar_pointer("bot_quota")    &&    is_user_bot(id))
        
set_task(0.1,"register_Ham_for_bots",id);    
}

public 
register_Ham_for_bots(id)
{
    if(!
gBotsReg)
    {
        
gBotsReg true;
        
RegisterHamFromEntity(Ham_Spawn,id,"fwHamPlayerSpawnPost",1); 
    }
}

public 
fwHamPlayerSpawnPost(id)
{
    
set_user_health(id,hp);

Attached Files
File Type: sma Get Plugin or Get Source (HP_modifier.sma - 19 views - 1.7 KB)

Last edited by 101; 12-12-2023 at 03:54.
101 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 00:32.


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