SA-MP Forums Archive
Bug OnPlayerTakeDamage and Lag? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bug OnPlayerTakeDamage and Lag? (/showthread.php?tid=507234)



Bug OnPlayerTakeDamage and Lag? - Kyra - 16.04.2014

Hi, i have a problem on my callback OnPlayerTakeDamage my player report me to see sometimes 0 damage on textdraw (it's showed when the player hit other player).

I use a log for check if it's an bug and i see this message:

Quote:

UJia dmg check WP:54 PHit:Kowayt DMG:0.00 Body:3.
Slayer dmg check WP:0 PHit:Warteka. DMG:0.00 Body:5

there are not just them report on my log, i don't understand how i can have this bug.

2)

I don't understand when my player are together on an interior example i have an important lag, i try to remove plugin and other but it's not a problem of object, i don't use labelplayer and other. What can be cause this bug?


Re : Bug OnPlayerTakeDamage and Lag? - S4t3K - 16.04.2014

1)

Do you use correctly the callback ?

Means do you use floatsub() to take life from the damaged player ?
You can't substract floats with a simple -.

2)

The only case to solve the problem is to buy a more powerful server.


Re: Bug OnPlayerTakeDamage and Lag? - Konstantinos - 16.04.2014

OnPlayerTakeDamage was called even if the damage was 0 in 0.3x (probably in 0.3e as well). I guess the damage is too low such as 0.1 for example and because of the problem with the floats, it might goes 0.09 which is basically 0.

You can avoid it by checking the value of the damage:
pawn Код:
if (amount) // not 0.0
{
    // code..
}
I'm not aware of your second problem though.


Re: Re : Bug OnPlayerTakeDamage and Lag? - Vince - 16.04.2014

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
1)
Means do you use floatsub() to take life from the damaged player ?
You can't substract floats with a simple -.
Unless you meddled in float.inc and deleted some stuff, using the standard operators works perfectly fine. The operators are overloaded to call their respective functions.


Re: Bug OnPlayerTakeDamage and Lag? - Kyra - 17.04.2014

No i don't use a function for this log i return the values of the callback OnPlayerTakeDamage, it's strange why ID 54 is called with not INVALID_ID issuerid with 0 damage.

You think the problem it's my server for my 2nd problem?