Skocz do zawartości

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

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Edycja Pluginu

[ROZWIĄZANE] Przerobienie Mutemenu

edycja pluginu mute przerobienie

Najlepsza odpowiedź FejmZPolski , 01.03.2015 14:20

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <colorchat>

#define PLUGIN     "mute menu"
#define VERSION "1.0"
#define AUTHOR     "cheap_suit"

#define MAX_PLAYERS 32

new bool:g_mute[MAX_PLAYERS+1][MAX_PLAYERS+1]
new g_menuposition[MAX_PLAYERS+1]
new g_menuplayers[MAX_PLAYERS+1][32]
new g_menuplayersnum[MAX_PLAYERS+1]

new cvar_alltalk
new g_maxclients

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)

    register_clcmd("say", "clcmd_say")
    register_clcmd("say_team", "clcmd_say")

    register_forward(FM_Voice_SetClientListening, "fwd_voice_setclientlistening")
    register_menucmd(register_menuid("mute menu"), 1023, "action_mutemenu")
    
    cvar_alltalk = get_cvar_pointer("sv_alltalk")
    g_maxclients = global_get(glb_maxClients)
}

public client_putinserver(id)
    clear_list(id)
    
public client_disconnect(id)
    clear_list(id)

clear_list(id)
{
    for(new i = 0; i <= g_maxclients; ++i)
        g_mute[id][i] = false
}

public clcmd_say(id)
{
    static say_args[10]
    read_args(say_args, 9)
    remove_quotes(say_args)
    
    if(say_args[0] == '/' && containi(say_args, "mute") != -1)
    {
        display_mutemenu(id, g_menuposition[id] = 0)
        return PLUGIN_HANDLED_MAIN
    }
    return PLUGIN_CONTINUE
}

public fwd_voice_setclientlistening(receiver, sender, listen)
{
    if(receiver == sender)
        return FMRES_IGNORED
        
    if(g_mute[receiver][sender])
    {
        engfunc(EngFunc_SetClientListening, receiver, sender, 0)
        return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}

display_mutemenu(id, pos)
{
    if(pos < 0)  
        return
        
    static team[11]
    get_user_team(id, team, 10)
    
    new at = get_pcvar_num(cvar_alltalk)
    get_players(g_menuplayers[id], g_menuplayersnum[id],
    at ? "c" : "ce", at ? "" : team)

      new start = pos * 8
      if(start >= g_menuplayersnum[id])
            start = pos = g_menuposition[id]

      new end = start + 8
    if(end > g_menuplayersnum[id])
            end = g_menuplayersnum[id]
    
    static menubody[512]    
      new len = format(menubody, 511, "\wMute Menu^n^n")

    static name[32]
    
    new b = 0, i
    new keys = MENU_KEY_0
    
      for(new a = start; a < end; ++a)
    {
            i = g_menuplayers[id][a]
            get_user_name(i, name, 31)
        
        if(i == id)
        {
            ++b
            len += format(menubody[len], 511 - len, "\d#  %s %s\w^n", name, g_mute[id][i] ? "(Muted)" : "")
        }
        else
        {
            keys |= (1<<b)
            len += format(menubody[len], 511 - len, "%s%d. %s %s\w^n", g_mute[id][i] ? "\y" : "\w", ++b, name, g_mute[id][i] ? "(Muted)" : "")
        }
    }

      if(end != g_menuplayersnum[id])
    {
            format(menubody[len], 511 - len, "^n9. %s...^n0. %s", "Wiecej", pos ? "Wroc" : "Wyjdz")
            keys |= MENU_KEY_9
      }
      else
        format(menubody[len], 511-len, "^n0. %s", pos ? "Wroc" : "Wyjdz")
    
      show_menu(id, keys, menubody, -1, "mute menu")
}


public action_mutemenu(id, key)
{
    switch(key)
    {
            case 8: display_mutemenu(id, ++g_menuposition[id])
        case 9: display_mutemenu(id, --g_menuposition[id])
            default:
        {
            new player = g_menuplayers[id][g_menuposition[id] * 8 + key]
            
            g_mute[id][player] = g_mute[id][player] ? false : true
            display_mutemenu(id, g_menuposition[id])
            
            static name[32]
            get_user_name(player, name, 31)
            ColorChat(id, GREEN, "[System mute]^x01 %s gracza^x03 ^"%s^"", g_mute [id] [player] ?"Zmutowales": "Odmutowales",name)
            }
      }
    return PLUGIN_HANDLED
}
 
Przejdź do postu


  • Zamknięty Temat jest zamknięty
3 odpowiedzi w tym temacie

#1 neolagg

    Wszechpomocny

  • Użytkownik

Reputacja: 12
Początkujący

  • Postów:316
  • GG:
  • Lokalizacja:Zielona Góra
Offline

Napisano 25.02.2015 21:21

Witam

 

Mam problem gdy chce zmutować gracza wpisuje /mute i go mutuje a gdy chce odmutować odznaczam go i dubluje sie napis:

 
[System mute] Zmutowales 
[System mute] Zmutowales Odmutowales
 
To drugie jest od unmute chciałbym by było
 
 
[System mute] Zmutowales gracza "nick"
[System mute] Odmutowales gracza "nick"
 
i jakby dalo dozucic do tego troche koloru  :)
Pozdrawiam

 

