[CSGO] Restricted Names

Descărcări de pluginuri și discuții despre acestea.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
tre3fla
Membru eXtream
Membru eXtream
Posts: 5317
Joined: 27 May 2012, 11:15
Detinator Steam: Da
CS Status: Allah Akbar !
Detinator server CS: Nu
SteamID: /id/tre3fla_xxx
Has thanked: 14 times
Been thanked: 129 times

29 Jul 2017, 15:32

Descarcare:
Mega || Girlshare || Zippyshare
RestrictNames.sp | Afiseaza codul
#include <sourcemod>
#include <sdktools>

new String: RestrictedNamesFile[ PLATFORM_MAX_PATH ]

new Handle: RestrictedNames = INVALID_HANDLE

Handle: HandleMethod
Handle: BackupName
Handle: KickReason
Handle: MinNameLen


public Plugin:myinfo = {
	name = "Restricted Names: Basic",
	author = "tre3fla",
	description = "Filtreaza numele jucatorilor",
	version = "1.0",
	url = "http://extreamcs.com/forum"
}

public OnPluginStart( ) {
	HandleMethod = CreateConVar( "sm_restricted_names_action", "3", "0=dezactivat, 1=kick, 2=schimba numele, 3=sterge partea interzisa din nume" )
	BackupName = CreateConVar( "sm_default_name", "CSGO Player", "Numele in care sa fie redenumiti jucatorii cu nume interzise" )
	KickReason = CreateConVar( "sm_kick_reason", "Your name is not allowed", "Mesajul care sa ii apara daca primeste kick pentur ca are nume interzis" )
	MinNameLen = CreateConVar( "sm_min_name_lenght", "3", "Minim cate caractere sa aiba numele pentru a putea fi folosit" )
	
	HookUserMessage( GetUserMessageId( "SayText2" ), SayText2, true )
	HookEvent( "player_changename", OnNameChange )
}

public void OnMapStart( ) {
	LoadRestrictedNames( )
}

public OnClientPutInServer( client ) {
	CheckClientName( client )
}

public Action:OnNameChange( Handle:event, const String:name[ ], bool:dontBroadcast ) {
	new UserID = GetEventInt( event, "userid" )
	new client = GetClientOfUserId( UserID )

	if( IsClientInGame( client ) && !IsFakeClient( client ) ) {
		decl String:NewName[ MAX_NAME_LENGTH ]
		decl String:OldName[ MAX_NAME_LENGTH ]
		
		GetEventString( event, "oldname", OldName, sizeof( OldName ) )
		GetEventString( event, "newname", NewName, sizeof( NewName ) )
		
		decl String: LargeBuffer[ 1024 ]
		
		for( new i = 0; i < GetArraySize( RestrictedNames ); i++ ) {
			GetArrayString( RestrictedNames, i, LargeBuffer, sizeof( LargeBuffer ) )
			
			if( StrContains( NewName, LargeBuffer ) != -1 ) {
				SetClientName( client, OldName )
				PrintToChat( client, "* Name change attempt failed!\x02 Your choosen name is not allowed!" )
				
				return Plugin_Changed
			}
			
			if( GetConVarInt( MinNameLen ) > 0 && strlen( NewName ) < GetConVarInt( MinNameLen ) ) {
				SetClientName( client, OldName )
				
				PrintToChat( client, "*\x02 Name change attempt failed!" )
				PrintToChat( client, "* Your\x04 name\x01 must have at least\x05 %d\x01 characters!", GetConVarInt( MinNameLen ) )
				
				return Plugin_Stop
			}
		}
	}
	
	return Plugin_Continue
}

