Code:
// plugin_sank_listen.sma
// Author: Luke Sankey
// Date March 31, 2001
//
// Fuctions included in this plugin:
// Intercepts all client say messages and sends them to admins
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_LISTEN 2048
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
public plugin_init()
{
plugin_registerinfo("Sank Listen Plugin", "Enables admins to hear everything from everybody.", STRING_VERSION);
plugin_registercmd("say", "HandleSay", ACCESS_ALL);
plugin_registercmd("say_team", "HandleSay", ACCESS_ALL);
return PLUGIN_CONTINUE;
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
///////////////////////////////////////////////////////////////////////////////
// TODO: comments needed here
///////////////////////////////////////////////////////////////////////////////
public HandleSay(HLCommand, HLData, HLUserName, UserIndex)
{
new Command[MAX_COMMAND_LENGTH];
new Speech[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLCommand, Command, MAX_COMMAND_LENGTH);
convert_string(HLData, Speech, MAX_DATA_LENGTH);
convert_string(HLUserName, User, MAX_NAME_LENGTH);
strstripquotes(Speech);
// Display all messages to server admins, whether dead or alive
new i;
new maxplayers = maxplayercount();
new Name[MAX_NAME_LENGTH];
new SessionID, WONID;
new UserTeam, UserDead;
new ListenTeam, ListenDead;
// Message the Listener on two conditions:
// 1. If User's "dead status" is not same as listener's "dead status,"
// 2. If command is say_team and User's "team status" is not same
// Otherwise, the listener will see it anyway, so there is no need to
// repeat it, which would make it show twice to the listener.
snprintf(Text, MAX_TEXT_LENGTH, "%s : %s", User, Speech);
// Get User's information/status
if (playerinfo(UserIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead))
{
// Get each player's information/status and compare it to User's
for(i=1; i<=maxplayers; i++)
{
if(playerinfo(i, Name, MAX_NAME_LENGTH, SessionID, WONID, ListenTeam, ListenDead) == 1)
{
if(access(ACCESS_LISTEN, Name))
{
// Message the Listener on two conditions:
// 1. If the UserDead is not the same as ListenDead,
if (UserDead != ListenDead)
{
messageex(Name, Text, print_chat);
}
// 2. or if Command is "say_team" and User's Team is not the same as Listener's Team
else if ( (streq(Command, "say_team") == 1) && (UserTeam != ListenTeam) )
{
messageex(Name, Text, print_chat);
}
} // endif ACCESS_LISTEN
}
} // End for loop
}
return PLUGIN_CONTINUE;
}
welche notice?
hab`s bei mir auch druff, aber kann mich an keine notice erinnern...
oder meinst du: this server allow an admin to use commands on u client..
oder so...