Jump to content

[AMXX] OutStanding Production's - Restricted Name, Bug's


Don Liviu

Recommended Posts

Descriere: Acest plugin schimba nick-urile jucatorilor inainte de a se conecta pe server si va aparea astfel: Nume [1], Nume [2], pentru a se evita bugu cu (1).

 

Nume: Restricted Names
Versiune: 1.1
 
Instalare:
1. Fisierul Nick.sma il puneti in addons/amxmodx/scripting.
2. Fisierul Nick.amxx il puneti in addons/amxmodx/plugins.
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:
Nick.amxx
Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg):
 
 ☻ amx_default_advert "numele default" - numele default care nu va fi afectat.
 ☻ amx_new_advert "NumeAles" X - Schimba numele in numele ales de tine
 
Informatii:
 
Aveti un fisier "restricted_things.ini" pe care server-ul il va creea automat in "configs".
In el veti pune caracterele interzise.
In "restricted_things.ini" veti avea interzis numele ".ro" si eu ma conectez cu "Rangfort.ro" si nu il va schimba fiinda aveti pus amx_default_advert "Rangfort.ro"
 
Descarcare: AMXX
 
Aveti aici si sma-ul pluginului !

 

#include <amxmodx>
 
new Array:g_Things = Invalid_Array;
new g_NamesCount = 0;
new g_Default = 0;
new g_New = 0;
 
public plugin_init()
{
    register_plugin("Restricted Names", "1.1", "Hattrick (Claudiu HKS)");
 
    g_Default = register_cvar("amx_default_advert", "Rangfort.ro", FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED | FCVAR_EXTDLL);
    g_New = register_cvar("amx_new_advert", "WWW.RANGFORT.RO", FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED | FCVAR_EXTDLL);
    
    if (g_Default == 0)
    {
        set_fail_state("Plugin failed.");
        
        return;
    }
    
    static File, Location[256], ConfigurationFilesDirectory[128], Line[64];
 
    get_localinfo("amxx_configsdir", ConfigurationFilesDirectory, charsmax(ConfigurationFilesDirectory));
 
    formatex(Location, charsmax(Location), "%s/restricted_things.ini", ConfigurationFilesDirectory);
    
    if (!file_exists(Location))
    {
        File = fopen(Location, "w+");
        
        switch (File)
        {
            case 0:
            {
                
            }
            
            default:
            {
                fclose(File);
            }
        }
    }
 
    File = fopen(Location, "r");
 
    if (!File)
    {
        log_amx("Unable to open ^"%s/restricted_things.ini^".", ConfigurationFilesDirectory);
 
        return;
    }
    
    g_Things = ArrayCreate(64);
    
    if (g_Things == Invalid_Array)
    {
        set_fail_state("Plugin failed to load.");
        
        return;
    }
 
    while (!feof(File))
    {
        fgets(File, Line, charsmax(Line));
 
        trim(Line);
        
        if (strlen(Line) && Line[0] != ';')
        {
            ArrayPushString(g_Things, Line);
        }
    }
    
    fclose(File);
    
    if (g_Things == Invalid_Array || !ArraySize(g_Things))
    {
        log_amx("No restricted names found in ^"%s/restricted_things.ini^".", ConfigurationFilesDirectory);
    }
}
 
public client_putinserver(Client)
{
    if (g_Things == Invalid_Array || !ArraySize(g_Things))
    {
        return;
    }
 
    static Name[32], Default[32], Iterator, Thing[32], New[32];
 
    get_user_name(Client, Name, charsmax(Name));
    get_pcvar_string(g_Default, Default, charsmax(Default));
    get_pcvar_string(g_New, New, charsmax(New));
    
    if (containi(Name, Default) != -1)
    {
        return;
    }
    
    for (Iterator = 0; Iterator < ArraySize(g_Things); Iterator++)
    {
        ArrayGetString(g_Things, Iterator, Thing, charsmax(Thing));
        
        if (containi(Name, Thing) != -1)
        {
            formatex(Name, charsmax(Name), "%s [%d]", New, ++g_NamesCount);
            
            set_user_info(Client, "name", Name);
            
            client_cmd(Client, "name ^"%s^"", Name);
            
            break;
        }
    }
}
 
public client_infochanged(Client)
{
    if (g_Things == Invalid_Array || !ArraySize(g_Things))
    {
        return;
    }
 
    static OldName[32], Name[32], Default[32], Iterator, Thing[32], New[32];
 
    get_user_name(Client, OldName, charsmax(OldName));
    get_pcvar_string(g_Default, Default, charsmax(Default));
    get_user_info(Client, "name", Name, charsmax(Name));
    get_pcvar_string(g_New, New, charsmax(New));
    
    if (equali(Name, OldName))
    {
        return;
    }
    
    if (containi(Name, Default) != -1)
    {
        return;
    }
    
    for (Iterator = 0; Iterator < ArraySize(g_Things); Iterator++)
    {
        ArrayGetString(g_Things, Iterator, Thing, charsmax(Thing));
        
        if (containi(Name, Thing) != -1)
        {
            formatex(Name, charsmax(Name), "%s [%d]", New, ++g_NamesCount);
            
            set_user_info(Client, "name", Name);
            
            client_cmd(Client, "name ^"%s^"", Name);
            
            break;
        }
    }
}

 

 

 

 

Succes !

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...