AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to check if a player killed himself? (https://forums.alliedmods.net/showthread.php?t=189803)

SyluxLockjaw100 07-11-2012 05:37

How to check if a player killed himself?
 
Or check if a player is killed by the "worldspawn" entity?

hornet 07-11-2012 05:49

Re: How to check if a player killed himself?
 
Killer ID will be either 0 or equal to victim ID.

tuty 07-11-2012 11:28

Re: How to check if a player killed himself?
 
check my admin explode plugin, there will detect if player was killed by worldspawn and other entities:fox:

Santaaa 07-11-2012 11:47

Re: How to check if a player killed himself?
 
PHP Code:

new killer read_data(1)
new 
victim read_data(2)

if (
killer == victim)
{
// action


This is an example used for the DeathMsg event.

yokomo 07-11-2012 13:19

Re: How to check if a player killed himself?
 
Taken from my killstreak plugin, it should work tho
PHP Code:

#include <amxmodx>

#define PLUGIN "Hook WorldSpawn Kills"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

new g_msgHudSync

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""OnWsKilled""a""4&wor")
    
    
g_msgHudSync CreateHudSyncObj()
}

public 
OnWsKilled()
{
    new 
vname[32]
    
get_user_name(read_data(2), vnamecharsmax(vname))
    
set_hudmessage(0100255, -1.00.2706.05.0)
    
ShowSyncHudMsg(0g_msgHudSync"Oh God %s killed by world spawn."vname)


Please not it will hook the death by custom entity too for example lasermine. I don't know why it become like that :) maybe it detect all "skull" icon in death message, erkkk whatever.

SyluxLockjaw100 07-12-2012 02:36

Re: How to check if a player killed himself?
 
Thanks alot guys :)


All times are GMT -4. The time now is 15:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.