Code:
/* This plugin will announce the connection/disconnection of all clients
*
* Setup:
* 1) Setup users with 2048 access.
*
* Known issues:
* 1) If a person with 2048 access is the first to join the server after a map
* change, they may recieve a warning message in the console. That ADMIN
* cannot find the user. Ignore it. :)
*
* This seems to be due to AM loading the users.ini and not finding the user
* in time to validate the accesslevel.
*
* This is just a test but for v2.50.1 I have added a timer so that after 20
* seconds from the connection, the announcment is attempted.
*
* thanx to [fah-q] Dio
*
* changes by SN8P
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#include <sound>
#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] = "";
new Red = 0;
new Green = 255;
new Blue = 0;
if (lConnect == 0) {
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, "^nhas connected",MAX_DATA_LENGTH);
Red = 25;
Green = 25;
Blue = 125;
}
if (lConnect == 1) {
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, "^nhas left the game",MAX_DATA_LENGTH);
Red = 25;
Green = 25;
Blue = 125;
}
if (lConnect == 2) {
strcat(Text, "Admin ",MAX_DATA_LENGTH);
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, "^nhas connected",MAX_DATA_LENGTH);
Red = 125;
Green = 25;
Blue = 25;
}
if (lConnect == 3) {
strcat(Text, "Admin ",MAX_DATA_LENGTH);
strcat(Text, strName,MAX_DATA_LENGTH);
strcat(Text, "^nhas left the game",MAX_DATA_LENGTH);
Red = 125;
Green = 25;
Blue = 25;
}
/* für alle den sound ausgeben */
// playsoundall("greetings.wav");
/* oder nur für den Der connected */
// playsound(strName, "greetings.wav");
centersay(Text, 7, Red, Green, Blue);
}
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, 2);
else 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, 3);
else 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;
}
!ACHTUNG!
Bitte noch (ungefär Mitte) entscheiden welche sound-announce-variente man möchte !!!
_________________
Denn nur wer was zu sagen hat,
Der hat's, wenn es nicht unabdingbar ist
http://clan-ggg.de.vu/