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

RSSspawn event


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
hello, thanks for reading! ----I got this plugin made by OciXCrom (whom I thank so much) for variable movement speed, but I need to add some code to modify the custom set speed every single respawn (infinite round is sometimes used on the server). So far I've been using another plugin which automatically triggers the command every round, but I can't use it when I turn on respawn and infinite round.
I tried doing it myself but I don't really get how to stick to the respawn event... and how to set the variable

thank you in advance


Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>

#tryinclude <cromchat>

#if !defined _cromchat_included
    #error "cromchat.inc" is missing in your "scripting/include" folder. Download it from: "https://amxx-bg.info/inc/"
#endif

#tryinclude <targetex>

#if !defined _targetex_included
    #error "targetex.inc" is missing in your "scripting/include" folder. Download it from: "https://forums.alliedmods.net/showthread.php?t=331010"
#endif

#define MAX_NAME_LENGTH 32

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

const Float:SPEED_DEFAULT = -120.9

new Float:g_fSpeed[MAX_PLAYERS + 1] = { SPEED_DEFAULT, ... }

public plugin_init()
{
    register_plugin("Change Speed Command", "1.1", "OciXCrom")
    register_concmd("amx_speed", "Cmd_Speed", ADMIN_SLAY, "<player|group> <speed amount|reset>")
    RegisterHam(Ham_CS_Player_ResetMaxSpeed, "player", "OnResetMaxSpeed", 1)
}

public OnResetMaxSpeed(id)
{
    if(g_fSpeed[id] != SPEED_DEFAULT)
    {
        set_user_maxspeed(id, g_fSpeed[id])
    }
}

public client_putinserver(id)
{
    g_fSpeed[id] = SPEED_DEFAULT
}

public Cmd_Speed(id, iLevel, iCid)
{
    if(!cmd_access(id, iLevel, iCid, 3))
    {
        return PLUGIN_HANDLED
    }

    new szArg[MAX_NAME_LENGTH], szTarget[MAX_NAME_LENGTH]
    read_argv(1, szArg, charsmax(szArg))

    new iPlayers[MAX_PLAYERS], iPnum = cmd_targetex(id, szArg, iPlayers, szTarget, charsmax(szTarget), TARGETEX_OBEY_IMM_SINGLE)

    if(!iPnum)
    {
        return PLUGIN_HANDLED
    }

    new szName[MAX_NAME_LENGTH], szAmount[8]
    get_user_name(id, szName, charsmax(szName))
    read_argv(2, szAmount, charsmax(szAmount))

    if(equali(szAmount, "reset"))
    {
        for(new iPlayer, i; i < iPnum; i++)
        {
            iPlayer = iPlayers[i]

            g_fSpeed[iPlayer] = SPEED_DEFAULT
            ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, iPlayer)
        }

        CC_LogMessage(0, _, "ADMIN &x03%s &x01reset speed for &x03%s", szName, szTarget)
    }
    else
    {
        for(new iPlayer, i; i < iPnum; i++)
        {
            iPlayer = iPlayers[i]

            g_fSpeed[iPlayer] = str_to_float(szAmount)
            OnResetMaxSpeed(iPlayer)
        }
       
        CC_LogMessage(0, _, "ADMIN &x03%s &x01set &x04%s speed &x01on &x03%s", szName, szAmount, szTarget)
    }

    return PLUGIN_HANDLED
}

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ę...