|
Author
|
Message
|
|
Junior Member
|

08-06-2009
, 18:11
Idle and Spectator kicker
|
#1
|
This is my first attempt at a plugin so be kind. I'm trying to write a plugin that will kick idlers and spectators when our server gets full. It's not exactly doing what I want it to and was hoping for some suggestions on another approach.
#include <sourcemod>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "CleanHouse",
author = "TheBigD",
description = "Kicks idle player and spectators",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net/"
}
public OnPluginStart()
{
CreateConVar("sm_CleanHouse_version", PLUGIN_VERSION, "Version of CleanHouse", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);
RegAdminCmd("sm_cleanhouse", Command_clean, ADMFLAG_KICK);
}
public Action:Command_clean(client, args)
{
LogAction(client, -1, "\"%L\" initiated a House Cleaning.", client);
ShowActivity(client, "%s", "\"%L\" initiated a House Cleaning. You have 60 seconds to get playing!", client);
ServerCommand("mp_idledealmethod 2");
ServerCommand("mp_idlemaxtime 1");
CreateTimer(61.0, Timer_Kick);
}
public Action:Timer_Kick(Handle:timer)
{
ServerCommand("mm_max_spectators 0");
ServerCommand("mp_idledealmethod 0");
ServerCommand("mp_idlemaxtime 5");
ServerCommand("mm_max_spectators 32");
PrintToChatAll("All idle players and spectators have been kicked.");
LogAction(-1, -1, "idlemethods and maxspec have been reset.");
return Plugin_Handled;
}
|
|
|
|