[Solved]onPlayerKill event not getting called.

Started by DizzasTeR, Feb 10, 2015, 04:00 PM

Previous topic - Next topic

DizzasTeR

Well facing this problem from time now but ignored it since i didn't reach it according to my progress of project but since now I am at a point where i need to use it.

So the problem is i have added this event and it doesn't get called when a player kills another player, No Errors, nothing everything is perfect just its not getting called, i also added a print on the top of this event so that it prints a message suddenly it is called leading me to know that if it is even being called or not but no response from this event.

The team is free for all so the point of same team gets cracked here, so any idea why its not getting called?

.

What's the signature of your function? What function do you use? There's three of them:

/**
 * Called when the player has no killer.
 * Which means it's most likely suicide/explosion etc.
 *
 * player_instance (instance) - The class instance of the player who died.
 * death_reason (integer) - What actually killed him. drowned/car crash/fell etc.
*/

function onPlayerDeath(player_instance, death_reason)
{
// Doesn't expect any returned value
}

/**
 * Called when the player has an actual killer.
 * Which means it's a client that is connected to the server.
 *
 * killer_instance (instance) - The class instance of the player killed the victim instance.
 * player_instance (instance) - The class instance of the player who was killed.
 * death_reason (integer) - What actually killed him. Most likely the weapon ID.
 * body_part (integer) - The last body part that the projectile hit when he died.
*/
function onPlayerKill(killer_instance, player_instance, death_reason, body_part)
{
// Doesn't expect any returned value
}

/**
 * Called when the player has an actual killer but it's a team mate.
 * Which means it's also a client that is connected to the server.
 *
 * killer_instance (instance) - The class instance of the player killed the victim instance.
 * player_instance (instance) - The class instance of the player who was killed.
 * death_reason (integer) - What actually killed him. Most likely the weapon ID.
 * body_part (integer) - The last body part that the projectile hit when he died.
*/
function onPlayerTeamKill(killer_instance, player_instance, death_reason, body_part)
{
// Doesn't expect any returned value
}
.

DizzasTeR

OnPlayerDeath works, but other two doesn't seem to get called.

P.S @SLC, why are you not responding on Skype.

Sk

free skin is team 255 so when ever the killer and player are in same colour onplayerteamkill is called
few days back i converted my 0.3 script to 0.4 and i thought the same that this function is not called but after few experiments i found out that onplayerteamkill is called i fixed this problem by manually calling onplayerkill function when the team is 255
function onPlayerTeamKill(player,killer,reason,bodypart)
{
if ( player.Team == 255 ) onPlayerKill(player,killer,reason,bodypart);
// calling it manually.
}
sorry if the syntax is not correct i am on mobile :c.
hope this helps.

.

Quote from: Doom_Killer on Feb 10, 2015, 05:17 PMP.S @SLC, why are you not responding on Skype.

Off: Coz I haven't opened it since last time :P I'll verify it later.

On: Is the player actually killed by another player or dies by car crash fall etc. ?
.

Gudio


DizzasTeR