/* This plugin contains a command for passing around some coffee to the dead. */
 
/* $Id: plugin_cheat.sma,v 1.0 2001/04/09 yensid Exp $ */
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_COFFEE 1
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0";
 
public admin_coffee(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_DATA_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new Dead;
	new i;
	new maxplayers = maxplayercount();
	new Name[MAX_NAME_LENGTH];
	new Result;
	new SessionID;
	new Team;
	new User[MAX_NAME_LENGTH];
	new WONID;
	new Text[MAX_TEXT_LENGTH];
 
	convert_string(HLCommand,Command,MAX_DATA_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_DATA_LENGTH);
	for (i=1; i<=maxplayers; i++) {
		Result = playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead);
		if(Result==1) {
			if (Dead == 1) {
				snprintf(Text, MAX_TEXT_LENGTH, "%s gives you a nice warm cup of coffee to pass the time.", User);
				messageex(Name, Text, print_chat);
			}
		}
	}
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Admin Coffee Plugin","Command for giving dead players a cup of joe.",STRING_VERSION);
 
	plugin_registercmd("admin_coffee","admin_coffee",ACCESS_COFFEE,"admin_coffee: Gives all dead players a nice warm cup of joe.");
	return PLUGIN_CONTINUE;
}