AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   code to block round hp. (https://forums.alliedmods.net/showthread.php?t=231731)

SkumTomteN 12-19-2013 10:42

code to block round hp.
 
This is the code to do it. the zp 4.3 got bugs. that will make so human "by accident", have 4000 hp, or 350. 650. random. and last human hp will save in the next round. (BAD!)

This is the way i want it.

humans always start round with 250 hp. and last human have 1000 hp. the hp will be 250 in the next round and so on.

and if used an anit-dote. it will be 250 hp. This is the only code i got. thats not working well.

Code:

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

#define PLUGIN "No Round Start Heal"
#define VERSION "1.0"
#define AUTHOR "Sho0ter"

new health[33]

public plugin_init()
{
            register_plugin(PLUGIN, VERSION, AUTHOR)
            RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
            register_logevent("round_end", 2, "1=Round_End")
            register_event("TextMsg", "round_restart", "a", "2&#Game_C", "2&#Game_w")
            return PLUGIN_CONTINUE
}

public client_putinserver(id)
{
            health[id] = 250
            return PLUGIN_CONTINUE
}

public fw_PlayerSpawn_Post(id)
{
            if(!is_user_connected(id) || !is_user_alive(id) || health[id] <= 250)
            {
                return PLUGIN_CONTINUE
            }
            set_user_health(id, health[id])
            health[id] = 250
            return PLUGIN_CONTINUE
}

public round_end()
{
        for(new id; id <= get_maxplayers(); id++)
            {
                if(!is_user_connected(id) || !is_user_alive(id) || get_user_team(id) != 2)
                {
                            continue
                }
                health[id] = get_user_health(id)
            }
            return PLUGIN_CONTINUE
}

public round_restart()
{
            for(new id; id <= get_maxplayers(); id++)
            {
                health[id] = 250
            }
            return PLUGIN_CONTINUE
}

is it something wrong with it?.

DavidJr 12-19-2013 11:31

Re: code to block round hp.
 
PHP Code:

public plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)
        
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
}

public 
fw_PlayerSpawn_Post(id)
{
        if(!
is_user_connected(id) || !is_user_alive(id))
        {
            return;
        }

        
set_user_health(id250)


Give you 250 hp everytime you spawn

SkumTomteN 12-20-2013 19:58

Re: code to block round hp.
 
Quote:

Originally Posted by DavidJr (Post 2073922)
PHP Code:

public plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)
        
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
}

public 
fw_PlayerSpawn_Post(id)
{
        if(!
is_user_connected(id) || !is_user_alive(id))
        {
            return;
        }

        
set_user_health(id250)


Give you 250 hp everytime you spawn

Worked perfectly, Thank you so much

SkumTomteN 01-26-2014 11:42

Re: code to block round hp.
 
Quote:

Originally Posted by DavidJr (Post 2073922)
PHP Code:

public plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)
        
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
}

public 
fw_PlayerSpawn_Post(id)
{
        if(!
is_user_connected(id) || !is_user_alive(id))
        {
            return;
        }

        
set_user_health(id250)


Give you 250 hp everytime you spawn

2 weeks have past i guess,

This gives zombies 250 hp too...

JusTGo 01-26-2014 12:31

Re: code to block round hp.
 
try this:
PHP Code:

public fw_PlayerSpawn_Post(id

        if(!
is_user_connected(id) || !is_user_alive(id)) 
        { 
            return; 
        } 
        if (!
zp_get_user_zombie(id))
        {
        
set_user_health(id250)
        }        



DavidJr 01-27-2014 02:24

Re: code to block round hp.
 
Can be simply like this:

PHP Code:

public fw_PlayerSpawn_Post(id)  
{  
        if(!
is_user_connected(id) || !is_user_alive(id) || zp_get_user_zombie(id))  
        {  
            return;  
        }  

        
set_user_health(id250



Kia 01-27-2014 02:48

Re: code to block round hp.
 
There is no need to check if the user is connected when you check if he is alive.

SkumTomteN 01-31-2014 20:51

Re: code to block round hp.
 
Well, thanks for the help, i will try it now, will update my reply if it works or not

EDIT : i think its working now, Thanks for the help.

SkumTomteN 01-31-2014 21:02

Re: code to block round hp.
 
Quote:

Originally Posted by Kia (Post 2091422)
There is no need to check if the user is connected when you check if he is alive.

Lol, kia?, do u have servers in cz?

Kia 02-01-2014 01:50

Re: code to block round hp.
 
Quote:

Originally Posted by SkumTomteN (Post 2093563)
Lol, kia?, do u have servers in cz?

Nein.


All times are GMT -4. The time now is 20:39.

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