public CheckClientName( client ) {
	if( IsClientInGame( client ) && client > 0 && client < MaxClients ) {
		decl String: LargeBuffer[ 1024 ]
		
		decl String: Name[ 32 ]
		GetClientName( client, Name, sizeof( Name ) )
		
		for( new i = 0; i < GetArraySize( RestrictedNames ); i++ ) {
			GetArrayString( RestrictedNames, i, LargeBuffer, sizeof( LargeBuffer ) )
			
			if( StrContains( Name, LargeBuffer ) != -1 ) {
				switch( GetConVarInt( HandleMethod ) ) {
					case 1: {
						decl String: ReasonBuffer[ 128 ]
						GetConVarString( KickReason, ReasonBuffer, sizeof( ReasonBuffer ) )
						
						KickClient( client, "%s", ReasonBuffer )
					}
					case 2: {
						decl String: NameBuffer[ 32 ]
						GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
						
						SetClientName( client, NameBuffer )
					}
					case 3: {
						ReplaceString( Name, sizeof( Name ), LargeBuffer, "" )
						SetClientName( client, Name )
						
						if( TrimString( Name ) && StrEqual( Name, "" ) ) {
							decl String: NameBuffer[ 32 ]
							GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
							
							SetClientName( client, NameBuffer )
						}
					}
				}
			}
			
			if( GetConVarInt( MinNameLen ) > 0 && strlen( Name ) < GetConVarInt( MinNameLen ) ) {
				decl String: NameBuffer[ 32 ]
				GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
				
				SetClientName( client, NameBuffer )
			}
		}
	}
}

public Action:SayText2( UserMsg:msg_id, Handle:bf, players[ ], playersNum, bool:reliable, bool:init ) {
	new String:buffer[ 25 ]
	
	if( GetUserMessageType( ) == UM_Protobuf ) {
		PbReadString( bf, "msg_name", buffer, sizeof( buffer ) )
		
		if( StrEqual( buffer, "#Cstrike_Name_Change" ) ) {
			return Plugin_Handled
		}
	}
	
	return Plugin_Continue
}  	

public LoadRestrictedNames( ) {
	RestrictedNames = CreateArray( 1024 )
	
	BuildPath( Path_SM, RestrictedNamesFile, sizeof( RestrictedNamesFile ), "configs/RestrictedNames.txt" )
	new Handle: RestrictedNamesText = OpenFile( RestrictedNamesFile, "r" )
	
	new String: ResultsBuffer[ 1024 ]
	
	while( !IsEndOfFile( RestrictedNamesText ) && ReadFileLine( RestrictedNamesText, ResultsBuffer, sizeof( ResultsBuffer ) ) ) {
		ReplaceString( ResultsBuffer, sizeof( ResultsBuffer ), "\n", "", false )
		PushArrayString( RestrictedNames, ResultsBuffer )
	}
}
Nume: Name Restrict
Autor: tre3fla
Versiune: free

Descriere:
Blocheaza, modifica, interzice sau schimba complet numele jucatorilor daca au un nume pe care nu doriti sa-l aiba pe serverul vostru. De asemenea nu permite jucatorilor sa aiba numele prea mic ( setabil prin cvar ). Blocheaza si mesajul ala in chat gen "X changed his name to Y" pentru a se evita spam-ul.

