Disabling some weapon damages?
#1

Hey guys, I did a system that calculate players armour and health with OnPlayerGiveDamage, and it's working, so we are talking about skin shooting system.

But the lag shooting, it still works, for example, if I shoot someone who is not moving, the damaged player gets a double damage, because he got both of the systems, lag and skin.

I was reading some topics, and i managed to disable that lag damage with SetPlayerTeam, but now Hydra, Hunter, helicopter blades, grenades and others explosive weapons, just don't deal any damage, 'cause them don't call OnPlayerGiveDamage.

So i've discarded SetPlayerTeam.

And here's finally my question: There is any way to disable OnPlayerTakeDamage with normal weapons?

I did a array like this: (I'm calling EnableDamages at OnGameModeInit)

pawn Код:
new bool:EnableDamage[50];

stock EnableDamages()
{
    EnableDamage[51] = true; // Explosion
    EnableDamage[54] = true; // Splat
    EnableDamage[50] = true; //  Heli blades
}
Then OnPlayerTakeDamage I did this:

pawn Код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid)
{
    if(EnableDamage[weaponid] == false)
        amount = 0;
    return 1;
}
And it still dealing lag damage.

I really hope you guys can help me

Thanks for now.
Reply
#2

Quote:
Originally Posted by arakuta
Посмотреть сообщение
And here's finally my question: There is any way to disable OnPlayerTakeDamage with normal weapons?
Not sure if i fully understand you, but can't you just check if the weapon is a "normal" weapon and return if so?

pawn Код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid)
{
    if( is_normal_weapon_check( weaponid ) )
        return 1;

    if(EnableDamage[weaponid] == false)
        amount = 0;
    return 1;
}
Reply
#3

Will setting the amount to 0 work properly? As far as I know that just tells you the amount of damage a player has taken, try adding;
Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid,hp+amount);
Reply
#4

When you're in OnPlayerTakeDamage life packets have not yet arrived to the server.

So you can get player health and armour and restore it.

Код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid)
{
    if(EnableDamage[weaponid] == false)
    {
        new Float:h, Float:a;
        GetPlayerHealth (playerid, h);
        GetPlayerArmour (playerid, a);

        SetPlayerHealth (playerid, h);
        SetPlayerArmour (playerid, a);

        return 1; // stop it, he dont have the hit really
    }
    return 1;
}
Reply
#5

Not sure if this is what you're asking for, but try the following:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(weaponid == [ID of weapon you want no damage on]) SetPlayerHealth(playerid, HP);
    return 1;
}
This will do no damage with a specific weapon ID, you can add more weapon IDs with the same format.
Hope this is what you're asking for.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)