OnPlayerShootPlayer bugs
#1

Hello,

My anticheat keeps banning people who have been tased...

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    if(Player[Shooter][HasTaser] == 1)
    {
        if(GetPlayerWeapon(Shooter) == 23)
        {
            Player[Target][Tased] = 1;
            new Float: PHealth;
            GetPlayerHealth(Target, PHealth);
            Player[Target][Health] = PHealth+HealthLost;
            SetPlayerHealth(Target, PHealth+HealthLost);
            TogglePlayerControllable(Target, false);
            ApplyAnimation(Target, "CRACK", "crckidle4", 4.0, 1, 0, 0, 0, 0);
            SetTimerEx("TaserClear",7000,false,"d",Target);
        }
    }
    return 1;
}
pawn Код:
public AntiCheat()
{
    foreach(Player, i)
    {
        if(Authenticated[i] == 1)
        {
            if(Player[i][AntiCheatExemption] == 0)
            {
                new PMoney = GetPlayerMoney(i);
                new Float: PArmour; GetPlayerArmour(i, PArmour);
                new Float: PHealth; GetPlayerHealth(i, PHealth);
                if(PMoney > Player[i][Money]){ServerBan(i, "Money Hack");}
                if(Player[i][Tased] == 0)
                {
                    if(PArmour > Player[i][Armour]){ServerBan(i, "Armour Hack");}
                    if(PHealth > Player[i][Health]){ServerBan(i, "Health Hack");}
                }
At the "TaserClear" Public, it sets the Tased to 0
Reply
#2

Stop using outdated includes when native callbacks like https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage exist
Reply
#3

How could I make that Taser system work then?
Reply
#4

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(playerid != INVALID_PLAYER_ID)
    {
        if(Player[issuerid][HasTaser] == 1)
        {
            if(GetPlayerWeapon(issuerid) == 23)
            {
                Player[playerid][Tased] = 1;
                Player[playerid][Health] += amount;
                SetPlayerHealth(playerid, Player[playerid][Health]+amount);
                TogglePlayerControllable(playerid, false);
                ApplyAnimation(playerid, "CRACK", "crckidle4", 4.0, 1, 0, 0, 0, 0);
                SetTimerEx("TaserClear",7000,false,"d",playerid);
            }
        }
    }
    return 1;
}
Like that?
Reply
#5

^
Reply
#6

I tried this one, but it gives the player IG 118 Health and the status keeps the same..
Reply
#7

What do you mean with "The status keeps the same.." ?
Reply
#8

well I have a "Health" Status in the player data, so when a player uses hacks to restore their health it does not update their status, so the anticheat sees it as a hack.
Reply
#9

Bump
Reply
#10

stop bumping you bumped like 5 times in this tread looks like your begging for a ban.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)