#include <sourcemod>
public Plugin:myinfo =
{
name = "SteamId Protect",
author = "Andruum",
description = "Protect SteamId on nosteam servers",
version = "1.10",
url = ""
};
public OnPluginStart()
{
RegServerCmd("sp_add",cmdcallbackadd);
RegServerCmd("sp_del",cmdcallbackdel);
new Handle:db = CreateKeyValues("steamprotect");
KvJumpToKey(db,"Steam",true);
KvSetString(db,"login","login");
KvSetString(db,"password","Password");
KvRewind(db);
if (!FileToKeyValues(db,"cfg/steamprotect.txt"))
{
KeyValuesToFile(db,"cfg/steamprotect.txt");
}
CloseHandle(db);
}
public OnClientPutInServer(client)
{
new String:auth[30];
//GetClientAuthString(client,auth,sizeof(auth));
new Handle:db = CreateKeyValues("steamprotect");
FileToKeyValues(db,"cfg/steamprotect.txt");
if (((GetClientAuthString(client, auth, sizeof(auth))) && (KvJumpToKey(db, auth, false))) || ((GetClientIP(client, auth, sizeof(auth))) && (KvJumpToKey(db, auth, false))))
{
new String:login[30];
KvGetString(db,"login",login,sizeof(login));
new String:password[30];
KvGetString(db,"password",password,sizeof(password));
new String:userpassword[30];
GetClientInfo(client,login,userpassword,sizeof(userpassword));
if (!StrEqual(password,userpassword,false))
{
KickClient(client,"Вы пытались зайти с чужим SteamId");
new String:name[50];
GetClientName(client,name,sizeof(name));
PrintToChatAll("%s пытался зайти с чужим SteamId",name);
PrintToServer("%s %s bad login",name,auth);
}
}
CloseHandle(db);
}
public Action:cmdcallbackadd(args)
{
if (args < 3)
{
PrintToServer("Usage : sp_add '<steamid>' '<login>' '<password>'");
return Plugin_Handled;
}
new Handle:db = CreateKeyValues("steamprotect");
FileToKeyValues(db,"cfg/steamprotect.txt")
new String:auth[50];
new String:log[50];
new String:pass[50];
GetCmdArg(1,auth,sizeof(auth));
GetCmdArg(2,log,sizeof(log));
GetCmdArg(3,pass,sizeof(pass));
KvJumpToKey(db,auth,true);
KvSetString(db,"login",log);
KvSetString(db,"password",pass);
PrintToServer("For steam %s set password %s and login %s",auth,pass,log);
KvRewind(db);
KeyValuesToFile(db,"cfg/steamprotect.txt");
CloseHandle(db);
return Plugin_Continue;
}
public Action:cmdcallbackdel(args)
{
if (args != 1)
{
PrintToServer("Usage : sp_del '<steamid>>'");
return Plugin_Handled;
}
new Handle:db = CreateKeyValues("steamprotect");
FileToKeyValues(db,"cfg/steamprotect.txt");
new String:auth[50];
GetCmdArg(1,auth,sizeof(auth));
KvJumpToKey(db,auth,false);
if (KvDeleteThis(db))
{
PrintToServer("For steam %s removed protect",auth);
KvRewind(db);
KeyValuesToFile(db,"cfg/steamprotect.txt");
}
else
{
PrintToServer("Steam %s not exists",auth);
}
CloseHandle(db);
return Plugin_Continue;
}