AdminMod.de
https://www.adminmod.de/

KICK,BAN,QUIT
https://www.adminmod.de/viewtopic.php?t=10022
Seite 1 von 1

Autor:  exeet [ 16.05.2009, 21:50 ]
Betreff des Beitrags:  KICK,BAN,QUIT

how to do the same in admin mod

Quit. Player: zik. Club: Unknown. IP: 79.135.194.7. Reason: Bad NickName.

Dateianhänge:
de_inferno0000.JPG [91.3 KiB]
182-mal heruntergeladen

Autor:  [WING] Black Knight [ 17.05.2009, 11:31 ]
Betreff des Beitrags: 

You mean kicking in case of a forbidden nickname?

1. I would use the users.ini to forbid certain nicknames. Just put in a password which nobody can guess. The player gets kicked as soon as he changes to the forbidden nick name. There is no plugin needed for this.

2. There is a plugin from sank which would ban players with a certain name: http://www.adminmod.org/index.php?go=as ... 3726977651

Autor:  exeet [ 17.05.2009, 11:57 ]
Betreff des Beitrags: 

Zitat:
You mean kicking in case of a forbidden nickname?

1. I would use the users.ini to forbid certain nicknames. Just put in a password which nobody can guess. The player gets kicked as soon as he changes to the forbidden nick name. There is no plugin needed for this.

2. There is a plugin from sank which would ban players with a certain name: http://www.adminmod.org/index.php?go=as ... 3726977651
Thank you

Autor:  exeet [ 17.05.2009, 11:58 ]
Betreff des Beitrags: 

Code:
/* This plugin shows ip of client*/
/*format of desc_ips.txt name IP desc*/
/* This is my first plugin in Small C. Yakutsk, Russia*/
/* $Id: plugin_showip.sma,v 1.1 beta 2001-2002 W@lker$ */



#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>

#define MAX_IPADDRESS 32
#define MAX_IPDESCRIPT 30


new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1";

new UserIP[MAX_PLAYERS][MAX_IPADDRESS];
new User[MAX_NAME_LENGTH];
new Type[MAX_DATA_LENGTH];
new DFile[MAX_DATA_LENGTH] = "desc_ips.txt";
new IPMessages[MAX_IPDESCRIPT][MAX_DATA_LENGTH];
new NumIPDesc = 0; //Holds number of IPs & Descriptions in file



public get_Descriptions() {
	new IsFile = 0;
	new LineNum = 0;
	new IsLine;
	new sStr[MAX_DATA_LENGTH];
	new Errormsg[MAX_DATA_LENGTH];
	IsFile = fileexists(DFile);

	if (IsFile > 0) {
		do {
			IsLine = readfile(DFile, sStr, LineNum, MAX_DATA_LENGTH);
			if (IsLine) {
				if (strncmp(sStr, "//", 2) == 0) {
					//Ignore comment
				} else {
                                        strcpy(IPMessages[NumIPDesc], sStr, MAX_DATA_LENGTH);
					NumIPDesc++; //IPMessages has been added increment NumIPDescs
                                        say(sStr);
				}
				LineNum++; //Increment LinNum
			}
			if (NumIPDesc == MAX_IPDESCRIPT) {
				return PLUGIN_CONTINUE;
			}
		} while (IsLine);
	} else {
		snprintf(Errormsg, MAX_DATA_LENGTH, "can't find file %s", DFile);
		say(Errormsg);
	}
	return PLUGIN_CONTINUE;
}

public admin_showip(HLCommand,HLData,HLUserName,UserIndex){

new i;
new maxplayers = maxplayercount();
new Name[MAX_NAME_LENGTH];
new UserID;
new WONID;
new Team;
new Data[MAX_DATA_LENGTH];
new STeam =0;
new IP[MAX_DATA_LENGTH];
new IPD[MAX_TEXT_LENGTH];
new IsFlag = 0;

convert_string(HLUserName,User,MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);

STeam = strtonum(Data); // Номер команды.


if (STeam==1) {
messageex(User, "*-------- IP List ---- Terrorists Forces ------------*", print_console);
} else
if (STeam==2) {
messageex(User, "*-------- IP List ---- Counter Terrorists Forces ----*", print_console);
} else {
messageex(User, "*-------- IP List -----------------------------------*", print_console);
}


// Find Users

for(i=1; i<=maxplayers; i++) {
  if (playerinfo(i,Name,MAX_NAME_LENGTH,UserID,WONID,Team) != 0) {

// Formating Output
while(strlen(Name)<=18) {
strcat(Name," ",MAX_NAME_LENGTH);
}//end while loop


strtok(UserIP[i], ":", IP, MAX_IPADDRESS);
strcat(Name,IP,MAX_NAME_LENGTH);
IsFlag = findip(IP, IPD);
if (IsFlag == 1) {
strcat(Name," ",MAX_NAME_LENGTH);
strcat(Name,IPD,MAX_NAME_LENGTH);
                 }

//Display it
if (STeam!=1 && STeam!=2) {
 messageex(User, Name, print_console);
}   else if (STeam==Team && WONID!=0) {
 messageex(User, Name, print_console);
}

  }// if
}//for

messageex(User, "*------------------------------------------------------*", print_console);

return PLUGIN_HANDLED;
}


