falko-hartmann.de

Black Knight's Passwortentferner v1.0 (22.08.2003)

Beschreibung

Dieses Plugin entfernt das Passwort vom Server, wenn sich 10 Minuten niemand darauf aufhält, und führt die server.cfg aus.

Das ist praktisch, wenn man regelmäßig nach Clanwars vergisst, das Passwort zu entfernen.

Es handelt sich mehr oder weniger um ein "Fire and Forget" Plugin, dass ich mal auf Anfrage gemacht habe. Keine Ahnung, ob es funktioniert.


Download

plugin_bk_passwordremover


Installation

  1. Falls im Normalbetrieb ein Passwort verwendet wird, plugin_bk_passwordremover.sma in einem Texteditor öffnen und in der Zeile
    new spasswd2[MAX_TEXT_LENGTH]="";
    das eigene Passwort zwischen die Anführungszeichen schreiben.
  2. Falls eine andere Zeit als 10 min benötigt wird, plugin_bk_passwordremover.sma in einem Texteditor öffnen und in der Zeile
    new seconds=600;
    auf die gewünschte Sekundenzahl ändern (600 s = 10 min).
  3. Kompilieren des Plugins
  4. Installation des Plugins (inkl. Eintrag in die plugin.ini)
  5. Mapchange

Befehle

Keine! Läuft vollautomatisch.


Quellcode

plugin_bk_passwordremover.sma:

/* 
Black Knight's Password Remover v1.0 
*/ 
 
#include <core> 
#include <string> 
#include <admin> 
#include <adminlib> 
 
new AM_VERSION_STRING[] = "1.0"; 
new seconds=600; 
new passcmd[MAX_TEXT_LENGTH]="admin_nopass"; 
new datacmd[MAX_TEXT_LENGTH]=""; 
new spasswd[MAX_TEXT_LENGTH]="none"; 
new spasswd2[MAX_TEXT_LENGTH]=""; 
new timerid=0; 
 
public plugin_connect(HLUserName, HLIP, UserIndex) { 
   if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS && timerid!=0) { 
      kill_timer(timerid); 
      timerid=0; 
   } 
   return PLUGIN_CONTINUE; 
} 
 
public plugin_disconnect(HLUserName, UserIndex) { 
   if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { 
      set_timer("start_check_empty",10,0); 
   } 
   return PLUGIN_CONTINUE; 
} 
 
public reset_password(Timer,Repeat,HLUserName,HLParam){ 
   plugin_exec(passcmd,datacmd); 
   exec("exec server.cfg"); 
   return PLUGIN_CONTINUE; 
} 
 
start_counter(){ 
   new apasswd[MAX_NAME_LENGTH]; 
   getstrvar("sv_password",apasswd,MAX_NAME_LENGTH); 
   if (streq(apasswd,spasswd)==0 && streq(apasswd,spasswd2)==0){ 
      timerid=set_timer("reset_password",seconds,0); 
   } 
   return PLUGIN_CONTINUE; 
} 
 
public start_check_empty(Timer,Repeat,HLUserName,HLParam){ 
   new maxplayer=playercount(); 
   if (maxplayer==0) { 
      start_counter(); 
   } 
   return PLUGIN_CONTINUE; 
} 
 
public plugin_init() { 
   plugin_registerinfo("Black Knights Password Remover","Removes password, if server is empty for some time.",AM_VERSION_STRING); 
   set_timer("start_check_empty",10,0);    
   return PLUGIN_CONTINUE; 
}