Created
June 4, 2011 23:40
-
-
Save Hoikas/1008501 to your computer and use it in GitHub Desktop.
Adam's Versus Mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sourcemod> | |
public Plugin:myinfo = { | |
name = "[L4D2] Adam's Versus Mod", | |
author = "Adam Johnson", | |
description = "A variety of modifications for L4D2's Versus mode", | |
version = "1.0.0", | |
url = "http://www.hoikas.com" | |
}; | |
new Handle:g_hGameMode | |
new Handle:g_hKickBots | |
new Handle:g_hKickDC1Tank | |
public OnPluginStart() { | |
g_hGameMode = FindConVar("mp_gamemode") | |
g_hKickBots = CreateConVar("avm_disable_special_bots", "1", "Sets whether or not we should kick SI bots in Versus mode") | |
g_hKickDC1Tank = CreateConVar("avm_disable_c1m1_tank", "1", "Sets whether or not we allow a tank spawn in c1m1_hotel") | |
HookEvent("player_spawn", Event_PlayerSpawn) | |
} | |
public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) { | |
//Grab the contents of mp_gamemode | |
decl String:mode[8] | |
GetConVarString(g_hGameMode, mode, sizeof(mode)) | |
//If this isn't versus, exit normally | |
if (strcmp(mode, "versus", false) != 0) { | |
return Plugin_Continue | |
} | |
//Grab plugin convars | |
new kick_bots = GetConVarBool(g_hKickBots) | |
new kick_dc1tank = GetConVarBool(g_hKickDC1Tank) | |
//Get some basic information about the client... | |
new userID = GetEventInt(event, "userid") | |
new client = GetClientOfUserId(userID) | |
new teamID = GetClientTeam(client) | |
//Check to see if we're a bot (fake) and for the infected team... | |
//Then, set the kick value... | |
new kick = false | |
if (IsFakeClient(client) && teamID == 3) { | |
decl String:player[5] | |
GetClientName(client, player, sizeof(player)) | |
//Tank? | |
if (strcmp(player, "Tank") == 0) { | |
decl String:map[5] | |
GetCurrentMap(map, sizeof(map)) | |
//Kick the Tank on Dead Center 1 | |
//This is apparently a "feature" (Read: BUG) that Valve introduced with The Passing | |
//We shall rectify this. | |
if ((strcmp(map, "c1m1") == 0) && (kick_dc1tank)) { | |
kick = true | |
} | |
} else if (kick_bots) { | |
kick = true | |
} | |
} | |
//Actually kick the client | |
if (kick) { | |
KickClient(client) | |
return Plugin_Handled | |
} else { | |
return Plugin_Continue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment