AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Idle and Spectator kicker (https://forums.alliedmods.net/showthread.php?t=99545)

TheBigD 08-06-2009 18:11

Idle and Spectator kicker
 
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;
}

Arkshine 08-06-2009 18:13

Re: Idle and Spectator kicker
 
Wrong section.

TheBigD 08-06-2009 18:30

Re: Idle and Spectator kicker
 
Will someone move this to the Sourcemod scripting help area. My mistake.

Arkshine 08-06-2009 18:33

Re: Idle and Spectator kicker
 
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


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

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