Jump to content


Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Posted Image Posted Image

Guest Message by DevFuse
 

[ROZWIĄZANE] Messagemode w SM

cs:go

Best Answer MAGNET, 07.09.2018 23:00

Nie ma messagemode. Musisz po prostu łapać say i na końcu zwracać Plugin_Stop lub Handled:
 
 

RegConsoleCmd("say", ProcessChat);

RegConsoleCmd("say_team", ProcessChat);
 
public Action ProcessChatIf(int client, int args)
{
    char ArgsBuffer[1024];
    char BufferForOneArg[128];

    

    // retrieving all the arguments and concatenating them as one

    for (int i = 1; i < args+1;i++)

    {

            GetCmdArg(i, BufferForOneArg, 127);

            

            StrCat(ArgsBuffer, 1023, BufferForOneArg);

            if(!isTheLastArgument(i, args))    StrCat(ArgsBuffer, 1023, " ");

    }

    

    PrintToChat(client, "Entered value: %s", ArgsBuffer);
    
    return Plugin_Stop;
}
public int isTheLastArgument(int i, int args)
{
	return i == args;
}
Go to the full post


  • This topic is locked This topic is locked
4 replies to this topic

#1 Ogen Dogen

    Czempion

  • Power User

  • Reputacja: 261
    Wszechwidzący

  • Postów:837
  • GG:
  • Steam:steam
  • Imię:Marcin
  • Lokalizacja:Dąbrowa Górnicza
Offline

Posted 07.09.2018 14:06

Jak w temacie, czy istnieje (odpowiednik) messagemode w SourceMod ? Jeśli tak, to jak go obsłużyć ? Jeśli nie to jaka jest alternatywa ? Obsługa przez nasłuchiwanie chatu ?

Chce uzyskać efekt gdzie otworzę graczowi specjalne okno z chatem, którego wiadomość odbiorę w konkretnej funkcji, a sama wiadomość nie pokaże się reszcie graczy.


  • +
  • -
  • 0

b_350_20_360204_C20008_FFFFFF_000000.png 193.33.176.115:27015

 

94e23d811c.png

 


#2 MAGNET

    SourceLearned ;)

  • Moderator

  • Reputacja: 661
    Wszechmogący

  • Postów:1,535
  • GG:
  • Imię:Olek
  • Lokalizacja:Dalekoo
Offline

Posted 07.09.2018 23:00   Best Answer

Nie ma messagemode. Musisz po prostu łapać say i na końcu zwracać Plugin_Stop lub Handled:
 
 
RegConsoleCmd("say", ProcessChat);

RegConsoleCmd("say_team", ProcessChat);
 
public Action ProcessChatIf(int client, int args)
{
    char ArgsBuffer[1024];
    char BufferForOneArg[128];

    

    // retrieving all the arguments and concatenating them as one

    for (int i = 1; i < args+1;i++)

    {

            GetCmdArg(i, BufferForOneArg, 127);

            

            StrCat(ArgsBuffer, 1023, BufferForOneArg);

            if(!isTheLastArgument(i, args))    StrCat(ArgsBuffer, 1023, " ");

    }

    

    PrintToChat(client, "Entered value: %s", ArgsBuffer);
    
    return Plugin_Stop;
}
public int isTheLastArgument(int i, int args)
{
	return i == args;
}

  • +
  • -
  • 1

#3 Ogen Dogen

    Czempion

  • Autor tematu
  • Power User

  • Reputacja: 261
    Wszechwidzący

  • Postów:837
  • GG:
  • Steam:steam
  • Imię:Marcin
  • Lokalizacja:Dąbrowa Górnicza
Offline

Posted 07.09.2018 23:41

Nie ma messagemode. Musisz po prostu łapać say i na końcu zwracać Plugin_Stop lub Handled:
 
 

RegConsoleCmd("say", ProcessChat);

RegConsoleCmd("say_team", ProcessChat);
 
public Action ProcessChatIf(int client, int args)
{
    char ArgsBuffer[1024];
    char BufferForOneArg[128];

    

    // retrieving all the arguments and concatenating them as one

    for (int i = 1; i < args+1;i++)

    {

            GetCmdArg(i, BufferForOneArg, 127);

            

            StrCat(ArgsBuffer, 1023, BufferForOneArg);

            if(!isTheLastArgument(i, args))    StrCat(ArgsBuffer, 1023, " ");

    }

    

    PrintToChat(client, "Entered value: %s", ArgsBuffer);
    
    return Plugin_Stop;
}
public int isTheLastArgument(int i, int args)
{
	return i == args;
}

 

Tak czułem, że na tym się skończy. A co jeśli chce obsłużyć kilka komend ? Muszę w jednej funkcji rozpisać if'y czy można to zrobić w bardziej elegancki sposób ? (w amxx bym zrobił X registerów w plugin_init)


  • +
  • -
  • 0

b_350_20_360204_C20008_FFFFFF_000000.png 193.33.176.115:27015

 

94e23d811c.png

 


#4 MAGNET

    SourceLearned ;)

  • Moderator

  • Reputacja: 661
    Wszechmogący

  • Postów:1,535
  • GG:
  • Imię:Olek
  • Lokalizacja:Dalekoo
Offline

Posted 08.09.2018 08:29

możesz spokojnie robić X registerów


  • +
  • -
  • 1

#5 MAGNET

    SourceLearned ;)

  • Moderator

  • Reputacja: 661
    Wszechmogący

  • Postów:1,535
  • GG:
  • Imię:Olek
  • Lokalizacja:Dalekoo
Offline

Posted 13.09.2018 14:51

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: Pomoc udzielona

Jeśli się z tym nie zgadzasz, report.png raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
  • +
  • -
  • 0




  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Coinsy CSGOPolygon Za SMS, PSC , Przelew - CoinSell.pro
Skiny do CS:GO za SMS, PSC, Przelew - CSGOPaka.com
Automatyczny Bot Levelowania Steam - LVLUPSteam.com
CSGO Gambling Sites and Free Betting Codes - DreamCodes.gg 💸 SellYourSkins.com - Łatwo sprzedaj swoje skiny do CS:GO

Sign In