Page 1 of 1

Neveikia žalos padidinimas

Posted: 2012 Aug 08 18:03
by xFrostas
Kodėl neveikia žalos didinimas? Pats kodas suveikia, nes parašo tekstą. Ir dar kai jis suveikia nebeišsijungia, kaskart rašo tekstą.

Code: Select all

#define IsPlayer(%1) (1 <= %1 <= MaxPlayers)#define Chance(%1) (%1 > random(100)) #define TaskID_Injury 2222 new const Float: Injury_PerLevel[] = { 5.0, 10.0, 20.0 } new Injury_Level[33] new Injury public Ham_PlayerDamage(victim, inflictor, attacker, Float: damage, damage_type) {    if (!IsPlayer(attacker))            return HAM_IGNORED     if (attacker && damage && (attacker != victim))    {        if (Injury_Level[attacker] > 0)        {            if (!GetBit(Injury, attacker) && Chance(30))            {                SetBit(Injury, attacker)                set_task(1.0, "Injury_Remove", attacker)            }            if (GetBit(Injury, attacker))            {                                                   client_print(attacker, 3, "[!] Injury")                SetHamParamFloat(4, damage * Injury_PerLevel[Injury_Level[attacker]])                 return HAM_OVERRIDE            }        }    }    return HAM_HANDLED} public Injury_Remove(id){    id -= TaskID_Injury    remove_task(id + TaskID_Injury)     ResetBit(Injury, id)}

Re: Neveikia žalos padidinimas

Posted: 2012 Aug 08 20:21
by hleV
Tu padarai

Code: Select all

SetBit(Injury, attacker)
ir po to iškart tikrini

Code: Select all

if (GetBit(Injury, attacker))

Re: Neveikia žalos padidinimas

Posted: 2012 Aug 09 12:23
by xFrostas

Code: Select all

    if (!GetBit(Injury, attacker) && Chance(30))            {                 client_print(attacker, 3, "[!] Injury")                SetHamParamFloat(4, damage * Injury_PerLevel[Injury_Level[attacker]])                 set_task(1.0, "Injury_Remove", attacker)            }            /*if (GetBit(Injury, attacker))            {                client_print(attacker, 3, "[!] Injury")                SetHamParamFloat(4, damage * Injury_PerLevel[Injury_Level[attacker]])                 return HAM_OVERRIDE*/            }
Tai taip kažkaip?