Skip to content

Commit

Permalink
fix clear variables, delete hideknide
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor committed Jan 17, 2025
1 parent 76e6300 commit 362fc8b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 99 deletions.
85 changes: 0 additions & 85 deletions scripting/HnsMatchHideKnife.sma

This file was deleted.

7 changes: 6 additions & 1 deletion scripting/HnsMatchOwnage.sma
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public plugin_precache() {
}

public plugin_init() {
register_plugin("Match: Ownage", "1.0", "OpenHNS");
register_plugin("Match: Ownage", "1.0.1", "OpenHNS");

register_touch("player", "player", "touchPlayer");

Expand Down Expand Up @@ -180,6 +180,11 @@ public SQL_SetOwnage(id) {
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
}

public client_disconnected(id) {
g_iDataOwnage[id] = 0;
g_flLastHeadTouch[id] = 0.0;
}

stock ClearDHUDMessages(iClear = 8) {
for (new iDHUD = 0; iDHUD < iClear; iDHUD++)
show_dhudmessage(0, "");
Expand Down
12 changes: 11 additions & 1 deletion scripting/HnsMatchPlayerInfo.sma
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum _: SPEC_DATA {
new g_eSpecPlayers[MAX_PLAYERS + 1][SPEC_DATA];

public plugin_init() {
register_plugin("Match: Player info", "1.0", "OpenHNS");
register_plugin("Match: Player info", "1.0.1", "OpenHNS");

register_clcmd("say", "sayHandle");

Expand All @@ -83,6 +83,16 @@ public client_disconnected(id) {
arrayset(g_eSpecPlayers[id], 0, SPEC_DATA);
}

g_HudOnOff[id] = false;
g_HudRoundOnOff[id] = false;

g_bDmgThisRound[id] = false;
g_flHealthBefore[id] = 0.0;
g_flDmg[id] = 0.0;
g_flDmgTime[id] = 0.0;
g_flCmdNextUseTime[id] = 0.0;

arrayset(g_eRoundBests[id], 0, SHOW_STATS);
}

public rgPlayerSpawn(id) {
Expand Down
29 changes: 17 additions & 12 deletions scripting/HnsMatchStats.sma
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ new g_StatsRound[MAX_PLAYERS + 1][PLAYER_STATS];

new g_iGameStops;

new iLastAttacker[MAX_PLAYERS + 1];
new g_iLastAttacker[MAX_PLAYERS + 1];

new Float:last_position[MAX_PLAYERS+ 1][3];
new Float:g_flLastPosition[MAX_PLAYERS + 1][3];

new Trie:g_tSaveData;
new Trie:g_tSaveRoundData;

public plugin_init() {
register_plugin("Match: Stats", "1.1", "OpenHNS"); // Garey
register_plugin("Match: Stats", "1.1.1", "OpenHNS"); // Garey

RegisterHookChain(RG_CBasePlayer_Killed, "rgPlayerKilled", true);
RegisterHookChain(RG_CBasePlayer_TakeDamage, "rgPlayerTakeDamage", false);
Expand Down Expand Up @@ -200,6 +200,11 @@ public client_disconnected(id) {
}
TrieSetArray(g_tSaveData, getUserKey(id), iStats[id], PLAYER_STATS);
TrieSetArray(g_tSaveRoundData, getUserKey(id), g_StatsRound[id], PLAYER_STATS);

arrayset(iStats[id], 0, PLAYER_STATS);
arrayset(g_StatsRound[id], 0, PLAYER_STATS);
arrayset(g_flLastPosition[id], 0, sizeof(g_flLastPosition[]));
g_iLastAttacker[id] = 0;
}

public hns_match_reset_round() {
Expand Down Expand Up @@ -240,10 +245,10 @@ public rgPlayerKilled(victim, attacker) {
iStats[victim][PLR_STATS_DEATHS]++;
}

if (iLastAttacker[victim] && iLastAttacker[victim] != attacker) {
g_StatsRound[iLastAttacker[victim]][PLR_STATS_ASSISTS]++;
iStats[iLastAttacker[victim]][PLR_STATS_ASSISTS]++;
iLastAttacker[victim] = 0;
if (g_iLastAttacker[victim] && g_iLastAttacker[victim] != attacker) {
g_StatsRound[g_iLastAttacker[victim]][PLR_STATS_ASSISTS]++;
iStats[g_iLastAttacker[victim]][PLR_STATS_ASSISTS]++;
g_iLastAttacker[victim] = 0;
}
}

Expand All @@ -255,7 +260,7 @@ public rgPlayerTakeDamage(iVictim, iWeapon, iAttacker, Float:fDamage) { // Пр
if (is_user_alive(iAttacker) && iVictim != iAttacker) {
new Float:fHealth; get_entvar(iVictim, var_health, fHealth);
if (fDamage < fHealth) {
iLastAttacker[iVictim] = iAttacker;
g_iLastAttacker[iVictim] = iAttacker;
}

g_StatsRound[iAttacker][PLR_STATS_STABS]++;
Expand Down Expand Up @@ -308,7 +313,7 @@ public rgPlayerPreThink(id) {
if (hns_get_state() == STATE_ENABLED) {
if (is_user_alive(id)) {
if (rg_get_user_team(id) == TEAM_TERRORIST) {
if (vector_length(velocity) * frametime >= get_distance_f(origin, last_position[id])) {
if (vector_length(velocity) * frametime >= get_distance_f(origin, g_flLastPosition[id])) {
velocity[2] = 0.0;
if (vector_length(velocity) > 125.0) {
g_StatsRound[id][PLR_STATS_RUNNED] += vector_length(velocity) * frametime;
Expand All @@ -321,7 +326,7 @@ public rgPlayerPreThink(id) {
}

last_updated[id] = get_gametime();
xs_vec_copy(origin, last_position[id]);
xs_vec_copy(origin, g_flLastPosition[id]);
}

public rgRoundFreezeEnd() {
Expand Down Expand Up @@ -362,9 +367,9 @@ public rgRoundStart() {
for (new i = 0; i < iNum; i++) {
new id = iPlayers[i];
arrayset(g_StatsRound[id], 0, PLAYER_STATS);
arrayset(last_position[id], 0, 3);
arrayset(g_flLastPosition[id], 0, sizeof(g_flLastPosition[]));

iLastAttacker[id] = 0;
g_iLastAttacker[id] = 0;
}

for (new i; i < iNum; i++) {
Expand Down
8 changes: 8 additions & 0 deletions scripting/HnsMatchSystem.sma
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ public client_disconnected(id) {
ExecuteForward(g_ModFuncs[g_iCurrentMode][MODEFUNC_PLAYER_LEAVE], _, id);

arrayset(g_ePlayerPtsData[id], 0, PTS_DATA);

g_bNoplay[id] = false;
g_eSpecBack[id] = TEAM_UNASSIGNED;

arrayset(eAfkData[id], 0, AfkData_s);
arrayset(flAfkOrigin[id], 0.0, sizeof(flAfkOrigin[]));
g_bSurrenderVoted[id] = false;
hook[id] = false;
}

public Knife_PrimaryAttack(ent)
Expand Down

0 comments on commit 362fc8b

Please sign in to comment.