AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]Killed self with player? (https://forums.alliedmods.net/showthread.php?t=110227)

powwoww 11-27-2009 02:25

[SOLVED]Killed self with player?
 
I got the problem last week:
The normal killing events show as suicide sometimes(its not always happening)
The client console will print: XXX killed self with player (with suicide hud icon)
Server Log: XXX committed suicide with "player" (world)

Did anyone see this before, plz help ,thanks.:cry:
Debug code below, no special weapons( knife,m4a1.etc...)

#include <amxmodx>
#include <hamsandwich>
new logfilename[64]
public plugin_init(){
register_plugin("[DEBUG] Kill Event", "0.1", "Flea")

register_event("DeathMsg", "evDeath", "a")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", 1)
get_time("kills%m%d.txt", logfilename, 63)
}
public fw_PlayerKilled(victim, attacker, shouldgib){
new name[32],name1[32]
if(is_user_alive(attacker)) get_user_name(attacker,name,31)
else name="-Suicide-"
get_user_name(victim,name1,31)
log_to_file(logfilename, "[Pre]%s Kill %s", name,name1)
}
public fw_PlayerKilled_Post(victim, attacker, shouldgib){
new name[32],name1[32]
if(is_user_alive(attacker)) get_user_name(attacker,name,31)
else name="-Suicide-"
get_user_name(victim,name1,31)
log_to_file(logfilename, "[post]%s Killed %s", name,name1)
}
public evDeath(){//击杀事件
new kr = read_data(1),vm = read_data(2),name[32],name1[32]
get_user_name(vm,name1,31)
if(!is_user_alive(kr)) log_to_file(logfilename, "[Ev]%s Suicide %d!!!!!!!", name1,kr)
else{
get_user_name(kr,name,31)
log_to_file(logfilename, "[Ev]%s Kill %s", name,name1)
}
}

LOGFILE:
L 11/28/2009 - 12:38:23: [Pre]wtl Kill Candy*Stars>l.w<W.w //Normal
L 11/28/2009 - 12:38:23: [Ev]Candy*Stars>l.w<W.w Suicide 0!!!!!!! //WTF ?
L 11/28/2009 - 12:38:23: [post]wtl Killed Candy*Stars>l.w<W.w //Normal

Now I've got it myself:
set_pev(id,pev_flags,FL_DUCKING,1)
This code forces a player to duck to prevent from being blocked, but the problem is that after using this, when this player kills someone, it will cause the bug.

Arkshine 11-27-2009 02:43

Re: Killed self with player?
 
Not sure to understand your problem. Maybe you have "special" weapons installed on your server.

byetovice 11-27-2009 03:03

Re: Killed self with player?
 
PHP Code:

user_slientkill(targetplayer)
make_deathmsg(id,targetplayer,0,"weaponname"


powwoww 11-27-2009 23:49

Re: Killed self with player?
 
I'm still confused about the event and ham..

Arkshine 11-28-2009 15:12

Re: Killed self with player?
 
Your code is weird. I'm not sure to understand what you are trying to do.

Hunter-Digital 11-28-2009 16:15

Re: Killed self with player?
 
He's getting suicide with "player" console messages and he tried to debug the info...

It's your server, are you sure no other plugins or metamod addons can affect this ? remove them all and try again just to be sure... it can be a plugin hooking deathmsg and modifying it so that the killer is himself and weapon is "player" :-?? ... oooor a plugin that allows players to kill with alternate modes... like a player kills another player by dropping in his head, or something... I dunno what you have there.

I tried the debug code (altered a bit) and works just fine:
Code:

// killing a bot:
[Pre]Digi Kill [POD]Pissed Off (97)
[Ev]Digi Kill [POD]Pissed Off (97)
[post]Digi Killed [POD]Pissed Off (97)
// then a kill command:
[Pre](suicide) Kill Digi
[Ev](suicide) Kill Digi
[post](suicide) Killed Digi

PHP Code:

#include <amxmodx>
#include <hamsandwich>
 
public plugin_init()
{
    
register_plugin("[DEBUG] Kill Event""0.1""Flea")
 
    
register_event("DeathMsg""evDeath""a")
 
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"1)
}
 
public 
fw_PlayerKilled(victimattackershouldgib)
{
    new 
name[32],name1[32]
 
    
get_user_name(victim,name1,31)
 
    if(
is_user_alive(attacker))
        
get_user_name(attacker,name,31)
    else
        
copy(name31"(suicide)")
 
    
server_print("[Pre]%s Kill %s"name,name1)
}
 
public 
fw_PlayerKilled_Post(victimattackershouldgib)
{
    new 
name[32],name1[32]
 
    
get_user_name(victim,name1,31)
 
    if(
is_user_alive(attacker))
        
get_user_name(attacker,name,31)
    else
        
copy(name31"(suicide)")
 
    
server_print("[post]%s Killed %s"name,name1)
}
 
public 
evDeath()
{
    new 
kr read_data(1),vm read_data(2),name[32],name1[32]
 
    
get_user_name(vm,name1,31)
 
    if(
is_user_alive(kr))
        
get_user_name(kr,name,31)
    else
        
copy(name31"(suicide)")
 
    
server_print("[Ev]%s Kill %s"name,name1)




All times are GMT -4. The time now is 13:43.

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