Convar-uri (se adauga in server.cfg):
  • sm_restricted_names_action
    0 = Pluginul nu filtreaza numele de pe server, jucatorii isi pot pune ce nume vor
    1 = Da kick jucatorilor cu nume interzise
    2 = Schimba numele jucatorilor intr-un nume setat de voi
    3 = Sterge partea nedorita din nume (de exemplu daca voi nu vreti sa aibe numele Marius iar pe jucator il cheama Ion Marius,
    va sterge Marius din nume si pe jucator il va chema doar Ion
  • sm_default_name "Nume Dorit" - default "CSGO Player", numele default in care sa fie redenumiti jucatorii cu nume interzise
  • sm_kick_reason "Motiv-ul kick-ului" - default "Your Name is not allowed", ce sa ii arate jucatorului daca primeste kick datorita numelui interzis
  • sm_min_name_lenght - Cate caractere trebuie sa aiba minim un nume, default 3 caractere
Instalare:
1. Fisierul RestrictedNames.sp se adauga in addons/sourcemod/scripting
2. Fisierul RestrictedNames.smx se adauga in addons/sourcemod/plugins
3. Fisierul RestrictedNames.txt se adauga in addons/sourcemod/configs

Daca nu aveti fisierul RestrictedNames.txt in folderul configs pluginul NU VA FUNCTIONA! Este foarte important ca numele sa fie scris exact asa si sa aibe extensia .txt!
RoyalServer 2
User avatar
OXYD
Membru, skill +1
Membru, skill +1
Posts: 463
Joined: 27 May 2017, 22:38
Detinator Steam: Da
CS Status: Playing CS:GO
Detinator server CS: Go.HellHounds.Ro
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Been thanked: 1 time
Contact:

30 Jul 2017, 12:00

Nu merge :P
am incercat doar ala care iti schimba numele
User avatar
tre3fla
Membru eXtream
Membru eXtream
Posts: 5317
Joined: 27 May 2012, 11:15
Detinator Steam: Da
CS Status: Allah Akbar !
Detinator server CS: Nu
SteamID: /id/tre3fla_xxx
Has thanked: 14 times
Been thanked: 129 times

30 Jul 2017, 12:33

OXYD wrote:Nu merge :P
am incercat doar ala care iti schimba numele
Cum adica nu merge ? Ai pus RestrictedNames.txt in configs ? Ai avut ceva in nume care era in RestrictedNames.txt ?

Apropo: Vezi ca trebuie sa le scrii una sub alta, intr-o singura coloana pa toate, adica formatu trebuie sa fie ceva de genu:
nume1
nume2
nume3
nume4
SI FARA SPATII INTRE ELE. De mers merge ca l-am testat eu cu un prieten si merge foarte bine. Intram eu cu nume "tre3fla hellcase.com" si imi stergea hellcase.com de la nume, daca ramanea numele gol ma redenumea, daca sm_restricted_names_action era pe 2 ma redenumea in CSGO Player.
User avatar
OXYD
Membru, skill +1
Membru, skill +1
Posts: 463
Joined: 27 May 2017, 22:38
Detinator Steam: Da
CS Status: Playing CS:GO
Detinator server CS: Go.HellHounds.Ro
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Been thanked: 1 time
Contact:

30 Jul 2017, 12:34

am facut , exact la fel ca tine mi-am pus OXYD hellcase.com si degeaba nu mi-l schimba efectiv raman cu numele la fel

Server.CFG:

Code: Select all

sm_restricted_names_action 2
sm_default_name "Join NUME.LA.SERVER !WS !KNIFE !GLOVES HYDRA UPDATE"
sm_kick_reason "Reclama in Nume"
sm_min_name_lenght 1
User avatar
tre3fla
Membru eXtream
Membru eXtream
Posts: 5317
Joined: 27 May 2012, 11:15
Detinator Steam: Da
CS Status: Allah Akbar !
Detinator server CS: Nu
SteamID: /id/tre3fla_xxx
Has thanked: 14 times
Been thanked: 129 times

30 Jul 2017, 12:51

OXYD wrote:am facut , exact la fel ca tine mi-am pus OXYD hellcase.com si degeaba nu mi-l schimba efectiv raman cu numele la fel

Server.CFG:
sm_restricted_names_action 2
sm_default_name "Join NUME.LA.SERVER !WS !KNIFE !GLOVES HYDRA UPDATE"
sm_kick_reason "Reclama in Nume"
sm_min_name_lenght 1
Wat ? Si nu ti-a picat sv ? Nu stii ca numele poate avea maxim 32 de caractere ? nici in profilul de la steam nu te lasa sa pui mai multe. Rezuma-te la un nume mai mic de maxim 32 de caractere, space-ul se ia in considerare si el.
User avatar
OXYD
Membru, skill +1
Membru, skill +1
Posts: 463
Joined: 27 May 2017, 22:38
Detinator Steam: Da
CS Status: Playing CS:GO
Detinator server CS: Go.HellHounds.Ro
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Been thanked: 1 time
Contact:

30 Jul 2017, 16:09

Tot nu merge , intra pe server si tot ii lasa numele neschimbat .
User avatar
tre3fla
Membru eXtream
Membru eXtream
Posts: 5317
Joined: 27 May 2012, 11:15
Detinator Steam: Da
CS Status: Allah Akbar !
Detinator server CS: Nu
SteamID: /id/tre3fla_xxx
Has thanked: 14 times
Been thanked: 129 times

30 Jul 2017, 17:04

RestrictedNames.sp | Afiseaza codul
#include <sourcemod>
#include <sdktools>

new String: RestrictedNamesFile[ PLATFORM_MAX_PATH ]

new Handle: RestrictedNames = INVALID_HANDLE

Handle: HandleMethod
Handle: BackupName
Handle: KickReason
Handle: MinNameLen


public Plugin:myinfo = {
	name = "Restricted Names: Basic",
	author = "tre3fla",
	description = "Filtreaza numele jucatorilor",
	version = "1.0",
	url = "http://extreamcs.com/forum"
}

public OnPluginStart( ) {
	HandleMethod = CreateConVar( "sm_restricted_names_action", "3", "0=dezactivat, 1=kick, 2=schimba numele, 3=sterge partea interzisa din nume" )
	BackupName = CreateConVar( "sm_default_name", "CSGO Player", "Numele in care sa fie redenumiti jucatorii cu nume interzise" )
	KickReason = CreateConVar( "sm_kick_reason", "Your name is not allowed", "Mesajul care sa ii apara daca primeste kick pentur ca are nume interzis" )
	MinNameLen = CreateConVar( "sm_min_name_lenght", "3", "Minim cate caractere sa aiba numele pentru a putea fi folosit" )
	
	HookUserMessage( GetUserMessageId( "SayText2" ), SayText2, true )
	HookEvent( "player_changename", OnNameChange )
}

public void OnMapStart( ) {
	LoadRestrictedNames( )
}

public OnClientPutInServer( client ) {
	CheckClientName( client )
}

public Action:OnNameChange( Handle:event, const String:name[ ], bool:dontBroadcast ) {
	new UserID = GetEventInt( event, "userid" )
	new client = GetClientOfUserId( UserID )

	if( IsClientInGame( client ) && !IsFakeClient( client ) ) {
		decl String:NewName[ MAX_NAME_LENGTH ]
		decl String:OldName[ MAX_NAME_LENGTH ]
		
		GetEventString( event, "oldname", OldName, sizeof( OldName ) )
		GetEventString( event, "newname", NewName, sizeof( NewName ) )
		
		decl String: LargeBuffer[ 1024 ]
		
		for( new i = 0; i < GetArraySize( RestrictedNames ); i++ ) {
			GetArrayString( RestrictedNames, i, LargeBuffer, sizeof( LargeBuffer ) )
			
			if( StrContains( NewName, LargeBuffer, false ) != -1 ) {
				SetClientName( client, OldName )
				PrintToChat( client, "* Name change attempt failed!\x02 Your choosen name is not allowed!" )
				
				return Plugin_Changed
			}
			
			if( GetConVarInt( MinNameLen ) > 0 && strlen( NewName ) < GetConVarInt( MinNameLen ) ) {
				SetClientName( client, OldName )
				
				PrintToChat( client, "*\x02 Name change attempt failed!" )
				PrintToChat( client, "* Your\x04 name\x01 must have at least\x05 %d\x01 characters!", GetConVarInt( MinNameLen ) )
				
				return Plugin_Stop
			}
		}
	}
	
	return Plugin_Continue
}

public CheckClientName( client ) {
	if( IsClientInGame( client ) && client > 0 && client < MaxClients ) {
		decl String: LargeBuffer[ 1024 ]
		
		decl String: Name[ 32 ]
		GetClientName( client, Name, sizeof( Name ) )
		
		for( new i = 0; i < GetArraySize( RestrictedNames ); i++ ) {
			GetArrayString( RestrictedNames, i, LargeBuffer, sizeof( LargeBuffer ) )
			
			if( StrContains( Name, LargeBuffer, false ) != -1 ) {
				switch( GetConVarInt( HandleMethod ) ) {
					case 1: {
						decl String: ReasonBuffer[ 128 ]
						GetConVarString( KickReason, ReasonBuffer, sizeof( ReasonBuffer ) )
						
						KickClient( client, "%s", ReasonBuffer )
					}
					case 2: {
						decl String: NameBuffer[ 32 ]
						GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
						
						SetClientName( client, NameBuffer )
					}
					case 3: {
						ReplaceString( Name, sizeof( Name ), LargeBuffer, "" )
						SetClientName( client, Name )
						
						if( TrimString( Name ) && StrEqual( Name, "" ) ) {
							decl String: NameBuffer[ 32 ]
							GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
							
							SetClientName( client, NameBuffer )
						}
					}
				}
			}
			
			if( GetConVarInt( MinNameLen ) > 0 && strlen( Name ) < GetConVarInt( MinNameLen ) ) {
				decl String: NameBuffer[ 32 ]
				GetConVarString( BackupName, NameBuffer, sizeof( NameBuffer ) )
				
				SetClientName( client, NameBuffer )
			}
		}
	}
}

public Action:SayText2( UserMsg:msg_id, Handle:bf, players[ ], playersNum, bool:reliable, bool:init ) {
	new String:buffer[ 25 ]
	
	if( GetUserMessageType( ) == UM_Protobuf ) {
		PbReadString( bf, "msg_name", buffer, sizeof( buffer ) )
		
		if( StrEqual( buffer, "#Cstrike_Name_Change" ) ) {
			return Plugin_Handled
		}
	}
	
	return Plugin_Continue
}  	

public LoadRestrictedNames( ) {
	RestrictedNames = CreateArray( 1024 )
	
	BuildPath( Path_SM, RestrictedNamesFile, sizeof( RestrictedNamesFile ), "configs/RestrictedNames.txt" )
	new Handle: RestrictedNamesText = OpenFile( RestrictedNamesFile, "r" )
	
	new String: ResultsBuffer[ 1024 ]
	
	while( !IsEndOfFile( RestrictedNamesText ) && ReadFileLine( RestrictedNamesText, ResultsBuffer, sizeof( ResultsBuffer ) ) ) {
		ReplaceString( ResultsBuffer, sizeof( ResultsBuffer ), "\n", "", false )
		PushArrayString( RestrictedNames, ResultsBuffer )
	}
}
Nu am stat sa verific arhiva sa vad daca am pus vreun sp sau smx diferit din greseala. Uite compileaza aia si incearca iar. Uite ca am testat eu si la mine a mers
Poze | Afiseaza codul
Image
sm_restricted_names_action 2
Image
sm_restricted_names_action 3
Image
Pur si simplu mi-am pus hellcase la nume si am intrat pe server. Cand era sm_restricted_names_action 2 imi schimba numele in csgo player, cand era sm_restricted_names_action 3 imi stergea hellcase de la nume. Poate ai vreun plugin ceva cu care interfereaza...

Vezi si in loguri daca iti da vreo eroare.
User avatar
OXYD
Membru, skill +1
Membru, skill +1
Posts: 463
Joined: 27 May 2017, 22:38
Detinator Steam: Da
CS Status: Playing CS:GO
Detinator server CS: Go.HellHounds.Ro
Reputatie: Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Been thanked: 1 time
Contact:

31 Jul 2017, 01:30

Nup , cred ca e un plugin cu care interfereaza
| Afiseaza codul
Image
Image
Post Reply

Return to “Pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests