Anti lag shoot
#1

Should this work as an anti lag shoot. Can't test since I'm not home
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        new Float:heath, Float:armour;
        GetPlayerArmour(damagedid, armour);
        GetPlayerHealth(damagedid, heath);
        if(armour > 0)
        {
            if(amount > armour) {
                SetPlayerArmour(damagedid, 0);
            }
            else SetPlayerArmour(damagedid, armour-amount);
        }
        else SetPlayerHealth(damagedid, heath-amount);
    }
    return 1;
}
Reply
#2

Theoretically yes..
Reply
#3

Anything I could add to improve it?
Reply
#4

Ain't gonna work properly at all how is OnPlayerDeath() to know who killed the player.
Reply
#5

with that script, if a player has 10 armour and takes 40 damage, he'll only suffer 10 damage since it'll only take off his armour

here's another example, two players shoot the same guy call them player A and player B, player X is the one getting shot

player X is on 100 health
player A deals 30 damage to player X
server gets his health and sends the message to lower his health to 70
player B deals 10 damage a split second later to player X
server gets his health, player X has not yet updated his new health, so server thinks he's still on 100 health
server sends message to player X to set the health to 90

what others see is player x getting shot multiple times and his health goes down to 70 and then jumps back up to 90

there are some scripts about anti lag already, you should check them out and have server side variables to track the health values
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)