public admin_ipstatus(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new TargetName[MAX_NAME_LENGTH];
new iIndex;
new Text[MAX_TEXT_LENGTH];
new SessionID;

convert_string(HLData,Data,MAX_DATA_LENGTH);

if (check_user(Data) == 1) {
  get_username(Data,TargetName,MAX_NAME_LENGTH);
  get_userindex(TargetName, iIndex);
  get_userSessionID (TargetName,SessionID);
  selfmessage("1. - Keyword 2. - ID 3. - UserName 4. - IP");
  selfmessage("");
  snprintf(Text, MAX_TEXT_LENGTH,"1. - %s 2. - %i 3.- %s 4. - %s", Data,SessionID,TargetName,UserIP[iIndex]);
  selfmessage(Text);
                           }
else {
     selfmessage("Unrecognized player: ");
     selfmessage(Data);
     }
return PLUGIN_HANDLED;
}



public findip(searchIp[MAX_DATA_LENGTH], searchDesc[MAX_TEXT_LENGTH]) {
new desc[MAX_TEXT_LENGTH];
new ipnum[MAX_TEXT_LENGTH];

for (new i = 0; i < NumIPDesc; i++) {
 strtok(IPMessages[i], ";", ipnum, MAX_DATA_LENGTH);
 strtok( "", ";",desc, MAX_DATA_LENGTH);
 if  (strncmp(ipnum, searchIp,strlen(ipnum)) == 0) {
  searchDesc = desc;
  return 1;
 }
}//for
searchDesc = "";
return 0;
}





public plugin_connect(HLUserName, HLIP, UserIndex) {
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
strinit(UserIP[UserIndex]);
convert_string(HLIP, UserIP[UserIndex], MAX_IPADDRESS);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
snprintf(Type, MAX_DATA_LENGTH, "%s (%s) trying to connect", User, UserIP[UserIndex]);
say(Type);
	}
	return PLUGIN_CONTINUE;
}

public plugin_disconnect(HLUserName, UserIndex) {
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		strinit(UserIP[UserIndex]);
	}
	return PLUGIN_CONTINUE;
}


public plugin_init() {
	plugin_registerinfo("Admin ShowIP Plugin","Show users by IP address.",STRING_VERSION);
	plugin_registercmd("admin_showip","admin_showip",ACCESS_ALL,"admin_showip. Shows the ip addresses of clients.");
        plugin_registercmd("admin_ipstatus","admin_ipstatus",ACCESS_ALL,"Test.");
        get_Descriptions();
	return PLUGIN_CONTINUE;
}


*-------- IP List -----------------------------------*
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 79.


How to do that Name did not close IP

Autor:  [WING] Black Knight [ 18.05.2009, 16:59 ]
Betreff des Beitrags: 

I recommend to increase string length:
Code:
/* This plugin shows ip of client*/
/*format of desc_ips.txt name IP desc*/
/* This is my first plugin in Small C. Yakutsk, Russia*/
/* $Id: plugin_showip.sma,v 1.1 beta 2001-2002 W@lker$ */



#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>

#define MAX_IPADDRESS 32
#define MAX_IPDESCRIPT 30


new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1";

new UserIP[MAX_PLAYERS][MAX_IPADDRESS];
new User[MAX_NAME_LENGTH];
new Type[MAX_DATA_LENGTH];
new DFile[MAX_DATA_LENGTH] = "desc_ips.txt";
new IPMessages[MAX_IPDESCRIPT][MAX_DATA_LENGTH];
new NumIPDesc = 0; //Holds number of IPs & Descriptions in file



public get_Descriptions() {
   new IsFile = 0;
   new LineNum = 0;
   new IsLine;
   new sStr[MAX_DATA_LENGTH];
   new Errormsg[MAX_DATA_LENGTH];
   IsFile = fileexists(DFile);

   if (IsFile > 0) {
      do {
         IsLine = readfile(DFile, sStr, LineNum, MAX_DATA_LENGTH);
         if (IsLine) {
            if (strncmp(sStr, "//", 2) == 0) {
               //Ignore comment
            } else {
                                        strcpy(IPMessages[NumIPDesc], sStr, MAX_DATA_LENGTH);
               NumIPDesc++; //IPMessages has been added increment NumIPDescs
                                        say(sStr);
            }
            LineNum++; //Increment LinNum
         }
         if (NumIPDesc == MAX_IPDESCRIPT) {
            return PLUGIN_CONTINUE;
         }
      } while (IsLine);
   } else {
      snprintf(Errormsg, MAX_DATA_LENGTH, "can't find file %s", DFile);
      say(Errormsg);
   }
   return PLUGIN_CONTINUE;
}

public admin_showip(HLCommand,HLData,HLUserName,UserIndex){

new i;
new maxplayers = maxplayercount();
new Name[MAX_DATA_LENGTH];
new UserID;
new WONID;
new Team;
new Data[MAX_DATA_LENGTH];
new STeam =0;
new IP[MAX_DATA_LENGTH];
new IPD[MAX_TEXT_LENGTH];
new IsFlag = 0;

convert_string(HLUserName,User,MAX_DATA_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);

STeam = strtonum(Data); // Номер команды.


if (STeam==1) {
messageex(User, "*-------- IP List ---- Terrorists Forces ------------*", print_console);
} else
if (STeam==2) {
messageex(User, "*-------- IP List ---- Counter Terrorists Forces ----*", print_console);
} else {
messageex(User, "*-------- IP List -----------------------------------*", print_console);
}


// Find Users

for(i=1; i<=maxplayers; i++) {
  if (playerinfo(i,Name,MAX_DATA_LENGTH,UserID,WONID,Team) != 0) {

// Formating Output
while(strlen(Name)<=18) {
strcat(Name," ",MAX_DATA_LENGTH);
}//end while loop


strtok(UserIP[i], ":", IP, MAX_IPADDRESS);
strcat(Name,IP,MAX_DATA_LENGTH);
IsFlag = findip(IP, IPD);
if (IsFlag == 1) {
strcat(Name," ",MAX_DATA_LENGTH);
strcat(Name,IPD,MAX_DATA_LENGTH);
                 }

//Display it
if (STeam!=1 && STeam!=2) {
 messageex(User, Name, print_console);
}   else if (STeam==Team && WONID!=0) {
 messageex(User, Name, print_console);
}

  }// if
}//for

messageex(User, "*------------------------------------------------------*", print_console);

return PLUGIN_HANDLED;
}


public admin_ipstatus(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new TargetName[MAX_NAME_LENGTH];
new iIndex;
new Text[MAX_TEXT_LENGTH];
new SessionID;

convert_string(HLData,Data,MAX_DATA_LENGTH);

if (check_user(Data) == 1) {
  get_username(Data,TargetName,MAX_NAME_LENGTH);
  get_userindex(TargetName, iIndex);
  get_userSessionID (TargetName,SessionID);
  selfmessage("1. - Keyword 2. - ID 3. - UserName 4. - IP");
  selfmessage("");
  snprintf(Text, MAX_TEXT_LENGTH,"1. - %s 2. - %i 3.- %s 4. - %s", Data,SessionID,TargetName,UserIP[iIndex]);
  selfmessage(Text);
                           }
else {
     selfmessage("Unrecognized player: ");
     selfmessage(Data);
     }
return PLUGIN_HANDLED;
}



public findip(searchIp[MAX_DATA_LENGTH], searchDesc[MAX_TEXT_LENGTH]) {
new desc[MAX_TEXT_LENGTH];
new ipnum[MAX_TEXT_LENGTH];

for (new i = 0; i < NumIPDesc; i++) {
 strtok(IPMessages[i], ";", ipnum, MAX_DATA_LENGTH);
 strtok( "", ";",desc, MAX_DATA_LENGTH);
 if  (strncmp(ipnum, searchIp,strlen(ipnum)) == 0) {
  searchDesc = desc;
  return 1;
 }
}//for
searchDesc = "";
return 0;
}





public plugin_connect(HLUserName, HLIP, UserIndex) {
   if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
strinit(UserIP[UserIndex]);
convert_string(HLIP, UserIP[UserIndex], MAX_IPADDRESS);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
snprintf(Type, MAX_DATA_LENGTH, "%s (%s) trying to connect", User, UserIP[UserIndex]);
say(Type);
   }
   return PLUGIN_CONTINUE;
}

public plugin_disconnect(HLUserName, UserIndex) {
   if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
      strinit(UserIP[UserIndex]);
   }
   return PLUGIN_CONTINUE;
}


public plugin_init() {
   plugin_registerinfo("Admin ShowIP Plugin","Show users by IP address.",STRING_VERSION);
   plugin_registercmd("admin_showip","admin_showip",ACCESS_ALL,"admin_showip. Shows the ip addresses of clients.");
        plugin_registercmd("admin_ipstatus","admin_ipstatus",ACCESS_ALL,"Test.");
        get_Descriptions();
   return PLUGIN_CONTINUE;
}

Seite 1 von 1 Alle Zeiten sind UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/