Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSPlugin - Knife Deaths


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Hello,

I hope this message finds you well. I am currently working on a CS 1.6 AMXX plugin that tracks knife deaths and displays a message about the player with the most knife deaths every 24 hours. However, I am encountering an issue with the code, and I would appreciate your assistance.

Problem Description:
I have implemented a system to count knife deaths and display a message using ShowSyncHudMsg. However, I am facing the following error:

Error Message:
contador.sma(20) : error 035: argument type mismatch (argument 1)

Code:

#include <amxmodx>

new g_MostKnifeDeaths[33]
new g_PlayerWithMostDeaths
new HudSync

public plugin_init() {
register_plugin("Knife Deaths Plugin", "1.0", "Author")

register_event("HLTV", "event_player_death", "a", "1=0")
register_event("HLTV", "event_round_start", "a", "1=0")

HudSync = CreateHudSyncObj()

set_task(24.0 * 60.0 * 60.0, "ResetKnifeStats") // Schedule reset every 24 hours
set_task(1.0, "ShowMostKnifeDeaths") // Schedule check and display every 1 second
}

public event_player_death(victim, killer, weapon) {
if (equal(weapon, "knife")) {
g_MostKnifeDeaths[victim]++
if (g_MostKnifeDeaths[victim] > g_MostKnifeDeaths[g_PlayerWithMostDeaths]) {
g_PlayerWithMostDeaths = victim
}
}
return PLUGIN_CONTINUE
}

public event_round_start() {
return PLUGIN_HANDLED
}

public ShowMostKnifeDeaths() {
if (g_PlayerWithMostDeaths > 0) {
new mostDeaths = g_MostKnifeDeaths[g_PlayerWithMostDeaths]
new currentDeaths = g_MostKnifeDeaths[g_PlayerWithMostDeaths]

if (mostDeaths > 0 && currentDeaths > mostDeaths) {
set_hudmessage(255, 255, 255, -1.0, -0.8, 0, 6.0, 13.0)
ShowSyncHudMsg(0, HudSync, "Player %d died most times by knife %d times.", g_PlayerWithMostDeaths, currentDeaths)

// Schedule a task to remove the message after 13 seconds
set_task(13.0, "HideMostKnifeDeathsMessage")
}
}

return PLUGIN_HANDLED
}

public HideMostKnifeDeathsMessage() {
// Remove the message after the defined time
set_hudmessage(255, 255, 255, -1.0, -0.8, 0, 0.0, 0.0)
return PLUGIN_HANDLED
}

public ResetKnifeStats() {
g_PlayerWithMostDeaths = 0
new i
for (i = 1; i <= 32; i++) {
g_MostKnifeDeaths[i] = 0
}
}
Issues:

The message doesn't always display when it should.
The logic for counting knife deaths may not be functioning correctly.
I'm using HudSync, but there might be a mistake in its usage.
I would greatly appreciate it if you could review the provided code and offer any insights or suggestions to resolve these issues. Thank you for your time and assistance.

Best regards,
[HOFFMANN]

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...