• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Death spam bug
#1
Hi guys, I am currently experiencing a death spam bug. I am unsure what exactly made it happen. It is rare to other players, but it happens often to those who are lagging. I previously never had this issue.

Quote:[27/05/2019 06:22:03] [connection] xxxxxxxx:21883 requests connection cookie.
[27/05/2019 06:22:05] [join] Deba has joined the server (7:xxxxxxxx)

[27/05/2019 06:22:19] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: -1036.349975, Z: 24.195400, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:20] [death] Deba died 255
[27/05/2019 06:22:20] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:20] [death] Deba died 255
[27/05/2019 06:22:21] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 0, World: 0, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:21] [death] Deba died 255
[27/05/2019 06:22:21] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:21] [death] Deba died 255
[27/05/2019 06:22:22] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:22] [death] Deba died 255
[27/05/2019 06:22:22] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:22:22] [death] Deba died 255
[27/05/2019 06:22:23] OnPlayerSpawn - Deba (7) | X: -567.648986, Y: 24.195400, Z: -1036.349975, Int: 3, World: 107, Business: -1, Entrance: -1, House: -1

[27/05/2019 06:23:19] OnPlayerDisconnect - Deba (7) | X: -294.178710, Y: 1005.997924, Z: 19.585987, Location: Fort Carson | Int: 0, World: 0 [Reason: 1]
[27/05/2019 06:23:19] [part] Deba has left the server (7:1)

This is my OnPlayerDeath. What seems to be the problem??

Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid == INVALID_PLAYER_ID) {
? ?return false; }
? ?
PlayerData[playerid][pSpawned] = 0;

new log[300], Float:pX, Float:pY, Float:pZ;
? ?new vid = GetPlayerVehicleID(playerid);

GetPlayerPos(playerid, pX, pY, pZ);

if (killerid != INVALID_PLAYER_ID)
{
? ?if (1 <= reason <= 46) {
? ? ? ?format(log, sizeof(log), "[%s] %s (%d) has killed %s (%s) [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(killerid), killerid, ReturnName(playerid), playerid, ReturnWeaponName(reason), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
else {
? format(log, sizeof(log), "[%s] %s has killed %s (reason %d) [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(killerid), ReturnName(playerid), reason, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}

if (reason == 51 && killerid != INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has been killed by explosion by %s. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), ReturnName(killerid), reason, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}
else
{
if (reason == 51)
{
if(killerid == INVALID_PLAYER_ID && IsPlayerInAnyVehicle(playerid) && vid != INVALID_VEHICLE_ID)
{
format(log, sizeof(log), "[%s] %s has been killed in a car explosion [vehicle id: %d]. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), vid, pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
else if(killerid == INVALID_PLAYER_ID && !IsPlayerInAnyVehicle(playerid) && vid == INVALID_VEHICLE_ID)
{
? ?format(log, sizeof(log), "[%s] %s has been killed in an explosion. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}

if (reason == 53 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has drowned in the water. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}

if (reason == 54 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has fell (Splat). [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}

if (reason == 255 && killerid == INVALID_PLAYER_ID) {
format(log, sizeof(log), "[%s] %s has suicided. [%f %f %f] [World: %d, Int: %d] [Location: %s].", ReturnDate(), ReturnName(playerid), pX, pY, pZ, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), GetPlayerLocation(playerid));
}
}

printf(log);

return true;
}
  Reply
#2
A temporary fix:









Code:
new player_spawned [MAX_PLAYERS];



public OnPlayerSpawn (playerid)

{

? ? if (player_spawned [playerid] == 1) return 0;

? ? player_spawned = 1;

? ? SetTimerEx ("ResetSpawnVar", 1000, false, "i", playerid);

? ??return 1;

}



forward ResetSpawnVar (playerid);

public ResetSpawnVar (playerid)

{

? ? player_spawned [playerid] = 0;

? ? return 1;

}
  Reply
#3
Uberanwar, long time no see.

The code inside of "OnPlayerDeath" is only called upon, as the name implies, a player death. None of the code you have inside that callback should be causing a loop. My suggestion to you is to assert no parts of your code are purposefully killing the player or calling the OnPlayerDeath callback.

Likewise, you should also be sure these players aren't trolls using illegitimate clients to fake deaths in order to mess with you, as this is a rather common thing for some to do.
  Reply
#4
Or health anti cheat sets health to 0.
That would make sense when we talk about lagging?players.
  Reply
#5
(2019-05-28, 10:26 AM)mouiz Wrote: A temporary fix:









Code:
new player_spawned [MAX_PLAYERS];



public OnPlayerSpawn (playerid)

{

? ? if (player_spawned [playerid] == 1) return 0;

? ? player_spawned = 1;

? ? SetTimerEx ("ResetSpawnVar", 1000, false, "i", playerid);

? ??return 1;

}



forward ResetSpawnVar (playerid);

public ResetSpawnVar (playerid)

{

? ? player_spawned [playerid] = 0;

? ? return 1;

}



Thanks, I'll try this temp fix.





(2019-05-28, 05:53 PM)Markski Wrote: Uberanwar, long time no see.



The code inside of "OnPlayerDeath" is only called upon, as the name implies, a player death. None of the code you have inside that callback should be causing a loop. My suggestion to you is to assert no parts of your code are purposefully killing the player or calling the OnPlayerDeath callback.



Likewise, you should also be sure these players aren't trolls using illegitimate clients to fake deaths in order to mess with you, as this is a rather common thing for some to do.



Hi! I am sure that I don't have anything inside the callback that causes loop. Regarding the fake deaths, yes I have a detection for that but in this case, it is not a fake death. OT: What's was your name on SA-MP forum?



(2019-05-30, 08:34 PM)Expert* Wrote: Or health anti cheat sets health to 0.

That would make sense when we talk about lagging?players.



Yes, I use weapon-config include and it has an health anti-cheat mechanism. Could be it!
  Reply


Forum Jump: