Page 1 of 1

1hp - nebeleidžia žudyti

Posted: 2013 Jun 12 19:56
by xFrostas
Taigi, kaip padaryti, jeigu į žaidėją tarkim šaudo, 1 gyvybei likus nebenusimtu hp, kitaip sakant būtų nemirtingas. Arba pvz jis nuo kurnors nušoka, tai neužsimuša, jei turi 20 hp tai jam lieka 1 hp.

Re: 1hp - nebeleidžia žudyti

Posted: 2013 Jun 12 22:36
by beast

Code: Select all

#include <amxmodx>#include <hamsandwich>#include <fun> #define PLUGIN "1hp immortal"#define VERSION "1.0"#define AUTHOR "beast" public plugin_init(){    register_plugin(PLUGIN, VERSION, AUTHOR)        RegisterHam(Ham_TakeDamage, "player", "FwdHamTakeDamagePre")} public FwdHamTakeDamagePre(victim, inflictor, attacker, Float:damage){    static hp        hp = get_user_health(victim)        if(hp == 1)        return HAM_SUPERCEDE        if(damage >= hp)    {        set_user_health(victim, 1)        return HAM_SUPERCEDE    }        return HAM_IGNORED} 

Re: 1hp - nebeleidžia žudyti

Posted: 2013 Jun 12 23:20
by xFrostas
Ačiū

O kam čia šitas?

Code: Select all

    if(hp == 1)        return HAM_SUPERCEDE    
Neužtenka?

Code: Select all

    if(damage >= hp)    {        set_user_health(victim, 1)        return HAM_SUPERCEDE    }

Re: 1hp - nebeleidžia žudyti

Posted: 2013 Jun 13 08:24
by newb
Kad nenustatinetu hp kai to nereikia.