OnPlayerTakeDamage.
#1

Hi,

This call back: OnPlayerTakeDamage will be called, when player have not lose HP, or when it lose HP?

For Ex:

Player have 100 HP and 50 armour.

I shot to him. He lose 50armour.

If i getplayeramour in onplayertakedamage, i will get 0 or 50?
Reply
#2

50..
Reply
#3

I want to make anti cheat's, from ******s who use invuniable (INV)

Sorry for my bad english, i try to do like that, but it's best way, and it will work properly?

Код:
if( ESCMODE[ playerid ] == false )
	    {
		    GetPlayerHealth( playerid, HealthTake[ playerid ] );
		    GetArmourHealth( playerid, ArmourTake[ playerid ] );

			new hitpoints = HealthTake[ playerid ] + ArmourTake[ playerid ];

			if( LastHit[ playerid ] != 0 )
			{
				if( LastHit[ playerid ] < hitpoints )
				{
				    Kick( playerid );
				}
			}
			LastHit[ playerid ] = hitpoints - amount;
		}

LastHit[ playerid ] - when player connect, or disconnect i set this value to 0.
ESCMODE[ playerid ] - I use onplayerupdate, for check this, and in 1 sec. timer i check if call back OnPlayerUpdate is not called, i think you understand about it.
HealthTake,Armourtake, i create new new Float:Healthtake and armour in top of gamemode.
Reply
#4

i think this should be

if( LastHit[ playerid ] < hitpoints )

to

if( LastHit[ playerid ] > hitpoints )

not?
Reply
#5

if you mean this
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        if(weaponid == 7)
                        SetPlayerHealth(playerid,health-12);
        if(weaponid == 8)
                        SetPlayerHealth(playerid,health-90);
        if(weaponid == 4)
                        SetPlayerHealth(playerid,health-78);
        if(weaponid == 3)
                        SetPlayerHealth(playerid,health-11);
        if(weaponid == 5)
                        SetPlayerHealth(playerid,health-11);
        if(weaponid == 23)
                        SetPlayerHealth(playerid,health-53);
        if(weaponid == 24)
                        SetPlayerHealth(playerid,health-90);
        if(weaponid == 22)
                        SetPlayerHealth(playerid,health-39);
        if(weaponid == 25)
                        SetPlayerHealth(playerid,health-65);
        if(weaponid == 26)
                        SetPlayerHealth(playerid,health-48);
        if(weaponid == 27)
                        SetPlayerHealth(playerid,health-32);
        if(weaponid == 28)
                        SetPlayerHealth(playerid,health-28);
        if(weaponid == 29)
                        SetPlayerHealth(playerid,health-31);
        if(weaponid == 30)
                        SetPlayerHealth(playerid,health-41);
        if(weaponid == 31)
                        SetPlayerHealth(playerid,health-41);
        if(weaponid == 32)
                        SetPlayerHealth(playerid,health-27);
        if(weaponid == 33)
                        SetPlayerHealth(playerid,health-97);
        if(weaponid == 34)
                        SetPlayerHealth(playerid,health-213);
        if(weaponid == 33)
                        SetPlayerHealth(playerid,health-97);
        if(weaponid == 33)
                       SetPlayerHealth(playerid,health-97);
    }
    return 1;
}
Reply
#6

lol he really dont mean this
Reply
#7

Quote:
Originally Posted by dEcooR
Посмотреть сообщение
i think this should be

if( LastHit[ playerid ] < hitpoints )

to

if( LastHit[ playerid ] > hitpoints )

not?
No. Because hitpoints is your health with armour, lasthit your health with armour in variable. And if you have game health + armour more than variable is (like money check) then player is hack'er. I think here is all well, but i need person, who can more optimisation this script, or maybe what i can add more..



Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
if you mean this
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        if(weaponid == 7)
                        SetPlayerHealth(playerid,health-12);
        if(weaponid == 8)
                        SetPlayerHealth(playerid,health-90);
        if(weaponid == 4)
                        SetPlayerHealth(playerid,health-78);
        if(weaponid == 3)
                        SetPlayerHealth(playerid,health-11);
        if(weaponid == 5)
                        SetPlayerHealth(playerid,health-11);
        if(weaponid == 23)
                        SetPlayerHealth(playerid,health-53);
        if(weaponid == 24)
                        SetPlayerHealth(playerid,health-90);
        if(weaponid == 22)
                        SetPlayerHealth(playerid,health-39);
        if(weaponid == 25)
                        SetPlayerHealth(playerid,health-65);
        if(weaponid == 26)
                        SetPlayerHealth(playerid,health-48);
        if(weaponid == 27)
                        SetPlayerHealth(playerid,health-32);
        if(weaponid == 28)
                        SetPlayerHealth(playerid,health-28);
        if(weaponid == 29)
                        SetPlayerHealth(playerid,health-31);
        if(weaponid == 30)
                        SetPlayerHealth(playerid,health-41);
        if(weaponid == 31)
                        SetPlayerHealth(playerid,health-41);
        if(weaponid == 32)
                        SetPlayerHealth(playerid,health-27);
        if(weaponid == 33)
                        SetPlayerHealth(playerid,health-97);
        if(weaponid == 34)
                        SetPlayerHealth(playerid,health-213);
        if(weaponid == 33)
                        SetPlayerHealth(playerid,health-97);
        if(weaponid == 33)
                       SetPlayerHealth(playerid,health-97);
    }
    return 1;
}
You joke? where am asking about it? first of all learn to read.. Don't write shit.
Reply
#8

wait i will post one system.
Reply
#9

Ok, then give link.
Reply
#10

so sry.. hmm i rly dont know i got same problem with this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)