Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Improve logging #32

Open
wants to merge 1 commit into
base: v2.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripting/include/ttt_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ enum _:BOMB_STATUS
BS_PLANTED,
BS_DEFUSED,
BS_FAILED,
BS_BOMBED
BS_BOMBED,
BS_TIMED
}

enum _:PLAYER_LOYALTY
Expand Down
13 changes: 8 additions & 5 deletions scripting/ttt_dead_body.sma
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ public used_use(id, ent)
return;

new identified = ttt_get_playerdata(bodyowner, PD_IDENTIFIED);
if(ttt_get_playerstate(id) == PC_DETECTIVE || identified || g_iRoundSpecial[PC_DETECTIVE] == 0 || get_pcvar_num(cvar_allow_scan_anytime))
if(identified || g_iRoundSpecial[PC_DETECTIVE] == 0 || get_pcvar_num(cvar_allow_scan_anytime) || ttt_get_playerstate(id) == PC_DETECTIVE)
{
static playername[32], deadname[32];
get_user_name(id, playername, charsmax(playername));
get_user_name(bodyowner, deadname, charsmax(deadname));
ttt_log_to_file(LOG_MISC, "%s (id: %d) started to inspect deadbody of %s (id: %d)", playername, id, deadname, bodyowner);

if(!identified)
{
new scanned = get_pcvar_num(cvar_credits_scanned);
Expand All @@ -218,8 +223,6 @@ public used_use(id, ent)
{
new bonus_dead = get_pcvar_num(cvar_credits_det_bonusdead), bonus_trakill = get_pcvar_num(cvar_credits_det_trakill), credits;
new killer = ttt_get_playerdata(bodyowner, PD_KILLEDBY);
static name[32];
get_user_name(bodyowner, name, charsmax(name));

new num, i;
static players[32];
Expand All @@ -231,12 +234,12 @@ public used_use(id, ent)
{
credits = ttt_get_playerdata(i, PD_CREDITS);
ttt_set_playerdata(i, PD_CREDITS, credits + bonus_dead);
client_print_color(i, print_team_default, "%s %L", TTT_TAG, i, "TTT_AWARD3", bonus_dead, i, special_names[PC_TRAITOR], name);
client_print_color(i, print_team_default, "%s %L", TTT_TAG, i, "TTT_AWARD3", bonus_dead, i, special_names[PC_TRAITOR], deadname);

if(killer == i)
{
ttt_set_playerdata(i, PD_CREDITS, credits + bonus_dead + bonus_trakill);
client_print_color(i, print_team_default, "%s %L", TTT_TAG, i, "TTT_AWARD2", bonus_trakill, i, special_names[PC_TRAITOR], name);
client_print_color(i, print_team_default, "%s %L", TTT_TAG, i, "TTT_AWARD2", bonus_trakill, i, special_names[PC_TRAITOR], deadname);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripting/ttt_item_c4.sma
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,11 @@ public C4Timer(id)
new time_min = get_pcvar_num(cvar_c4_mintime), time_max = get_pcvar_num(cvar_c4_maxtime);
if(is_str_num(number))
{
new time_cur = str_to_num(number);
new time_cur = str_to_num(number), ret;
if(time_min <= time_cur <= time_max)
{
g_iC4Time[id] = time_cur;
ExecuteForward(g_pBombStatusForward, ret, id, BS_TIMED, time_cur);
client_print_color(id, print_team_default, "%s %L", TTT_TAG, id, "TTT_C42", time_cur);
}
else client_print_color(id, print_team_default, "%s %L", TTT_TAG, id, "TTT_C41", time_min, time_max);
Expand Down
4 changes: 4 additions & 0 deletions scripting/ttt_items_base.sma
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ public _item_setup_add(plugin, params)
data[SETUP_ITEMACTIVE] = get_param(6);
get_string(7, data[SETUP_ITEMNAME], charsmax(data[SETUP_ITEMNAME]));

static name[32];
get_user_name(data[SETUP_ITEMOWNER], name, charsmax(name));
ttt_log_to_file(LOG_ITEM, "Item %s (id: %d) has been setup (ent: %d) by %s (id: %d)", data[SETUP_ITEMNAME], data[SETUP_ITEMID], data[SETUP_ITEMENT], name, data[SETUP_ITEMOWNER]);

ArrayPushArray(g_aSetup, data);
g_iSetupItems = ArraySize(g_aSetup);

Expand Down
9 changes: 7 additions & 2 deletions scripting/ttt_logging.sma
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ public ttt_bomb_status(id, status, ent)
"planted",
"defused",
"failed to defuse",
"exploded"
"exploded",
"changed time of"
};

static name[32];
get_user_name(id, name, charsmax(name));
_ttt_log_to_file(LOG_ITEM, "%s %s the C4", name, c4_status[status]);
if(status == BS_TIMED) {
_ttt_log_to_file(LOG_ITEM, "%s %s the C4 to: %d", name, c4_status[status], ent);
} else {
_ttt_log_to_file(LOG_ITEM, "%s %s the C4, ent: %d", name, c4_status[status], ent);
}
}

public Ham_TakeDamage_post(victim, inflictor, attacker, Float:damage, bits)
Expand Down
2 changes: 1 addition & 1 deletion scripting/ttt_show_infos.sma
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public show_motd_info(id, target)
show_motd(id, msg, motdname);

get_user_name(id, name[1], charsmax(name[]));
ttt_log_to_file(LOG_MISC, "%s inspected deadbody of %s", name[1], name[0]);
ttt_log_to_file(LOG_MISC, "%s (id: %d) inspected deadbody of %s (id: %d)", name[1], id, name[0], target);
}

public show_last_states(id)
Expand Down