Descriere: Jucatorii care intra pe server avand unele cuvinte in nume, de exemplu reclama la o alta comunitate sau la alt server li se schimba numele in "SCHIMBA NUMELE"
Autor: kRatoss
Versiune: 1.0
Link oficial: pluginuri-general/restrict-names-t369772.html
Instalare:
1. Compilati sursa
2. Fisierul "name_restrict.smx" se adauga in "addons/sourcemod/plugins"
3. Creati un fisier numit "restricted_names.txt" si il puneti "addons/sourcemod/configs"
Nu are comenzi sau convar-uri
Configul ar trebui sa arate ceva de genu:
Code: Select all
extreamcs.com
jucausii.ro
baietibunilacounter.ro
server.fantoma.ro
Puteti pune si .ro ca sa blocati toate domeniile linkurile cu domeniu .ro, la fel si cu .com, etc ..
Sursa:
Code: Select all
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
ArrayList g_hNames;
public Plugin myinfo =
{
name = "Name Restrict",
author = "kRatoss"
};
public void OnPluginStart()
{
g_hNames = CreateArray(MAX_NAME_LENGTH);
}
public void OnClientPostAdminCheck(int Client)
{
char Name[MAX_NAME_LENGTH], RestrictedNames[MAX_NAME_LENGTH];
if (GetClientName(Client, Name, sizeof(Name)))
{
int Size = GetArraySize(g_hNames);
for (int Iter = 0; Iter < Size; Iter++)
{
GetArrayString(g_hNames, Iter, RestrictedNames, sizeof(RestrictedNames));
if(StrContains(Name, RestrictedNames, false) != -1)
{
SetClientName(Client, "SCHIMBA NUMELE");
break;
}
}
}
}
public void OnMapEnd()
{
ClearArray(g_hNames);
}
public void OnMapStart()
{
Handle pFile;
char Path[PLATFORM_MAX_PATH], Line[MAX_NAME_LENGTH];
BuildPath(Path_SM, Path, sizeof(Path), "configs/restricted_names.txt");
if(FileExists(Path))
{
pFile = OpenFile(Path, "rt");
if (pFile != INVALID_HANDLE)
{
while (!IsEndOfFile(pFile) && ReadFileLine(pFile, Line, sizeof(Line)))
{
TrimString(Line);
PushArrayString(g_hNames, Line);
}
CloseHandle(pFile);
}
}
else
{
SetFailState("Nu am putut gasi fisierul <%s>", Path);
}
}