mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-05 16:13:20 +00:00
update some plugins
This commit is contained in:
parent
8bcffc9e1e
commit
788981e7f9
9 changed files with 61 additions and 22 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -78,7 +78,7 @@ New logic overview:
|
|||
3. Find the closest tank
|
||||
4. Retreat if in close range (~300 units)
|
||||
*/
|
||||
public Action BotControlTimerV2(Handle timer)
|
||||
Action BotControlTimerV2(Handle timer)
|
||||
{
|
||||
//remove timer once tanks no longer exists/are all dead or finale escape vehicle arrived
|
||||
if(bEscapeReady || iAliveTanks == 0) {
|
||||
|
@ -136,7 +136,7 @@ void resetPlugin() {
|
|||
}
|
||||
|
||||
|
||||
public void FindExistingTank() {
|
||||
void FindExistingTank() {
|
||||
//Loop all valid clients, check if they a BOT and an infected. Check for a name that contains "Tank"
|
||||
iAliveTanks = 0;
|
||||
char name[16];
|
||||
|
|
|
@ -168,7 +168,7 @@ public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] err
|
|||
else
|
||||
KickClient(client, "You have been banned from this server.");
|
||||
|
||||
char query[64];
|
||||
char query[128];
|
||||
Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = ?", steamid);
|
||||
db.Query(DB_OnBanQuery, query);
|
||||
}else{
|
||||
|
|
|
@ -408,7 +408,7 @@ public void OnMapEnd() {
|
|||
}
|
||||
ammoPacks.Clear();
|
||||
playersLoadedIn = 0;
|
||||
L4D2_RunScript("ExtraPlayerHUD <- { Fields = { } }; HUDSetLayout(ModeHUD); HUDPlace( g_ModeScript.HUD_RIGHT_BOT, 0.72, 0.79, 0.25, 0.2 ); g_ModeScript");
|
||||
L4D2_RunScript("ExtraPlayerHUD <- { Fields = { } }; HUDSetLayout(ExtraPlayerHud); HUDPlace( g_ModeScript.HUD_RIGHT_BOT, 0.72, 0.79, 0.25, 0.2 ); g_ModeScript");
|
||||
}
|
||||
|
||||
public void Event_RoundFreezeEnd(Event event, const char[] name, bool dontBroadcast) {
|
||||
|
@ -604,7 +604,7 @@ public Action OnUpgradePackUse(int entity, int activator, int caller, UseType ty
|
|||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char classname[32];
|
||||
static char classname[32];
|
||||
int upgradeBits = GetEntProp(primaryWeapon, Prop_Send, "m_upgradeBitVec"), ammo;
|
||||
|
||||
//Get the new flag bits
|
||||
|
@ -623,10 +623,7 @@ public Action OnUpgradePackUse(int entity, int activator, int caller, UseType ty
|
|||
if(currentAmmo > 10) ammo = 10;
|
||||
}
|
||||
}
|
||||
//Reset after minute after first pickup
|
||||
if(clients.Length == 0) {
|
||||
CreateTimer(60.0, Timer_ResetAmmoPack, entity);
|
||||
}
|
||||
|
||||
if(GetEntProp(primaryWeapon, Prop_Send, "m_iClip1") < ammo) {
|
||||
SetEntProp(primaryWeapon, Prop_Send, "m_iClip1", ammo);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
#define CLOWN_MUSIC_THRESHOLD 30
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#define PLUGIN_VERSION "1.0"
|
||||
|
@ -29,10 +31,10 @@ static ConVar hPercentFallen;
|
|||
static ConVar hTotalZombies;
|
||||
static ConVar hZCommonLimit;
|
||||
|
||||
static bool IsDoneLoading;
|
||||
static bool IsDoneLoading, clownMusicPlayed;
|
||||
|
||||
static int iCurrentCommons;
|
||||
static int commonLimit;
|
||||
static int iCurrentCommons, commonLimit, clownCommonsSpawned;
|
||||
static int commonType[2048];
|
||||
|
||||
#define COMMON_MODELS_COUNT 6
|
||||
static char INFECTED_MODELS[COMMON_MODELS_COUNT][] = {
|
||||
|
@ -58,6 +60,8 @@ enum CommonTypes {
|
|||
Common_Worker = -1,
|
||||
};
|
||||
|
||||
//TODO: Add back survivor zombie, inc z_fallen_max_count
|
||||
|
||||
public void OnPluginStart() {
|
||||
EngineVersion g_Game = GetEngineVersion();
|
||||
if(g_Game != Engine_Left4Dead2) {
|
||||
|
@ -77,7 +81,7 @@ public void OnPluginStart() {
|
|||
hTotalZombies.AddChangeHook(CVAR_hTotalZombiesChanged);
|
||||
CVAR_hTotalZombiesChanged(hTotalZombies, "0", "0");
|
||||
|
||||
HookEvent("infected_death", Event_InfectedDeath);
|
||||
//HookEvent("infected_death", Event_InfectedDeath);
|
||||
|
||||
RegConsoleCmd("sm_population_list", Cmd_List, "Lists the current population percentages", FCVAR_NONE);
|
||||
RegConsoleCmd("sm_populations", Cmd_List, "Lists the current population percentages", FCVAR_NONE);
|
||||
|
@ -96,6 +100,7 @@ public void OnMapStart() {
|
|||
public void OnMapEnd() {
|
||||
IsDoneLoading = false;
|
||||
iCurrentCommons = 0;
|
||||
clownCommonsSpawned = 0;
|
||||
}
|
||||
|
||||
public void CVAR_hTotalZombiesChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
|
||||
|
@ -108,6 +113,8 @@ public void CVAR_hTotalZombiesChanged(ConVar convar, const char[] oldValue, cons
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Setup music to play when % of clowns are in
|
||||
|
||||
public void OnEntityCreated(int entity, const char[] classname) {
|
||||
if (StrEqual(classname, "infected") && IsDoneLoading) {
|
||||
SDKHook(entity, SDKHook_SpawnPost, Hook_SpawnPost);
|
||||
|
@ -117,18 +124,28 @@ public void OnEntityCreated(int entity, const char[] classname) {
|
|||
if(GetRandomFloat() <= hPercentTotal.FloatValue) {
|
||||
if(GetRandomFloat() <= hPercentClown.FloatValue) {
|
||||
SetEntityModel(entity, INFECTED_MODELS[Common_Clown]);
|
||||
commonType[entity] = 2;
|
||||
}else if(GetRandomFloat() <= hPercentMud.FloatValue) {
|
||||
SetEntityModel(entity, INFECTED_MODELS[Common_Mud]);
|
||||
commonType[entity] = 3;
|
||||
}else if(GetRandomFloat() <= hPercentCeda.FloatValue) {
|
||||
SetEntityModel(entity, INFECTED_MODELS[Common_Ceda]);
|
||||
commonType[entity] = 4;
|
||||
}else if(GetRandomFloat() <= hPercentWorker.FloatValue) {
|
||||
//worker has multiple models:
|
||||
SetEntityModel(entity, WORKER_MODELS[GetRandomInt(0,2)]);
|
||||
commonType[entity] = 5;
|
||||
}else if(GetRandomFloat() <= hPercentRiot.FloatValue) {
|
||||
SetEntityModel(entity, INFECTED_MODELS[Common_Riot]);
|
||||
commonType[entity] = 6;
|
||||
}else if(GetRandomFloat() <= hPercentJimmy.FloatValue) {
|
||||
SetEntityModel(entity, INFECTED_MODELS[Common_Jimmy]);
|
||||
commonType[entity] = 7;
|
||||
}else{
|
||||
commonType[entity] = 1;
|
||||
}
|
||||
}else{
|
||||
commonType[entity] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,11 +158,33 @@ public Action Hook_SpawnPost(int entity) {
|
|||
}
|
||||
}
|
||||
++iCurrentCommons;
|
||||
if(commonType[entity] == 2) {
|
||||
if(++clownCommonsSpawned > CLOWN_MUSIC_THRESHOLD && !clownMusicPlayed) {
|
||||
clownMusicPlayed = true;
|
||||
EmitSoundToAll("custom/clown.mp3");
|
||||
//Play music
|
||||
}
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action Event_InfectedDeath(Event event, const char[] name, bool dontBroadcast) {
|
||||
--iCurrentCommons;
|
||||
// public Action Event_InfectedDeath(Event event, const char[] name, bool dontBroadcast) {
|
||||
// --iCurrentCommons;
|
||||
// if(commonType[entity] == 2) {
|
||||
// --clownCommonsSpawned;
|
||||
// }
|
||||
// }
|
||||
|
||||
public void OnEntityDestroyed(int entity) {
|
||||
if(commonType[entity] > 0) {
|
||||
commonType[entity] = 0;
|
||||
if(commonType[entity] == 2) {
|
||||
--clownCommonsSpawned;
|
||||
}
|
||||
if(--iCurrentCommons < CLOWN_MUSIC_THRESHOLD - 10) {
|
||||
clownMusicPlayed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Action Cmd_List(int client, int args) {
|
||||
|
|
|
@ -37,6 +37,7 @@ static bool isLateLoad, cookieModelsSet, isL4D1Survivors;
|
|||
static int survivors;
|
||||
static bool IsTemporarilyL4D2[MAXPLAYERS]; //Use index 0 to state if its activated
|
||||
static char currentMap[16];
|
||||
Handle cookieModelTimer;
|
||||
|
||||
static Menu chooseMenu;
|
||||
|
||||
|
@ -295,7 +296,8 @@ public void OnMapStart() {
|
|||
}
|
||||
//Either use preferred model OR find the least-used.
|
||||
public Action Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
|
||||
RequestFrame(Frame_CheckClient, event.GetInt("userid"));
|
||||
if(hCookiesEnabled.IntValue > 0)
|
||||
RequestFrame(Frame_CheckClient, event.GetInt("userid"));
|
||||
}
|
||||
public Action Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) {
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
|
@ -311,11 +313,11 @@ public void Frame_CheckClient(int userid) {
|
|||
int survivorThreshold = hCookiesEnabled.IntValue == 1 ? 4 : 0;
|
||||
if(++survivors > survivorThreshold && g_iPendingCookieModel[client] > 0) {
|
||||
//A model is set: Fetched from cookie
|
||||
if(!cookieModelsSet) {
|
||||
cookieModelsSet = true;
|
||||
CreateTimer(0.2, Timer_SetAllCookieModels);
|
||||
}else {
|
||||
RequestFrame(Frame_SetPlayerModel, client);
|
||||
CreateTimer(0.2, Timer_SetClientModel, client);
|
||||
if(cookieModelTimer != null && !cookieModelsSet) {
|
||||
delete cookieModelTimer;
|
||||
}else{
|
||||
cookieModelTimer = CreateTimer(20.0, Timer_SetAllCookieModels);
|
||||
}
|
||||
}else{
|
||||
//Model was not set: Use least-used survivor.
|
||||
|
@ -324,12 +326,13 @@ public void Frame_CheckClient(int userid) {
|
|||
}
|
||||
}
|
||||
}
|
||||
public void Frame_SetPlayerModel(int client) {
|
||||
public Action Timer_SetClientModel(Handle timer, int client) {
|
||||
SetEntityModel(client, survivor_models[g_iPendingCookieModel[client] - 1]);
|
||||
SetEntProp(client, Prop_Send, "m_survivorCharacter", g_iPendingCookieModel[client] - 1);
|
||||
g_iPendingCookieModel[client] = 0;
|
||||
}
|
||||
public Action Timer_SetAllCookieModels(Handle h) {
|
||||
cookieModelsSet = true;
|
||||
for(int i = 1; i <= MaxClients; i++) {
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && g_iPendingCookieModel[i] && GetClientTeam(i) == 2) {
|
||||
SetEntityModel(i, survivor_models[g_iPendingCookieModel[i] - 1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue