AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   Esay Set,Remove,Find Password (https://forums.alliedmods.net/showthread.php?t=320455)

EzEnDLeSs 12-23-2019 05:31

Esay Set,Remove,Find Password
 
1 Attachment(s)
This Plugin By EZU

Cruze 12-24-2019 10:53

Re: Esay Set,Remove,Find Password
 
PHP Code:

#include <sourcmod>

#pragma semicolon 1 
#pragma newdecls required 

char g_szSvPassword[128];

public 
Plugin myinfo =

    
name "[ShirazCs] Password (!pw,!rpw,!npw,!fpw Find Password)",
    
description "Set Server Password",
    
author "<<-E Z U->>",
    
version "1.0",
    
url "t.me/ShirazCs"
}

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_pw"CommandPasswordADMFLAG_ROOT"Set Server Password");
    
RegAdminCmd("sm_rpw"CommandRemovePasswordADMFLAG_ROOT"Remove Server Password");
    
RegAdminCmd("sm_npw"CommandRemovePasswordADMFLAG_ROOT"Remove Server Password");
    
RegAdminCmd("sm_fpw"CommandFindPasswordADMFLAG_ROOT"Find Server Password");
    
ConVar g_hCVsv_password FindConVar("sv_password");
    
GetConVarString(g_hCVsv_passwordg_szSvPassword128);
    
HookConVarChange(g_hCVsv_passwordConVar_OnChangeserverPassword);
    
delete g_hCVsv_password;
}

public 
int ConVar_OnChangeserverPassword(ConVar cvarchar[] oldValuechar[] newValue)
{
    
GetConVarString(cvarg_szSvPassword128);
    return 
0;
}

public 
Action CommandFindPassword(int clientint args)
{
    
char szClientName[32];
    
GetClientName(clientszClientName32);
    
char sDate[64];
    
FormatTime(sDate64"%Y-%m-%d", -1);
    
char sTime[64];
    
FormatTime(sTime64"%H:%M:%S", -1);
    
char zefile[256];
    
BuildPath(Path_SMzefile256"logs/Password_%s.ini"sDate);
    
PrintHintTextToAll("[ShirazCs] Server Password [%s]"g_szSvPassword);
    
PrintToChatAll("[SM] Server Password : %s \x01[%s]"g_szSvPasswordsTime);
    
LogToFile(zefile"Admin [%s] Find Server Password in [ %s - %s ]"szClientNamesDatesTime);
    return 
Plugin_Handled;
}

public 
Action CommandRemovePassword(int clientint args)
{
    
char szClientName[32];
    
GetClientName(clientszClientName32);
    
char sDate[64];
    
FormatTime(sDate64"%Y-%m-%d", -1);
    
char sTime[64];
    
FormatTime(sTime64"%H:%M:%S", -1);
    
char zefile[256];
    
BuildPath(Path_SMzefile256"logs/Password_%s.ini"sDate);
    
ServerCommand("sm_cvar sv_password none");
    
PrintToChatAll("[SM] Removed Server Password \x01[%s]"sTime);
    
LogToFile(zefile"Admin [%s] Removed Server Password in [ %s - %s ]"szClientNamesDatesTime);
    return 
Plugin_Handled;
}

public 
Action CommandPassword(int clientint args)
{
    
char Pass[256];
    
GetCmdArg(1Pass256);
    
char szClientName[32];
    
GetClientName(clientszClientName32);
    
char sDate[64];
    
FormatTime(sDate64"%Y-%m-%d", -1);
    
char sTime[64];
    
FormatTime(sTime64"%H:%M:%S", -1);
    
char zefile[256];
    
BuildPath(Path_SMzefile256"logs/Password_%s.ini"sDate);
    if (
StrEqual(Pass""true))
    {
        
ServerCommand("sm_cvar sv_password none");
        
PrintToChatAll("[SM] Removed Server Password \x01[%s]"sTime);
        
LogToFile(zefile"Admin [%s] Removed Server Password in [ %s - %s ]"szClientNamesDatesTime);
    }
    else
    {
        
ServerCommand("sm_cvar sv_password %s"Pass);
        
PrintToChatAll("[SM] %s Set Server Password To : %s \x01[%s]"szClientNamePasssTime);
        
PrintHintTextToAll("[ShirazCs] Server Password [%s]"Pass);
        
LogToFile(zefile"Admin [%s] Set Server Password To : %s [ %s - %s ]"szClientNamePasssDatesTime);
    }
    return 
Plugin_Handled;


Decompiled plugin if anyone needs it.
Untested.


All times are GMT -4. The time now is 03:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.