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

Zostaw wiadomość, przerobienie pluginu permanent message


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 sq69i

    Zaawansowany

  • Użytkownik

Reputacja: 0
Nowy

  • Postów:117
  • Lokalizacja:Polska
Offline

Napisano 18.03.2022 20:13

Witam, dałoby rade przerobić ten plugin:

https://amxx.pl/topi...wiadomość-motd/

 


 

#include <amxmodx>

#include <amxmisc>
 
#define PLUGIN "Zostaw wiadomosc"
#define VERSION "1.0"
#define AUTHOR "Boski Z Polski"
 
new ilosc_wiadomosci;
 
new sciezka[128];
new nick_admina[33][33];
new data[33][33];
new wiadomosc[64][64];
 
public plugin_init() 
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_concmd("amx_wiadomosc", "wiadomosc_glowne", ADMIN_BAN, "<Wiadomosc>");
register_clcmd("say /wiadomosci", "motd", ADMIN_BAN);
 
get_configsdir(sciezka, charsmax(sciezka));
formatex(sciezka, charsmax(sciezka), "%s/wiadomosci_adminow.ini", sciezka);
}
 
public client_putinserver(id)
{
if(is_user_connected(id) && (get_user_flags(id) & ADMIN_BAN))
{
set_task(5.0, "motd", id);
}
}
 
public plugin_cfg()
{
if(file_exists(sciezka))
{
new linia[256];
new Len;
new g_nick_admina[33];
new g_data[33];
new g_wiadomosc[128];
 
for(new i = 0; read_file(sciezka, i, linia, charsmax(linia), Len); i++)
{
if(Len == 0 || !linia[0] || linia[0] == ';')
{
continue;
}
 
parse(linia, g_nick_admina, charsmax(g_nick_admina), g_data, charsmax(g_data), g_wiadomosc, charsmax(g_wiadomosc));
 
ilosc_wiadomosci ++;
copy(nick_admina[ilosc_wiadomosci], charsmax(nick_admina), g_nick_admina);
copy(data[ilosc_wiadomosci], charsmax(data), g_data);
copy(wiadomosc[ilosc_wiadomosci], charsmax(wiadomosc), g_wiadomosc);
}
}
}
 
public wiadomosc_glowne(id, level, cid) 
if(!cmd_access(id, level, cid, 1)) 
return PLUGIN_HANDLED 
}
 
new admin_nick[32];
get_user_name(id,admin_nick,charsmax(admin_nick));
 
new g_data[32];
get_time("%Y-%m-%d - %H:%M:%S", g_data, charsmax(g_data));
 
new g_wiadomosc[64];
read_argv(1, g_wiadomosc, 63);
 
new dane[526];
formatex(dane,charsmax(dane),"^"%s^" ^"%s^" ^"%s^"", admin_nick, g_data, g_wiadomosc);
write_file(sciezka, dane);
 
ilosc_wiadomosci ++;
copy(nick_admina[ilosc_wiadomosci], charsmax(nick_admina), admin_nick);
copy(data[ilosc_wiadomosci], charsmax(data), g_data);
copy(wiadomosc[ilosc_wiadomosci], charsmax(wiadomosc), g_wiadomosc);
 
return PLUGIN_HANDLED;
}
 
public motd(id, level, cid) 
{
if(!cmd_access(id, level, cid, 1)) 
return PLUGIN_HANDLED 
}
 
if(ilosc_wiadomosci >= 1)
{
new datas[3000];
new Len;
const giMax = sizeof datas;
Len = formatex(datas[Len], giMax - Len, "<br><body bgcolor=#000000></body><center><font size=^"3^"><font color=^"yellow^"><b> WIADOMOSCI ADMINOW </b><br><br>");
 
if(ilosc_wiadomosci >= 10)
{
for(new i = (ilosc_wiadomosci - 10); i < ilosc_wiadomosci - 1; i++)
{
Len += formatex(datas[Len], giMax - Len,"<br><b>NICK ADMINA: ^"%s%^" DATA: ^"%s%^" </b>",nick_admina[i + 1], data[i + 1]);
Len += formatex(datas[Len], giMax - Len,"<br><b>^"%s%^" </b>",wiadomosc[i + 1]);
}
}
else
{
for(new i = 0; i < ilosc_wiadomosci - 1; i++)
{
Len += formatex(datas[Len], giMax - Len,"<br><b>NICK ADMINA: ^"%s%^" DATA: ^"%s%^" </b>",nick_admina[i + 1], data[i + 1]);
Len += formatex(datas[Len], giMax - Len,"<br><b>^"%s%^" </b>",wiadomosc[i + 1]);
}
}
 
Len += formatex(datas[Len], giMax - Len,"<br><b><font color=^"red^">OSTATNIA WIADOMOSC:</b>");
Len += formatex(datas[Len], giMax - Len,"<br><b><font color=^"yellow^">NICK ADMINA: ^"%s%^" DATA: ^"%s%^"</b>",nick_admina[ilosc_wiadomosci], data[ilosc_wiadomosci]);
Len += formatex(datas[Len], giMax - Len,"<br><b>^"%s%^"</b>",wiadomosc[ilosc_wiadomosci]);
 
Len += formatex(datas[Len], giMax - Len,"</font></div></body></html>");
 
show_motd(id, datas, "WIADOMOSCI ADMINOW");
}
 
return PLUGIN_HANDLED;
}
 

 

 

