AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   block logging of "suicide"? (https://forums.alliedmods.net/showthread.php?t=6499)

FeuerSturm 10-04-2004 17:19

block logging of "suicide"?
 
hey people,

as blocking of logmessages is possible now, i'd like to use
that to block "suicides" after someone got killed by a gun with less
than 100 damage. (gets damage and then "user_kill")

bailopan posted a help:
Code:
new blockLog = 0 public log_event_thing() {     blockLog = 1 } public plugin_log() {    if (blockLog)    {       blockLog = 0       return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE }

but i don't understand it :oops:

sorry for my ignorance, but is anyone here that can tell me how
to block a suiced log with it? :shock:

thanks for your help.

BAILOPAN 10-04-2004 17:36

the plugin_log stuff is a quick "switch". it will only block the log output if the switch is set to 1, then the switch turns off.

So catch the damage event, then either block the kill message or set the log block switch to 1.

Blocking thekill message is probably a better idea (set_msg_block).

FeuerSturm 10-04-2004 17:49

okey, i'm trying to understand, but i'm a bit slow on this one
for some reason i don't know.

that's what i have so far (just a snippet of the main function):
Code:
public client_damage(attacker,victim,damage,wpnindex,hitplace,TA){    if(get_cvar_num("amx_ubergarand") == 1){         if((wpnindex == DODW_GARAND) && (is_user_alive(victim) == 1)){                 garandDeathMsg = get_user_msgid("DeathMsg")                 set_msg_block(garandDeathMsg,BLOCK_ONCE)                 user_kill(victim)                 if(TA == 0){                        new aKills = dod_get_user_kills(attacker)                        dod_set_user_kills(attacker,aKills+1)                 }                 message_begin( MSG_ALL, get_user_msgid("DeathMsg"),{0,0,0},0)         write_byte(attacker)         write_byte(victim)         write_byte(wpnindex)         message_end()                 }    } }

so it would be:
Code:
new blockSuicide = 0 . . . public client_damage(attacker,victim,damage,wpnindex,hitplace,TA){    if(get_cvar_num("amx_ubergarand") == 1){         if((wpnindex == DODW_GARAND) && (is_user_alive(victim) == 1)){                 garandDeathMsg = get_user_msgid("DeathMsg")                 set_msg_block(garandDeathMsg,BLOCK_ONCE)                 blockSuicide = 1                 user_kill(victim)                 if(TA == 0){                        new aKills = dod_get_user_kills(attacker)                        dod_set_user_kills(attacker,aKills+1)                 }                 message_begin( MSG_ALL, get_user_msgid("DeathMsg"),{0,0,0},0)         write_byte(attacker)         write_byte(victim)         write_byte(wpnindex)         message_end()                 }    } } . . . public plugin_log() {    if (blockSuicide)    {       blockSuicide = 0       return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE }

or do i get that wrong?

by the way, thanks for your reply, bailopan :D

BAILOPAN 10-04-2004 17:50

You can try that, if it doesn't work, post ;]

FeuerSturm 10-04-2004 18:02

Quote:

Originally Posted by BAILOPAN
You can try that, if it doesn't work, post ;]

not working :cry: :cry:
PlayerXY commited suicide with "world" still appears in the logs
whenever that specific user_kill is used.

here's the whole thing:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #include <dodfun> #include <dodx> new garandDeathMsg new blockSuicide = 0 public plugin_init() {    register_plugin("DoD UberGarand","0.95alpha","[RST] FireStorm")    register_statsfwd(XMF_DAMAGE)    register_cvar("amx_ubergarand","0")    set_cvar_num("amx_ubergarand",0)    register_concmd("amx_setubergarand","admin_setubergarand",ADMIN_BAN,"<enable/disable UberGarand Mode>") } public plugin_modules() {    require_module("engine")    require_module("fun")    require_module("dodx")    require_module("dodfun") } public client_damage(attacker,victim,damage,wpnindex,hitplace,TA){    if(get_cvar_num("amx_ubergarand") == 1){         if((wpnindex == DODW_GARAND) && (is_user_alive(victim) == 1)){                 garandDeathMsg = get_user_msgid("DeathMsg")                 set_msg_block(garandDeathMsg,BLOCK_ONCE)                 blockSuicide = 1                 user_kill(victim)                 if(TA == 0){                        new aKills = dod_get_user_kills(attacker)                        dod_set_user_kills(attacker,aKills+1)                 }                 message_begin( MSG_ALL, get_user_msgid("DeathMsg"),{0,0,0},0)         write_byte(attacker)         write_byte(victim)         write_byte(wpnindex)         message_end()                 }    } } public plugin_log() {    if (blockSuicide)    {       blockSuicide = 0       return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE } public admin_setubergarand(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new ugm_s[2]     read_argv(1,ugm_s,2)     new ugm = str_to_num(ugm_s)     if(ugm == 1) {                if (get_cvar_num("amx_ubergarand") == 1){                      client_print(id,print_chat,"[AMXX] UberGarand Mode is already running.....")                      }                else if (get_cvar_num("amx_ubergarand") == 0){                     set_cvar_num("amx_ubergarand",1)                     }                }     else if(ugm == 0) {                if (get_cvar_num("amx_ubergarand") == 0){                      client_print(id,print_chat,"[AMXX] UberGarand Mode is already disabled.....")                      }                else if (get_cvar_num("amx_ubergarand") == 1){                     set_cvar_num("amx_ubergarand",0)                         }     }     return PLUGIN_HANDLED }

BAILOPAN 10-04-2004 19:06

You may need to block the death msg then... I dunno

FeuerSturm 10-04-2004 19:11

Quote:

Originally Posted by BAILOPAN
You may need to block the death msg then... I dunno

deathmessage is blocked and replaced with the proper one :wink:
but the plugin is useless if it logs the "kills" as "suicides" as every
stats program (HLStats, PsychoStats) will just catch it as suicides :(

so i'll throw the plugin into the freezer and warm it up again when there's
a ways to block the log :P

thanks for your help, bailopan. :D

BAILOPAN 10-04-2004 19:38

you can block logs all right, the problem is timing.

You don't know when the log actually gets appended.

FeuerSturm 10-04-2004 20:58

Quote:

Originally Posted by BAILOPAN
you can block logs all right, the problem is timing.

You don't know when the log actually gets appended.

wouldn't it be possible to just make it block the next specified log event once?

like you can do with the deathmessages.

that would be awsome :wink:

BAILOPAN 10-04-2004 21:48

yes but the problem is you don'tknow when that log will take place... if could take place like this:

1. Damage is dealt
2. Player is killed
3. Kill is logged
4. Damage message is sent
5. Death message is sent

See the problem?


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

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