/* 
* Copyright 2002 Brad Schulteis
* This plugin allows users to control the monster plugin by Botman.
* Thanks to Botman & Admin Mod team.
* $Id: plugin_monster.sma,v 0.4b 2002/06/21 PrivateRyan Exp $
*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_MONSTER ACCESS_BAN
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.11";
new sMCommand[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Target[MAX_DATA_LENGTH];
new TargetName[MAX_NAME_LENGTH];
new sMText[MAX_TEXT_LENGTH];
new sMText2[MAX_TEXT_LENGTH];
new mVal[MAX_TEXT_LENGTH];
 
public admin_monster(HLsMCommand, HLData, HLUserName, UserIndex) {
 
	convert_string(HLsMCommand,sMCommand,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
	strbreak(Data,Target,mVal, MAX_DATA_LENGTH);
	if (check_user(Target)==1) {
		get_username(Target,TargetName,MAX_NAME_LENGTH);
		if(check_immunity(TargetName)==1) {
			snprintf(sMText, MAX_TEXT_LENGTH, "You can't monster %s, you silly bear.", TargetName);
			say(sMText);
		}else if(getvar("monster_spawn")==1){
			spawn_monster();
		}else{
			selfmessage("Sorry, spawning of monsters is disabled.");
		}
	}else{
		snprintf(sMText, MAX_TEXT_LENGTH, "%s not found on server.", Target);
		selfmessage(sMText);
	}
	return PLUGIN_HANDLED;
}
 
public spawn_monster(){
	new Monster[MAX_TEXT_LENGTH];
	if (streq(mVal,"0")){
		Monster="agrunt";
	}else if (streq(mVal,"1")){
		Monster="bullsquid";
	}else if (streq(mVal,"2")){
		Monster="hassassin";
	}else if (streq(mVal,"3")){
		Monster="headcrab";
	}else if (streq(mVal,"4")){
		Monster="houndeye";
	}else if (streq(mVal,"5")){
		Monster="hgrunt";
	}else if (streq(mVal,"6")){
		Monster="islave";
	}else if (streq(mVal,"7")){
		Monster="scientist";
	}else if (streq(mVal,"8")){
		Monster="snark";
	}else if (streq(mVal,"9")){
		Monster="zombie";
	}else{
		selfmessage("Not a valid monster. Please use 0-9");
		return PLUGIN_HANDLED;
	}
 
	snprintf(sMText, MAX_TEXT_LENGTH, "%s, be careful! ^n A(n) %s is after you!",TargetName,Monster);
	centersay(sMText,5,0,255,0);
	snprintf(sMText2,MAX_TEXT_LENGTH,"monster %s ^"%s^"",Monster,TargetName);
	exec(sMText2);
	return PLUGIN_HANDLED;
}
 
public plugin_init() {
	plugin_registerinfo("admin_monster","Sends a monster after <target>!",STRING_VERSION);
	plugin_registercmd("admin_monster","admin_monster",ACCESS_MONSTER,"admin_monster <target> <0-9>: Sends a monster after <target>!");
	return PLUGIN_CONTINUE;	
}