Tylko żeby działał na zasadzie tego zamiast motd

https://amxx.pl/topi...tała-wiadomość/


 

/*

*
*
*   *    *    *****   *****        *       *****    *    *    *****   *    *   *       *
*   *    *   *             *      * *      *    *   *   **   *        *   **   * *   * *
*   ******   ******   ******     *   *     ******   *  * *   *        *  * *   *  * *  *
*   *    *   *             *    *******    *    *   * *  *   *        * *  *   *   *   *
*   *    *    *****   *****    *       *   *****    *    *    *****   *    *   *       *
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AMX MOD X script.                                                 *
* Plugin made by He3aBuCuM(a.k.a. independent).                     *
* Important! You can modify the code, but DO NOT modify the author! *
* Contacts with me:                                                 *
* E-mail: [email protected]                                      *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Special thanks to:                                                              *
* [email protected]     -  for the optimization on my first version           *
* [email protected]  -  tell me for the clamp native                       *
* [email protected]          -  tell me how to use ShowSyncHudMsg and some ideas   *
* [email protected]   -  for the idea amx_permanent_message_show            *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*
*/
 
#include <amxmodx>
#include <amxmisc>
 
new cvar_message, cvar_color, cvar_location, cvar_effects, cvar_show, cvar_cmd, hudsync
 
public plugin_init() {
    register_plugin("Permanent message", "1.1", "He3aBuCuM")
    cvar_message = register_cvar("amx_permanent_message", "Your/nadvertisement%new%here")
    cvar_color = register_cvar("amx_permanent_message_color", "255 255 255")
    cvar_location = register_cvar("amx_permanent_message_location", "3")
    cvar_effects = register_cvar("amx_permanent_message_effects", "0")
    cvar_show = register_cvar("amx_permanent_message_show", "0")
    cvar_cmd = register_cvar("amx_permanent_message_cmd", "1")
    register_concmd("amx_perm_msg", "cmdChangeMsg", ADMIN_LEVEL_A)
    hudsync = CreateHudSyncObj()
    set_task(1.0, "show_hud", 0, "", 0, "b")
}
 
public show_hud() {
    new message[200], location, eff, show, players[32], inum
    static red, green, blue
    get_pcvar_string(cvar_message, message, charsmax(message))
    get_hud_color(red, green, blue)
    location = get_pcvar_num(cvar_location)
    eff = clamp(get_pcvar_num(cvar_effects), 0, 2)
    show = get_pcvar_num(cvar_show)
    get_players(players, inum)
 
    replace_all(message, charsmax(message), "%new%", "^n")
    replace_all(message, charsmax(message), "/n", "^n")
 
    switch(location) {
        case 1: set_hudmessage(red, green, blue, 0.01, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 2: set_hudmessage(red, green, blue, -1.0, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 3: set_hudmessage(red, green, blue, 0.99, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 4: set_hudmessage(red, green, blue, 0.01, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 5: set_hudmessage(red, green, blue, -1.0, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 6: set_hudmessage(red, green, blue, 0.99, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 7: set_hudmessage(red, green, blue, 0.01, 0.75, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 8: set_hudmessage(red, green, blue, -1.0, 0.75, eff, 1.0, 1.0, 0.1, 0.2, -1)
        case 9: set_hudmessage(red, green, blue, 0.99, 0.70, eff, 1.0, 1.0, 0.1, 0.2, -1)
    }
 
    for(new i=0; i<inum; ++i) {
        switch(show) {
    case 0: ShowSyncHudMsg(0, hudsync, message)
            case 1: {
                if(!is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 2: {
                if(is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 3: {
                if(is_user_admin(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 4: {
                if(!is_user_admin(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 5: {
                if(is_user_admin(players[i]) && is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 6: {
                if(is_user_admin(players[i]) && !is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 7: {
                if(!is_user_admin(players[i]) && is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            case 8: {
                if(!is_user_admin(players[i]) && !is_user_alive(players[i]))
                    ShowSyncHudMsg(players[i], hudsync, message)
            }
            default: ShowSyncHudMsg(0, hudsync, message)
        }
    }
    return PLUGIN_CONTINUE
}
 
public cmdChangeMsg(id, level, cid) {
    if(!get_pcvar_num(cvar_cmd) || !cmd_access(id, level, cid, 1))
        return PLUGIN_HANDLED
 
    new args[200], name[32]
    read_args(args, charsmax(args))
    remove_quotes(args)
    get_user_name(id, name, charsmax(name))
        
    set_pcvar_string(cvar_message, args)
    log_amx("The admin ^"%s^" change the permanent message to ^"%s^"", name, args)
 
    return PLUGIN_CONTINUE
}
 
get_hud_color(&r, &g, & B) {
    new color[20]
    static red[5], green[5], blue[5]
    get_pcvar_string(cvar_color, color, charsmax(color))
    parse(color, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))
 
    r = str_to_num(red)
    g = str_to_num(green)
    b = str_to_num(blue)
}

 

Przykładowo w konsoli wpisuje amx_mess "tresc wiadomosci" i admini widzą tekst po prawej stronie przez x dni.

 

  • permanent_message.amxx działa dobrze tylko po wpisaniu komendy tekst jest zamieniany na nowy. Fajnie by bylo jakby sie dopisywał
  •  
  •  
  •  
  • cos w formie czat
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Użytkownik sq69i edytował ten post 18.03.2022 20:19

  • +
  • -
  • 0




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

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