Raised This Month: $37 Target: $400
 9% 

help , pls fix plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bebe9b
Senior Member
Join Date: May 2009
Location: Romania
Old 01-13-2019 , 05:58   help , pls fix plugin
Reply With Quote #1

Hi,
Please help me to solve this plugin , the author says he works and has no error but this message appears in the log:

L 01/13/2019 - 00:53:48: [SM] Blaming: RestrictedNames.smx
L 01/13/2019 - 00:53:48: [SM] Call stack trace:
L 01/13/2019 - 00:53:48: [SM] [1] Line 53, D:\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\addons\sourcemod\scripting\Res trictedNames.sp::OnNameChange
L 01/13/2019 - 00:53:48: [SM] [3] SetClientName
L 01/13/2019 - 00:53:48: [SM] [4] Line 59, D:\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\addons\sourcemod\scripting\Res trictedNames.sp::OnNameChange

Thx,
Attached Files
File Type: sp Get Plugin or Get Source (RestrictedNames.sp - 13 views - 4.9 KB)
__________________
respecta si vei fi respectat

Last edited by bebe9b; 01-13-2019 at 15:42.
bebe9b is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 01-13-2019 , 15:52   Re: help , pls fix plugin
Reply With Quote #2

Untested.

PHP Code:

#include <sourcemod>
#include <sdktools>

ArrayList g_RestrictedPatterns;

public 
OnPluginStart()
{
    
HookEvent("player_changename"Event_PlayerChangeName);
    
g_RestrictedPatterns = new ArrayList(ByteCountToCells(MAX_NAME_LENGTH));
}

public 
void OnMapStart()
{
    
g_RestrictedPatterns.Clear();
    
    
char path[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMpathsizeof(path), "configs/RestrictedNames.txt");
    
    
File file OpenFile(path"r");
    
    if (
file != null)
    {
        
char buffer[MAX_NAME_LENGTH];
        
        while (!
file.EndOfFile() && file.ReadLine(buffersizeof(buffer)))
        {
            
ReplaceString(buffersizeof(buffer), "\n""");
            
g_RestrictedPatterns.PushString(buffer);
        }
        
        
file.Close();
    }
}

public 
OnClientPostAdminCheck(int client)
{
    
char clientName[MAX_NAME_LENGTH];
    
GetClientName(clientclientNamesizeof(clientName));
    
    for (
int i 0g_RestrictedPatterns.Lengthi++)
    {
        
char buffer[MAX_NAME_LENGTH];
        
g_RestrictedPatterns.GetString(ibuffersizeof(buffer));
        
        if (
StrContains(clientNamebuffer) != -1)
        {
            
RequestFrame(OnClientNameChange_FrameGetClientUserId(client));
            return;
        }
    }
}

public 
void Event_PlayerChangeName(Event event, const char[] namebool dontBroadcast)
{
    
int clientId event.GetInt("userid");
    
int client GetClientOfUserId(clientId);

    if (
client)
    {
        
char newName[MAX_NAME_LENGTH];
        
        for (
int i 0g_RestrictedPatterns.Lengthi++)
        {
            
char buffer[MAX_NAME_LENGTH];
            
g_RestrictedPatterns.GetString(ibuffersizeof(buffer));
            
            if (
StrContains(newNamebuffer) != -1)
            {
                
RequestFrame(OnClientNameChange_FrameclientId);
                return;
            }
        }
    }
}

public 
void OnClientNameChange_Frame(any data)
{
    
int client GetClientOfUserId(view_as<int>(data));
    
    if (
client)
    {
        
char buffer[MAX_NAME_LENGTH];
        
Format(buffersizeof(buffer), "Player %d\0"client);
        
        
SetClientName(clientbuffer);
    }

__________________
Ilusion9 is offline
bebe9b
Senior Member
Join Date: May 2009
Location: Romania
Old 01-13-2019 , 16:21   Re: help , pls fix plugin
Reply With Quote #3

Functioneaza perfect.
Thx man
__________________
respecta si vei fi respectat
bebe9b is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:11.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode