[Ajuda] No-Lag
#1

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) != GetPlayerTeam(damagedid))
        {
        if(damagedid != INVALID_PLAYER_ID)
        {
                new Float:HEALTH;
                        new Float:ARMOR;
                        new Float:DAMAGE;
                GetPlayerArmour(damagedid, ARMOR);
                GetPlayerHealth(damagedid, HEALTH);
                if(ARMOR > 0)
                {
                if(amount > ARMOR)
                {
                                DAMAGE = amount - ARMOR;
                                HEALTH = HEALTH - DAMAGE;
                    SetPlayerArmour(damagedid, 0.0);
                                SetPlayerHealth(damagedid, HEALTH);
                                return 1;
                }
                            ARMOR = ARMOR - amount;
                            SetPlayerArmour(damagedid, ARMOR);
                    }
            if(ARMOR < 1)
                    {
                HEALTH = HEALTH - amount;
                        SetPlayerHealth(damagedid, HEALTH);
                    }
        }
    }
    return 1;
}
se atira no lag continua perdendo hp, e se atira na skin perde tambйm, queria que sу se atira-se na skin o player perdeste HP
Reply
#2

seta o team de todos os players para o mesmo e retire isso do script
pawn Код:
if(GetPlayerTeam(playerid) != GetPlayerTeam(damagedid))


@Edit:
vai ficar assim:
pawn Код:
//No OnPlayerConnect
SetPlayerTeam(playerid, 1); //ou entao qualquer outro numero, mas todos tem q ser o mesmo

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        new Float:HEALTH,
            Float:ARMOR,
            Float:DAMAGE;

        GetPlayerArmour(damagedid, ARMOR);
        GetPlayerHealth(damagedid, HEALTH);
        if(ARMOR > 0)
        {
            if(amount > ARMOR)
            {
                DAMAGE = amount - ARMOR;
                HEALTH = HEALTH - DAMAGE;
                SetPlayerArmour(damagedid, 0.0);
                SetPlayerHealth(damagedid, HEALTH);
                return 1;
            }
            ARMOR = ARMOR - amount;
            SetPlayerArmour(damagedid, ARMOR);
        }
        if(ARMOR < 1)
        {
            HEALTH = HEALTH - amount;
            SetPlayerHealth(damagedid, HEALTH);
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Los
Посмотреть сообщение
Dano sem Lag

- Sabe nas versхes anteriores do samp, vocк tinha que atirar na frente da pessoa para poder acerta-la (isso й o lag). Agora no 0.3d й possнvel sem precisar atirar na frente da pessoa:

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    new Float:Life, Float:Colete, Float:Dano;
    GetPlayerArmour(damagedid, Colete);
    GetPlayerHealth(damagedid, Life);
    if(Colete > 0)
    {
        if(amount > Colete)
        {
            Dano = amount - Colete;
            Life = Life - Dano;
            SetPlayerArmour(damagedid, 0.0);
            SetPlayerHealth(damagedid, Life);
            return 1;
        }
        Colete = Colete - amount;
        SetPlayerArmour(damagedid, Colete);
    }
    if(Colete < 1)
    {
        Life = Life - amount;
        SetPlayerHealth(damagedid, Life);
    }
    return 1;
}
Ou...


Quote:
Originally Posted by Stewie`
Посмотреть сообщение
Acho que й isso.

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{

        if(GetPlayerTarget(playerid) != damagedid)
        return 0; //Nгo vai passar para outros scripts, pois й invбlido (Cheat/Unsync)


    new Float:fSwap;
    GetPlayerArmour(damagedid, fSwap);

    fSwap -= amount;

    if(fSwap < 0.0)
    {
        SetPlayerArmour(playerid, 0.0);

        new Float:fHealth;
        GetPlayerHealth(playerid, fHealth);

        SetPlayerHealth(playerid, fSwap + fHealth);
        return 1;
    }

    SetPlayerArmour(playerid, fSwap);
        return 1;
}
Reply
#4

os 2 que foram postados nos cуdigos uteis eu jб tinha testado, esse que o Kmatsu postou tambйm nгo funcionou =/
Reply
#5

jб tinha postado isso em otro lugar, ve ae

https://sampforum.blast.hk/showthread.php?tid=415353
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)