AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved 1 HP for all (https://forums.alliedmods.net/showthread.php?t=327491)

Magicher0ex 09-22-2020 09:02

1 HP for all
 
Hey guys, can anyone make a plugin with cvar. I want all players to have a only 1 hp. If anyone add a command /hp for admins that will be great.

r0ma 09-22-2020 14:21

Re: 1 HP for all
 
PHP Code:

#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "r0ma'"

// Comment next line if you want only for the current round
#define ALL_ROUNDS

#if defined ALL_ROUNDS
new g_iActive;
#endif
new g_iMaxPlayers;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
#if defined ALL_ROUNDS
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1);
    
#endif
    
    
register_clcmd("say /hp""clcmd_hp");
    
    
g_iMaxPlayers get_maxplayers();
}

#if defined ALL_ROUNDS
public fw_PlayerSpawn_Post(id) {
    if(
g_iActive && is_user_alive(id))
        
set_user_health(id1);
}
#endif

public clcmd_hp(id) {
    if(!(
get_user_flags(id) & ADMIN_CVAR))
        return 
PLUGIN_HANDLED;
    
    
#if defined ALL_ROUNDS
    
g_iActive =! g_iActive;
    
client_print(idprint_chat"[AMXX] 1 Hp %s"g_iActive "ON" "OFF");
    
    if(
g_iActive) {
    
#else
    
client_print(idprint_chat"[AMXX] 1 Hp ON");
    
#endif
        
for(new 1<= g_iMaxPlayersi++) {
            if(
is_user_alive(i))
                
set_user_health(i1);
        }
    
#if defined ALL_ROUNDS
    
}
    
#endif
    
    
return PLUGIN_HANDLED;



Magicher0ex 09-22-2020 15:47

Re: 1 HP for all
 
Quote:

Originally Posted by r0ma (Post 2718468)
PHP Code:

#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "r0ma'"

// Comment next line if you want only for the current round
#define ALL_ROUNDS

#if defined ALL_ROUNDS
new g_iActive;
#endif
new g_iMaxPlayers;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
#if defined ALL_ROUNDS
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1);
    
#endif
    
    
register_clcmd("say /hp""clcmd_hp");
    
    
g_iMaxPlayers get_maxplayers();
}

#if defined ALL_ROUNDS
public fw_PlayerSpawn_Post(id) {
    if(
g_iActive && is_user_alive(id))
        
set_user_health(id1);
}
#endif

public clcmd_hp(id) {
    if(!(
get_user_flags(id) & ADMIN_CVAR))
        return 
PLUGIN_HANDLED;
    
    
#if defined ALL_ROUNDS
    
g_iActive =! g_iActive;
    
client_print(idprint_chat"[AMXX] 1 Hp %s"g_iActive "ON" "OFF");
    
    if(
g_iActive) {
    
#else
    
client_print(idprint_chat"[AMXX] 1 Hp ON");
    
#endif
        
for(new 1<= g_iMaxPlayersi++) {
            if(
is_user_alive(i))
                
set_user_health(i1);
        }
    
#if defined ALL_ROUNDS
    
}
    
#endif
    
    
return PLUGIN_HANDLED;



Thank you! Works perfect!:fox:


All times are GMT -4. The time now is 13:53.

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