Raised This Month: $ Target: $400
 0% 

Idle and Spectator kicker


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
TheBigD
Junior Member
Join Date: Aug 2009
Old 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;
}
TheBigD is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode