Raised This Month: $ Target: $400
 0% 

Idle and Spectator kicker


Post New Thread Closed Thread   
 
Thread Tools Display Modes
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
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2009 , 18:13   Re: Idle and Spectator kicker
#2

Wrong section.
__________________
Arkshine is offline
TheBigD
Junior Member
Join Date: Aug 2009
Old 08-06-2009 , 18:30   Re: Idle and Spectator kicker
#3

Will someone move this to the Sourcemod scripting help area. My mistake.

Last edited by TheBigD; 08-06-2009 at 18:32.
TheBigD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2009 , 18:33   Re: Idle and Spectator kicker
#4

AMX Mod X = Addon for HL1 Mod.

You have posted a SourceMod plugin. So yes, you are in the wrong section.

http://forums.alliedmods.net/forumdisplay.php?f=107
__________________
Arkshine is offline
Closed Thread



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