/* This plugin will announce the connection/disconnection of clients with the
* correct access level.
*
* Setup:
* Setup users with 2048 access.
* [fah-q] Dio
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_ANNOUNCE 2048
#define ANNOUNCE_DELAY 20
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1";
plr_announce(strName[], lConnect=0) {
new Text[MAX_TEXT_LENGTH] = "";
if (lConnect == 1) {
strcat(Text,"You're in luck!!^n",MAX_DATA_LENGTH);
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, " has completed your ranks!",MAX_DATA_LENGTH);
} else {
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, "^nhas left the building!",MAX_DATA_LENGTH);
}
centersay(Text, 7, 12, 125, 12);
}
public plugin_connect(HLUserName, HLIP, UserIndex) {
new strName[MAX_NAME_LENGTH];
convert_string(HLUserName, strName, MAX_NAME_LENGTH);
set_timer("ann_timer",ANNOUNCE_DELAY, 1, strName);
return PLUGIN_CONTINUE;
}
public plugin_disconnect(HLUserName, UserIndex) {
new strName[MAX_NAME_LENGTH];
convert_string(HLUserName, strName, MAX_NAME_LENGTH);
if (access(ACCESS_ANNOUNCE, strName)!=0)
plr_announce(strName, 0);
return PLUGIN_CONTINUE;
}
public ann_timer(Timer,Repeat,HLName,HLParam) {
new strName[MAX_NAME_LENGTH];
convert_string(HLParam,strName,MAX_NAME_LENGTH);
if (access(ACCESS_ANNOUNCE, strName)!=0)
plr_announce(strName, 1);
}
public plugin_init() {
plugin_registerinfo("Admin Connection Announcment Plugin","Announces the (dis)connection of players with correct access level.",STRING_VERSION);
return PLUGIN_CONTINUE;
}
|