Załączone pliki


  • +
  • -
  • 0

#2 FejmZPolski

    Banned

  • Zbanowany

Reputacja: 38
Życzliwy

  • Postów:59
  • Imię:Brak
Offline

Napisano 01.03.2015 14:20   Najlepsza odpowiedź

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <colorchat>

#define PLUGIN     "mute menu"
#define VERSION "1.0"
#define AUTHOR     "cheap_suit"

#define MAX_PLAYERS 32

new bool:g_mute[MAX_PLAYERS+1][MAX_PLAYERS+1]
new g_menuposition[MAX_PLAYERS+1]
new g_menuplayers[MAX_PLAYERS+1][32]
new g_menuplayersnum[MAX_PLAYERS+1]

new cvar_alltalk
new g_maxclients

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)

    register_clcmd("say", "clcmd_say")
    register_clcmd("say_team", "clcmd_say")

    register_forward(FM_Voice_SetClientListening, "fwd_voice_setclientlistening")
    register_menucmd(register_menuid("mute menu"), 1023, "action_mutemenu")
    
    cvar_alltalk = get_cvar_pointer("sv_alltalk")
    g_maxclients = global_get(glb_maxClients)
}

public client_putinserver(id)
    clear_list(id)
    
public client_disconnect(id)
    clear_list(id)

clear_list(id)
{
    for(new i = 0; i <= g_maxclients; ++i)
        g_mute[id][i] = false
}

public clcmd_say(id)
{
    static say_args[10]
    read_args(say_args, 9)
    remove_quotes(say_args)
    
    if(say_args[0] == '/' && containi(say_args, "mute") != -1)
    {
        display_mutemenu(id, g_menuposition[id] = 0)
        return PLUGIN_HANDLED_MAIN
    }
    return PLUGIN_CONTINUE
}

public fwd_voice_setclientlistening(receiver, sender, listen)
{
    if(receiver == sender)
        return FMRES_IGNORED
        
    if(g_mute[receiver][sender])
    {
        engfunc(EngFunc_SetClientListening, receiver, sender, 0)
        return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}

display_mutemenu(id, pos)
{
    if(pos < 0)  
        return
        
    static team[11]
    get_user_team(id, team, 10)
    
    new at = get_pcvar_num(cvar_alltalk)
    get_players(g_menuplayers[id], g_menuplayersnum[id],
    at ? "c" : "ce", at ? "" : team)

      new start = pos * 8
      if(start >= g_menuplayersnum[id])
            start = pos = g_menuposition[id]

      new end = start + 8
    if(end > g_menuplayersnum[id])
            end = g_menuplayersnum[id]
    
    static menubody[512]    
      new len = format(menubody, 511, "\wMute Menu^n^n")

    static name[32]
    
    new b = 0, i
    new keys = MENU_KEY_0
    
      for(new a = start; a < end; ++a)
    {
            i = g_menuplayers[id][a]
            get_user_name(i, name, 31)
        
        if(i == id)
        {
            ++b
            len += format(menubody[len], 511 - len, "\d#  %s %s\w^n", name, g_mute[id][i] ? "(Muted)" : "")
        }
        else
        {
            keys |= (1<<b)
            len += format(menubody[len], 511 - len, "%s%d. %s %s\w^n", g_mute[id][i] ? "\y" : "\w", ++b, name, g_mute[id][i] ? "(Muted)" : "")
        }
    }

      if(end != g_menuplayersnum[id])
    {
            format(menubody[len], 511 - len, "^n9. %s...^n0. %s", "Wiecej", pos ? "Wroc" : "Wyjdz")
            keys |= MENU_KEY_9
      }
      else
        format(menubody[len], 511-len, "^n0. %s", pos ? "Wroc" : "Wyjdz")
    
      show_menu(id, keys, menubody, -1, "mute menu")
}


public action_mutemenu(id, key)
{
    switch(key)
    {
            case 8: display_mutemenu(id, ++g_menuposition[id])
        case 9: display_mutemenu(id, --g_menuposition[id])
            default:
        {
            new player = g_menuplayers[id][g_menuposition[id] * 8 + key]
            
            g_mute[id][player] = g_mute[id][player] ? false : true
            display_mutemenu(id, g_menuposition[id])
            
            static name[32]
            get_user_name(player, name, 31)
            ColorChat(id, GREEN, "[System mute]^x01 %s gracza^x03 ^"%s^"", g_mute [id] [player] ?"Zmutowales": "Odmutowales",name)
            }
      }
    return PLUGIN_HANDLED
}
 

Droga hierarchio, chciałem pomóc. !

#3 neolagg

    Wszechpomocny

  • Autor tematu
  • Użytkownik

Reputacja: 12
Początkujący

  • Postów:316
  • GG:
  • Lokalizacja:Zielona Góra
Offline

Napisano 01.03.2015 14:58

Podziekował leci + :)


  • +
  • -
  • 0

#4 MAGNET

    SourceLearned ;)

  • Moderator

Reputacja: 661
Wszechmogący

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

Napisano 02.03.2015 00:45

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





Również z jednym lub większą ilością słów kluczowych: edycja pluginu, mute, przerobienie

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych